Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // in some file:
- #define HAS_GNU (defined(__GNUC__) && !defined(__clang__))
- // possibly in another file:
- #if defined(__clang__) || HAS_GNU
- /* ... */
- #endif
- test.cc:5:27: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
- #if defined(__clang__) || HAS_GNU
- ^
- test.cc:3:18: note: expanded from macro 'HAS_GNU'
- #define HAS_GNU (defined(__GNUC__) && !defined(__clang__))
- ^
- test.cc:5:27: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
- test.cc:3:40: note: expanded from macro 'HAS_GNU'
- #define HAS_GNU (defined(__GNUC__) && !defined(__clang__))
- #if defined(__GNUC__) && !defined(__clang__)
- #define HAS_GNU 1
- #else
- #define HAS_GNU 0
- #endif
- #if defined(__GNUC__) && !defined(__clang__)
- #define HAS_GNU
- #endif
- #if defined(__clang__) || defined(HAS_GNU)
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wexpansion-to-defined"
- #import <pop/POP.h>
- #pragma clang diagnostic pop
Add Comment
Please, Sign In to add comment