From 86a9a26fded39d113b85752db8e4474d1395e0b0 Mon Sep 17 00:00:00 2001 From: tidwall Date: Thu, 25 Jul 2024 06:52:30 -0700 Subject: [PATCH] Update tests run script Move user CFLAGS to be included at the end of the cc options. Ensure zig-cc on Mac uses -O1 to workaround a quirk. --- tests/run.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index f80f996..7d38b80 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -43,8 +43,10 @@ fi if [[ "$CC" == "" ]]; then CC=cc fi +UCFLAGS=$CFLAGS +CFLAGS= if [[ "$1" != "bench" ]]; then - CFLAGS="-O0 -g3 -Wall -Wextra -fstrict-aliasing $CFLAGS" + CFLAGS="-O0 -g2 -Wall -Wextra -fstrict-aliasing $CFLAGS" CCVERSHEAD="$($CC --version | head -n 1)" if [[ "$CCVERSHEAD" == "" ]]; then exit 1 @@ -109,14 +111,15 @@ elif [[ "`uname`" == *"_NT-"* ]]; then fi if [[ "$CC" == *"zig"* ]]; then - # Without -O3, 'zig cc' has quirks issues on Mac OS. - CFLAGS="$CFLAGS -O3" # Stack unwinding is not supported yet # https://github.com/ziglang/zig/issues/9046 CFLAGS="$CFLAGS -DLLCO_NOUNWIND" + # Without -O1, 'zig cc' has quirks issues on Mac OS. + if [[ "`uname`" == "Darwin" ]]; then + CFLAGS="$CFLAGS -O1" + fi fi - - +CFLAGS="$CFLAGS $UCFLAGS" CC=${CC:-cc} echo "CC: $CC"