]> granicus.if.org Git - nethack/commitdiff
catch use of pre-C99 non-standard functions
authornhmall <nhmall@nethack.org>
Wed, 1 Feb 2023 14:22:16 +0000 (09:22 -0500)
committernhmall <nhmall@nethack.org>
Wed, 1 Feb 2023 14:22:16 +0000 (09:22 -0500)
include/tradstdc.h

index a5f53fe8deb69c1012bc2565f72bd1ef21a28ac7..4361620cfe8073530d778b88d477f1e2fa492233 100644 (file)
@@ -459,5 +459,16 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
 #define NONNULL
 #endif
 
+/*
+ * Allow gcc to catch the use of non-C99 functions that NetHack
+ * has replaced with a C99 standard function. The old non-C99
+ * function will cause a link failure on non-Unix platforms,
+ * so it is preferrable to catch it early, during compile.
+ */
+#if defined(__GNUC__) || defined(__CLANG__)
+inline char *index(const char *s, int c) __attribute__ ((unavailable));
+inline char *rindex(const char *s, int c) __attribute__ ((unavailable));
+#endif
+
 
 #endif /* TRADSTDC_H */