Skip to content

Commit

Permalink
COMMON: Add macros to push/pop diagnostics settings
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Aug 28, 2020
1 parent b510093 commit 94b31b5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/common/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
#define WIN32
#endif

#define DIAGNOSTICS_PUSH __pragma(warning(push))
#define DIAGNOSTICS_POP __pragma(warning(pop))

#define IGNORE_UNUSED_VARIABLES __pragma(warning(disable : 4101))

#elif defined(__MINGW32__)
Expand Down Expand Up @@ -147,6 +150,9 @@
#define PACKED_STRUCT __attribute__((__packed__))
#define GCC_PRINTF(x,y) __attribute__((__format__(printf, x, y)))

#define DIAGNOSTICS_PUSH _Pragma("GCC diagnostic push")
#define DIAGNOSTICS_POP _Pragma("GCC diagnostic pop")

#if (__GNUC__ >= 3)
// Macro to ignore several "unused variable" warnings produced by GCC
#define IGNORE_UNUSED_VARIABLES _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
Expand Down Expand Up @@ -420,6 +426,14 @@
#define MAXPATHLEN 256
#endif

#ifndef DIAGNOSTICS_PUSH
#define DIAGNOSTICS_PUSH
#endif

#ifndef DIAGNOSTICS_POP
#define DIAGNOSTICS_POP
#endif

#ifndef IGNORE_UNUSED_VARIABLES
#define IGNORE_UNUSED_VARIABLES
#endif
Expand Down

0 comments on commit 94b31b5

Please sign in to comment.