From: nhmall Date: Mon, 1 Feb 2021 18:37:04 +0000 (-0500) Subject: more warnings.h - macOS issue X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e25b16e8441e379621dd81621550b50459723899;p=nethack more warnings.h - macOS issue It turns out that macOS barked when a POP was issued without a prior PUSH, so since the DISABLE_WARNING_CONDEXPR_IS_CONSTANT expanded to an empty macro on that platform. Include a corresponding RESTORE_WARNING_CONDEXPR_IS_CONSTANT macro for use with that particular warning. --- diff --git a/include/warnings.h b/include/warnings.h index fdbe99aa5..9b7b96176 100644 --- a/include/warnings.h +++ b/include/warnings.h @@ -35,6 +35,7 @@ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wunreachable-code\"") #define DISABLE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT #define RESTORE_WARNINGS _Pragma("clang diagnostic pop") #define STDC_Pragma_AVAILABLE @@ -44,6 +45,7 @@ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wunreachable-code\"") #define DISABLE_WARNING_CONDEXPR_IS_CONSTANT +#define RESTORE_WARNING_CONDEXPR_IS_CONSTANT #define RESTORE_WARNINGS _Pragma("GCC diagnostic pop") #define STDC_Pragma_AVAILABLE @@ -54,6 +56,7 @@ #define DISABLE_WARNING_CONDEXPR_IS_CONSTANT \ _Pragma("warning( push )") \ _Pragma("warning( disable : 4127 )") +#define RESTORE_WARNINGCONDEXPR_IS_CONSTANT _Pragma("warning( pop )") #define RESTORE_WARNINGS _Pragma("warning( pop )") #define STDC_Pragma_AVAILABLE diff --git a/src/cmd.c b/src/cmd.c index 60b8574b9..75330355c 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1539,7 +1539,7 @@ wiz_smell(void) return 0; } -RESTORE_WARNINGS +RESTORE_WARNING_CONDEXPR_IS_CONSTANT #define DEFAULT_TIMEOUT_INCR 30 diff --git a/src/nhlua.c b/src/nhlua.c index 8ca4d873a..99165b1a5 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -382,7 +382,7 @@ nhl_getmap(lua_State *L) return 1; } -RESTORE_WARNINGS +RESTORE_WARNING_CONDEXPR_IS_CONSTANT /* pline("It hits!") */ static int