From 94945a719afc0aa08eaff9aa1e0e2fbf159bf388 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 13 Sep 2022 13:59:24 -0700 Subject: [PATCH] onefile: isaac64.c vs yn() isaac64.c includes . yn() is a non-STDC math function in and that conflicts with nethack's yn() macro or vice versa. If other source files begin using this will probably need to be handled differently. --- src/isaac64.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/isaac64.c b/src/isaac64.c index 76cb769fc..89229d1f6 100644 --- a/src/isaac64.c +++ b/src/isaac64.c @@ -7,11 +7,25 @@ * Changes for NetHack: * include config.h; * skip rest of file if USE_ISAAC64 isn't defined there; + * yn() hackery; * re-do 'inline' handling. */ #include "config.h" #ifdef USE_ISAAC64 +/* + * OSX declares yn() in a section labelled + * "POSIX/UNIX extensions to the C standard". + * + * Even when yn() is not a macro, expansion of nethack's yn() macro + * would break it. Matters for 'onefile' lint checking where contents + * of hack.h will be visible even though we only include config.h. + */ +#ifdef yn +#undef yn +#define _isaac64_hide_yn +#endif + #include #include #include "isaac64.h" @@ -171,6 +185,17 @@ uint64_t isaac64_next_uint(isaac64_ctx *_ctx,uint64_t _n){ while(((d+_n-1)&ISAAC64_MASK) defines yn() as a macro */ +#endif +#define yn(query) yn_function(query, ynchars, 'n', TRUE) +#undef _isaac64_hide_yn +#endif + #endif /* USE_ISAAC64 */ /*isaac64.c*/