From c0354a869f119f674422c0a143c32d62814c0c00 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 14 Dec 2021 09:58:45 +0100 Subject: [PATCH] Fix build on illumos (re: 7fb814e1, 580ff616) The standards macros consistency fix for iffe exposed breakage on illumos: the standards flags aren't set properly. Back in 580ff616, I set _XPG6 from features/common, which is the wrong place; the correct place is features/standards -- especially now that iffe uses its results. In addition, to get header declarations that aren't somehow in conflict with themselves on illumos, don't result in "implicit function declaration" warnings, and expose all the functionality, we need to define *all* the _XPG[4-7] macros *and* __EXTENSIONS__ *and* _XOPEN_SOURCE. Welp. Thankfully, that's just fine with Solaris, too. Thanks to @JohnoKing for the heads-up. --- src/lib/libast/features/common | 6 ------ src/lib/libast/features/standards | 12 ++++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/libast/features/common b/src/lib/libast/features/common index a01fcbeb4..fd6ff158a 100644 --- a/src/lib/libast/features/common +++ b/src/lib/libast/features/common @@ -36,12 +36,6 @@ cat{ # define __OPTIMIZE_SIZE__ 1 #endif - /* enable POSIX standard on Solaris */ - #ifdef __sun - # undef _XPG6 - # define _XPG6 1 - #endif - /* __STD_C indicates that the language is ANSI C or C++ */ #if !defined(__STD_C) && __STDC__ # define __STD_C 1 diff --git a/src/lib/libast/features/standards b/src/lib/libast/features/standards index 5b6dcbb0e..75702d092 100644 --- a/src/lib/libast/features/standards +++ b/src/lib/libast/features/standards @@ -19,6 +19,18 @@ if tst note{ FreeBSD or DragonFly BSD }end compile{ #endif }end { } +elif tst note{ SunOS (Solaris, illumos) }end compile{ + #if !__sun + #error dark + #endif + }end { + #define _XPG7 1 + #define _XPG6 1 + #define _XPG5 1 + #define _XPG4 1 + #define __EXTENSIONS__ 1 + #define _XOPEN_SOURCE 9900 + } elif tst note{ _ALL_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & _GNU_SOURCE & _DARWIN_C_SOURCE & __EXTENSIONS__ works }end compile{ #define _ALL_SOURCE 1 #define _POSIX_SOURCE 1