]> granicus.if.org Git - nethack/commitdiff
work around ubuntu 20.10 build issue
authornhmall <nhmall@nethack.org>
Tue, 4 Jan 2022 13:24:08 +0000 (08:24 -0500)
committernhmall <nhmall@nethack.org>
Tue, 4 Jan 2022 13:24:08 +0000 (08:24 -0500)
NetHack was trying to suppress warn_unused_result
in include/tradstdc.h, by defining warn_unused_result
to an empty string. That began causing a build error
in a system-supplied header file cdefs.h
when using 20.10 ubuntu impish.

Try skipping that in tradstdc.h for any linux, unless
the NetHack build defines GCC_URWARN to force it into
play.

include/tradstdc.h

index 09decb4b15ee073a755583d5d120344c092ed962..8c33d55e0ae9388449bee3e08b1a2926e22ed435 100644 (file)
@@ -405,12 +405,14 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
 #if __GNUC__ >= 3
 #define UNUSED __attribute__((unused))
 #define NORETURN __attribute__((noreturn))
+#if !defined(__linux__) || defined(GCC_URWARN)
 /* disable gcc's __attribute__((__warn_unused_result__)) since explicitly
    discarding the result by casting to (void) is not accepted as a 'use' */
 #define __warn_unused_result__ /*empty*/
 #define warn_unused_result /*empty*/
 #endif
 #endif
+#endif
 
 #ifndef PRINTF_F
 #define PRINTF_F(f, v)