discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=86505cd88586e165d0f0e82d638ff9b746299eb5
commit 86505cd88586e165d0f0e82d638ff9b746299eb5 Author: Mike Blumenkrantz <[email protected]> Date: Fri Jan 6 12:56:22 2017 -0500 add global macros for easily toggling warning flags in some cases, eg., -Wformat-nonliteral, warnings may be generated for valid uses of C, but the warning is still useful. this allows certain warnings to be disabled as necessary --- src/bin/e.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/bin/e.h b/src/bin/e.h index b7390af..cda037c 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -376,4 +376,32 @@ extern EINTERN double e_first_frame_start_time; # define DELD(obj, num) #endif +/* for disabling compiler warnings + * http://stackoverflow.com/questions/3378560/how-to-disable-gcc-warnings-for-a-few-lines-of-code + */ +#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)) +# define ENABLE_WARNING(gcc_unused,clang_option,msvc_unused) DIAG_PRAGMA(clang,pop) +#elif defined(_MSC_VER) +# define DISABLE_WARNING(gcc_unused,clang_unused,msvc_errorcode) DIAG_PRAGMA(msvc,push) DIAG_DO_PRAGMA(warning(disable:##msvc_errorcode)) +# define ENABLE_WARNING(gcc_unused,clang_unused,msvc_errorcode) DIAG_PRAGMA(msvc,pop) +#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)) +# define ENABLE_WARNING(gcc_option,clang_unused,msvc_unused) DIAG_PRAGMA(GCC,pop) +#else +# define DISABLE_WARNING(gcc_option,clang_unused,msvc_unused) DIAG_PRAGMA(GCC,ignored DIAG_JOINSTR(-W,gcc_option)) +# define ENABLE_WARNING(gcc_option,clang_option,msvc_unused) DIAG_PRAGMA(GCC,warning DIAG_JOINSTR(-W,gcc_option)) +#endif +#endif + #endif --
