9

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
3
  • 1
    it's rude of them to use reserved names like that. Have you contacted the vendors of the libraries? You oould ask them to supply header files suitable for use with a C compiler. or you could attack the supplied headers with sed or similar and change the macros to not use reserved names. Commented Jan 3, 2015 at 9:58
  • 7
    "sweep the bugs under the rug" seems like a sub-optimal solution to this problem Commented Jan 3, 2015 at 10:05
  • The vendor (Atmel) is informed: asf.atmel.com/bugzilla/show_bug.cgi?id=3486 You're right. Sweeping bugs isn't the best solution, but fixing bugs like redefinition of exact the same __always_inline lines for every new version of the library again and again is even worse. Commented Jan 3, 2015 at 10:44

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.