Fix broken ci and enable higher level optimization (#220)

* [ci] fix broken ci

* [ci] enable higher optimization level and lto

higher optimization levels enable more warnings and deeper analysis.
likewise, lto can catch a couple errors which typically goes unnoticed
without it.
This commit is contained in:
N-R-K 2022-02-20 07:55:17 +00:00 committed by GitHub
parent 79556e9b02
commit 3cf4fc5e81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: dep - name: dep
run: | run: |
sudo apt-get update
sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \ sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \
libxft2 libxft-dev libexif12 libexif-dev \ libxft2 libxft-dev libexif12 libexif-dev \
gcc clang gcc clang
@ -25,12 +26,14 @@ jobs:
# vanilla flags # vanilla flags
CFLAGS="-std=c99 -Wall -pedantic" CFLAGS="-std=c99 -Wall -pedantic"
# extra flags # extra flags
CFLAGS+=" -O3 -flto"
CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith -Wstrict-prototypes" CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith -Wstrict-prototypes"
CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code" CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code"
CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement" CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement"
# silence # silence
CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers" CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers"
export CFLAGS export CFLAGS
export LDFLAGS="$CFLAGS"
export OPT_DEP_DEFAULT=1 export OPT_DEP_DEFAULT=1
echo "### GCC BUILD ###" && make clean && CC=gcc make -s echo "### GCC BUILD ###" && make clean && CC=gcc make -s
echo "### CLANG BUILD ###" && make clean && CC=clang make -s echo "### CLANG BUILD ###" && make clean && CC=clang make -s
@ -42,6 +45,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: dep - name: dep
run: | run: |
sudo apt-get update
sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \ sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \
gcc clang gcc clang
sudo apt-get remove libxft2 libxft-dev libexif12 libexif-dev sudo apt-get remove libxft2 libxft-dev libexif12 libexif-dev
@ -53,12 +57,14 @@ jobs:
# vanilla flags # vanilla flags
CFLAGS="-std=c99 -Wall -pedantic" CFLAGS="-std=c99 -Wall -pedantic"
# extra flags # extra flags
CFLAGS+=" -O3 -flto"
CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith -Wstrict-prototypes" CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith -Wstrict-prototypes"
CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code" CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code"
CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement" CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement"
# silence # silence
CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers" CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers"
export CFLAGS export CFLAGS
export LDFLAGS="$CFLAGS"
export OPT_DEP_DEFAULT=0 export OPT_DEP_DEFAULT=0
echo "### GCC BUILD ###" && make clean && CC=gcc make -s echo "### GCC BUILD ###" && make clean && CC=gcc make -s
echo "### CLANG BUILD ###" && make clean && CC=clang make -s echo "### CLANG BUILD ###" && make clean && CC=clang make -s