From: nhmall Date: Wed, 1 Feb 2023 15:41:04 +0000 (-0500) Subject: avoid some issues with c++ and X11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4a111083a2fc7b1ac0af5e61187f19721a686e7;p=nethack avoid some issues with c++ and X11 --- diff --git a/include/tradstdc.h b/include/tradstdc.h index 4232985b8..5bbdd6dcb 100644 --- a/include/tradstdc.h +++ b/include/tradstdc.h @@ -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 */ diff --git a/win/X11/dialogs.c b/win/X11/dialogs.c index 8ce7a7daa..03f430c6b 100644 --- a/win/X11/dialogs.c +++ b/win/X11/dialogs.c @@ -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 */ diff --git a/win/X11/winX.c b/win/X11/winX.c index 690b34b8e..b59574540 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -16,6 +16,8 @@ #define SHORT_FILENAMES #endif +#define X11_BUILD + #include #include #include diff --git a/win/X11/winmenu.c b/win/X11/winmenu.c index ba272cd8b..ba9258fdd 100644 --- a/win/X11/winmenu.c +++ b/win/X11/winmenu.c @@ -33,6 +33,8 @@ #undef PRESERVE_NO_SYSV #endif +#define X11_BUILD + #include "hack.h" #include "winX.h" diff --git a/win/X11/winmisc.c b/win/X11/winmisc.c index ba9cce968..8c193e43a 100644 --- a/win/X11/winmisc.c +++ b/win/X11/winmisc.c @@ -34,6 +34,8 @@ #undef PRESERVE_NO_SYSV #endif +#define X11_BUILD + #include "hack.h" #include "func_tab.h" #include "winX.h" diff --git a/win/X11/wintext.c b/win/X11/wintext.c index 78c039497..724222ebc 100644 --- a/win/X11/wintext.c +++ b/win/X11/wintext.c @@ -28,6 +28,8 @@ #undef PRESERVE_NO_SYSV #endif +#define X11_BUILD + #include "hack.h" #include "winX.h" #include "xwindow.h"