Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gcc_diag.h header, for macros used to do fine-grained exceptions …
…to GCC warnings
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* GCC diagnostics control macros courtesy of: | ||
* http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html | ||
*/ | ||
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 | ||
# define GCC_DIAG_STR(s) #s | ||
# define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) | ||
# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) | ||
# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) | ||
# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 | ||
# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \ | ||
GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) | ||
# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) | ||
# else | ||
# define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) | ||
# define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x)) | ||
# endif | ||
#else | ||
# define GCC_DIAG_OFF(x) | ||
# define GCC_DIAG_ON(x) | ||
#endif |