From ac56614a95fefab1d0fe9b61922d9d23cfec4e8e Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 12 May 2021 04:39:44 +0200 Subject: [PATCH] Restore Solaris build after introducing 'noreturn' (re: c4f980eb) The build started failing on Solaris Studio cc when 'noreturn' was introduced, because the wrappers pass the -xc99 flag which sets the compiler to C99 mode. 'noreturn' is a C11 feature. The stdnoreturn.h header was correctly included but the compiler still threw a syntax error (long path abbreviated below): ".../stk.c", line 124: warning: _Noreturn is a keyword in ISO C11 ".../stk.c", line 124: warning: old-style declaration or incorrect type for: _Noreturn ".../stk.c", line 124: syntax error before or at: static src/cmd/INIT/cc.sol11.*: - Pass -std=c11 to cc instead of -xc99. At least on i386-64, this is sufficient to fix the build. README.md, src/cmd/ksh93/README.md: - Remove -xc99 from the Solaris build flags example as that is incompatible with -std=c11 (and was already redundant with the -xc99 in the wrappers). src/cmd/ksh93/tests/basic.sh: - Don't run a newly backported 93v- regression test on Solaris because it uses the 'join' command with process subsitutions; Solaris 11.4's join(1) hangs when trying to read from /dev/fd. This is not ksh's fault. (re: 59bacfd4) --- README.md | 2 +- src/cmd/INIT/cc.sol11.i386 | 4 ++-- src/cmd/INIT/cc.sol11.i386-64 | 4 ++-- src/cmd/INIT/cc.sol11.sparc | 4 ++-- src/cmd/INIT/cc.sol11.sparc-64 | 4 ++-- src/cmd/ksh93/README | 2 +- src/cmd/ksh93/tests/basic.sh | 3 +++ 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2dca8405d..a8345bfff 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ convenient way to keep them consistent between build and test commands. **Note that this system uses `CCFLAGS` instead of the usual `CFLAGS`.** An example that makes Solaris Studio cc produce a 64-bit binary: ```sh -export CCFLAGS="-xc99 -m64 -O" LDFLAGS="-m64" +export CCFLAGS="-m64 -O" LDFLAGS="-m64" bin/package make ``` Alternatively you can append these to the command, and they will only be diff --git a/src/cmd/INIT/cc.sol11.i386 b/src/cmd/INIT/cc.sol11.i386 index 9f2a9dad6..9a7ed32e4 100755 --- a/src/cmd/INIT/cc.sol11.i386 +++ b/src/cmd/INIT/cc.sol11.i386 @@ -1,4 +1,4 @@ -: solaris.i386 cc wrapper for reasonable ansi C defaults and 32 bit : 2021-01-17 : +: solaris.i386 cc wrapper for 32 bit : 2021-05-12 : HOSTTYPE=sol11.i386 @@ -15,4 +15,4 @@ esac # Note: the _XPG6 macro is now defined in src/lib/libast/features/common -$CC_EXPLICIT -m32 -xc99 "$@" +$CC_EXPLICIT -m32 -std=c11 "$@" diff --git a/src/cmd/INIT/cc.sol11.i386-64 b/src/cmd/INIT/cc.sol11.i386-64 index 116d0881c..e980618ba 100755 --- a/src/cmd/INIT/cc.sol11.i386-64 +++ b/src/cmd/INIT/cc.sol11.i386-64 @@ -1,4 +1,4 @@ -: solaris.i386-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2021-01-17 : +: solaris.i386-64 cc wrapper for 64 bit : 2021-05-12 : HOSTTYPE=sol11.i386-64 @@ -15,4 +15,4 @@ esac # Note: the _XPG6 macro is now defined in src/lib/libast/features/common -$CC_EXPLICIT -m64 -xc99 "$@" +$CC_EXPLICIT -m64 -std=c11 "$@" diff --git a/src/cmd/INIT/cc.sol11.sparc b/src/cmd/INIT/cc.sol11.sparc index d9f238166..cdad08d57 100755 --- a/src/cmd/INIT/cc.sol11.sparc +++ b/src/cmd/INIT/cc.sol11.sparc @@ -1,4 +1,4 @@ -: solaris.sparc cc wrapper for reasonable ansi C defaults and 32 bit : 2021-01-17 : +: solaris.sparc cc wrapper for 32 bit : 2021-05-12 : HOSTTYPE=sol11.sparc @@ -15,4 +15,4 @@ esac # Note: the _XPG6 macro is now defined in src/lib/libast/features/common -$CC_EXPLICIT -m32 -xc99 "$@" +$CC_EXPLICIT -m32 -std=c11 "$@" diff --git a/src/cmd/INIT/cc.sol11.sparc-64 b/src/cmd/INIT/cc.sol11.sparc-64 index c29afed49..0c4f3129f 100755 --- a/src/cmd/INIT/cc.sol11.sparc-64 +++ b/src/cmd/INIT/cc.sol11.sparc-64 @@ -1,4 +1,4 @@ -: solaris.sparc-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2021-01-17 : +: solaris.sparc-64 cc wrapper for 64 bit : 2021-05-12 : HOSTTYPE=sol11.sparc-64 @@ -15,4 +15,4 @@ esac # Note: the _XPG6 macro is now defined in src/lib/libast/features/common -$CC_EXPLICIT -m64 -xc99 "$@" +$CC_EXPLICIT -m64 -std=c11 "$@" diff --git a/src/cmd/ksh93/README b/src/cmd/ksh93/README index 02f1a53bf..c6fa7897c 100644 --- a/src/cmd/ksh93/README +++ b/src/cmd/ksh93/README @@ -161,7 +161,7 @@ way to keep them consistent between build and test commands. Note that this system uses CCFLAGS instead of the usual CFLAGS. An example that makes Solaris Studio cc produce a 64-bit binary: - export CCFLAGS="-xc99 -m64 -O" LDFLAGS="-m64" + export CCFLAGS="-m64 -O" LDFLAGS="-m64" bin/package make Alternatively you can append these to the command, and they will only be diff --git a/src/cmd/ksh93/tests/basic.sh b/src/cmd/ksh93/tests/basic.sh index 7aa1fea59..5c8e3f869 100755 --- a/src/cmd/ksh93/tests/basic.sh +++ b/src/cmd/ksh93/tests/basic.sh @@ -826,11 +826,14 @@ expect_status=2 # ====== # Test for illegal seek error (ksh93v- regression) # https://www.mail-archive.com/ast-users@lists.research.att.com/msg00816.html +if [[ $(uname -s) != SunOS ]] # Solaris 11.4 join(1) hangs on this test -- not ksh's fault +then exp='1 2' got="$(join <(printf '%d\n' 1 2) <(printf '%d\n' 1 2))" [[ $exp == $got ]] || err_exit "pipeline fails with illegal seek error" \ "(expected $(printf %q "$exp"), got $(printf %q "$got"))" +fi # $(uname -s) != SunOS # ====== exit $((Errors<125?Errors:125))