]> granicus.if.org Git - nethack/commitdiff
avoid some issues with c++ and X11
authornhmall <nhmall@nethack.org>
Wed, 1 Feb 2023 15:41:04 +0000 (10:41 -0500)
committernhmall <nhmall@nethack.org>
Wed, 1 Feb 2023 15:41:04 +0000 (10:41 -0500)
include/tradstdc.h
win/X11/dialogs.c
win/X11/winX.c
win/X11/winmenu.c
win/X11/winmisc.c
win/X11/wintext.c

index 4232985b84797054478f0b6e1336905bb758bded..5bbdd6dcbf372e28c42a6ef8023b9359c7bff472 100644 (file)
@@ -465,6 +465,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
  * function will cause a link failure on non-Unix platforms,
  * so it is preferrable to catch it early, during compile.
  */
+#if !defined(X11_BUILD) && !defined(__cplusplus)
 #if defined(__GNUC__) && !defined(__CLANG__)
 #if __GNUC__ >= 12
 extern char *index(const char *s, int c) __attribute__ ((unavailable));
@@ -477,6 +478,7 @@ extern char *index(const char *s, int c) __attribute__ ((unavailable));
 extern char *rindex(const char *s, int c) __attribute__ ((unavailable));
 #endif
 #endif
+#endif
 
 
 #endif /* TRADSTDC_H */
index 8ce7a7daa111ec8a0d34a54f4933eaec05d49f2a..03f430c6b01b767ce693147bbe11643f6d47a339 100644 (file)
@@ -77,7 +77,9 @@
 #undef PRESERVE_NO_SYSV
 #endif
 
+#define X11_BUILD
 #include "config.h" /* #define for const for non __STDC__ compilers */
+#undef X11_BUILD
 #include "lint.h"   /* for nethack's nhStr() macro */
 #include "winX.h"   /* to make sure protoypes match corresponding functions */
 
index 690b34b8e4f18cfb1fb450efd8bd148391987f66..b595745406071375b6146c3614e6371c145ba47d 100644 (file)
@@ -16,6 +16,8 @@
 #define SHORT_FILENAMES
 #endif
 
+#define X11_BUILD
+
 #include <X11/Intrinsic.h>
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
index ba272cd8baf797ef04a847143818a4d89e8197e1..ba9258fddfc806c89b53b2c2f13db46ebb01ecd3 100644 (file)
@@ -33,6 +33,8 @@
 #undef PRESERVE_NO_SYSV
 #endif
 
+#define X11_BUILD
+
 #include "hack.h"
 #include "winX.h"
 
index ba9cce968ba0924c4bf82d396a36a06acc08ead6..8c193e43a296e9f2f9729fc9cb514245dc2343ae 100644 (file)
@@ -34,6 +34,8 @@
 #undef PRESERVE_NO_SYSV
 #endif
 
+#define X11_BUILD
+
 #include "hack.h"
 #include "func_tab.h"
 #include "winX.h"
index 78c039497f17e8c7c259c56f74a51d97c58dad8b..724222ebcbdac71adc55c319bd40bf36a12009ab 100644 (file)
@@ -28,6 +28,8 @@
 #undef PRESERVE_NO_SYSV
 #endif
 
+#define X11_BUILD
+
 #include "hack.h"
 #include "winX.h"
 #include "xwindow.h"