Skip to content

Commit

Permalink
Update tests run script
Browse files Browse the repository at this point in the history
Move user CFLAGS to be included at the end of the cc options.
Ensure zig-cc on Mac uses -O1 to workaround a quirk.
  • Loading branch information
tidwall committed Jul 25, 2024
1 parent b53d0a2 commit 86a9a26
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 86a9a26

Please sign in to comment.