Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc disable ALL warnings for a few lines of code

Tags:

c

gcc

I have the same problem as described by Jonathon Reinhart here: Temporarily disable gcc warning on redefinition

That is because I have to use thrid party libraries (C only) which throws tons of warnings like this

Warning "__always_inline" redefined [enabled by default]    

What I want is something like this:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-W???"
  #include "someheader.h"
  #include "otherheader.h"
#pragma GCC diagnostic pop

Is there a way to disable warnings by gcc which are enabled by default with a

#pragma GCC diagnostic ignored

EDIT: here is the block causing the warning (file: compiler.h):

#if defined(__CC_ARM)
#   define __always_inline   __forceinline
#elif (defined __GNUC__)
#   define __always_inline   inline __attribute__((__always_inline__))
#elif (defined __ICCARM__)
#   define __always_inline   _Pragma("inline=forced")
#endif
like image 432
Johann Horvat Avatar asked Jan 03 '15 08:01

Johann Horvat


1 Answers

I fixed it by undefining all lines where __always_inline was defined. :-( Thanks Jasen for helping!

like image 130
Johann Horvat Avatar answered Oct 02 '22 10:10

Johann Horvat