#define DIAG_STR(s) #s #define DIAG_JOINSTR(x,y) DIAG_STR(x ## y) #ifdef _MSC_VER #define DIAG_DO_PRAGMA(x) __pragma (#x) #define DIAG_PRAGMA(compiler,x) DIAG_DO_PRAGMA(warning(x)) #else #define DIAG_DO_PRAGMA(x) _Pragma (#x) #define DIAG_PRAGMA(compiler,x) DIAG_DO_PRAGMA(compiler diagnostic x) #endif #if defined(__clang__) # define DISABLE_WARNING(gcc_unused,clang_option,msvc_unused) DIAG_PRAGMA(clang,push) DIAG_PRAGMA(clang,ignored DIAG_JOINSTR(-W,clang_option)) #elif defined(_MSC_VER) # define DISABLE_WARNING(gcc_unused,clang_unused,msvc_errorcode) DIAG_PRAGMA(msvc,push) DIAG_DO_PRAGMA(warning(disable:##msvc_errorcode)) #elif defined(__GNUC__) #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 # define DISABLE_WARNING(gcc_option,clang_unused,msvc_unused) DIAG_PRAGMA(GCC,push) DIAG_PRAGMA(GCC,ignored DIAG_JOINSTR(-W,gcc_option)) #else # define DISABLE_WARNING(gcc_option,clang_unused,msvc_unused) DIAG_PRAGMA(GCC,ignored DIAG_JOINSTR(-W,gcc_option)) #endif #endif DISABLE_WARNING(,deprecated-register,00)