]> granicus.if.org Git - nethack/commitdiff
more warnings.h - macOS issue
authornhmall <nhmall@nethack.org>
Mon, 1 Feb 2021 18:37:04 +0000 (13:37 -0500)
committernhmall <nhmall@nethack.org>
Mon, 1 Feb 2021 18:37:04 +0000 (13:37 -0500)
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.

include/warnings.h
src/cmd.c
src/nhlua.c

index fdbe99aa55c93b74dbca32537de55cdb508af6f4..9b7b96176b572035255a17a9d857b964626f38cb 100644 (file)
@@ -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
 
index 60b8574b9680b534183330a5edae9a787e7a2309..75330355cfb94d181fe4ff30eac0da26d64aad9a 100644 (file)
--- 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
 
index 8ca4d873af2de32a93e72779a88e6a8779fec3d0..99165b1a5d48e37520db0ee70b2db28ed4ce1fda 100644 (file)
@@ -382,7 +382,7 @@ nhl_getmap(lua_State *L)
     return 1;
 }
 
-RESTORE_WARNINGS
+RESTORE_WARNING_CONDEXPR_IS_CONSTANT
 
 /* pline("It hits!") */
 static int