aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-08-05 12:44:41 +0100
committerTomasz Kramkowski <tk@the-tk.com>2021-08-05 12:52:34 +0100
commit07ed3ac992d5086dcd47273236ad72e496d9620f (patch)
tree50317b83a0bda7e954cbb51a0894c40a9f06bcc5
parent0521e115b2230852135db5cc8bbf9022443a95c4 (diff)
downloadpack-07ed3ac992d5086dcd47273236ad72e496d9620f.tar.gz
pack-07ed3ac992d5086dcd47273236ad72e496d9620f.tar.xz
pack-07ed3ac992d5086dcd47273236ad72e496d9620f.zip
Separate gcc specific warnings
-rw-r--r--.builds/alpine.yml2
-rw-r--r--.builds/archlinux.yml2
-rw-r--r--.builds/freebsd.yml2
-rw-r--r--.builds/openbsd.yml2
-rwxr-xr-x.vars.rc.do6
-rwxr-xr-xconfigure12
6 files changed, 17 insertions, 9 deletions
diff --git a/.builds/alpine.yml b/.builds/alpine.yml
index db377d8..94e2e7a 100644
--- a/.builds/alpine.yml
+++ b/.builds/alpine.yml
@@ -11,7 +11,7 @@ tasks:
cd pack
curl -O 'https://raw.githubusercontent.com/apenwarr/redo/redo-0.42d/minimal/do'
chmod +x do
- ./configure -vw
+ ./configure -Wgcc -v
- build: |
cd pack
./do
diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml
index 10688f1..05f3864 100644
--- a/.builds/archlinux.yml
+++ b/.builds/archlinux.yml
@@ -12,7 +12,7 @@ tasks:
cd pack
curl -O 'https://raw.githubusercontent.com/apenwarr/redo/redo-0.42d/minimal/do'
chmod +x do
- ./configure -wve
+ ./configure -Wgcc -v
- build: |
cd pack
./do
diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml
index e419fb6..b163775 100644
--- a/.builds/freebsd.yml
+++ b/.builds/freebsd.yml
@@ -9,7 +9,7 @@ tasks:
cd pack
curl -O 'https://raw.githubusercontent.com/apenwarr/redo/redo-0.42d/minimal/do'
chmod +x do
- ./configure -vw -B-lm
+ ./configure -Wclang -v -B-lm
- build: |
cd pack
./do
diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml
index 0f52f63..a3032ed 100644
--- a/.builds/openbsd.yml
+++ b/.builds/openbsd.yml
@@ -8,7 +8,7 @@ tasks:
cd pack
ftp 'https://raw.githubusercontent.com/apenwarr/redo/redo-0.42d/minimal/do'
chmod +x do
- ./configure -vw -B-lm
+ ./configure -Wclang -v -B-lm
- build: |
cd pack
./do
diff --git a/.vars.rc.do b/.vars.rc.do
index 153a20c..a5521e6 100755
--- a/.vars.rc.do
+++ b/.vars.rc.do
@@ -10,8 +10,7 @@ CFLAGS=(-std=c11 -fPIC)
warnings=(
-Wall -Wcast-align -Wcast-qual -Wextra -Wpedantic -Wformat=2
-Winit-self -Wmissing-prototypes -Wpointer-arith -Wshadow
- -Wstrict-prototypes -Wsuggest-attribute=format
- -Wsuggest-attribute=noreturn
+ -Wstrict-prototypes
)
declare -a CFLAGS CPPFLAGS LDFLAGS LDLIBS
@@ -53,6 +52,9 @@ if [[ $optimise ]]; then
fi
if [[ $warn ]]; then
CFLAGS+=("${warnings[@]}")
+ if [[ $warn = 'gcc' ]]; then
+ CFLAGS+=(-Wsuggest-attribute=format -Wsuggest-attribute=noreturn)
+ fi
fi
if [[ $werror ]]; then
CFLAGS+=(-Werror)
diff --git a/configure b/configure
index a4bb8d5..b656155 100755
--- a/configure
+++ b/configure
@@ -9,13 +9,14 @@ Options:
-C cflag Append cflag to CFLAGS
-L ldflag Append ldflag to LDFLAGS
-P cppflag Append cppflag to CPPFLAGS
+ -W profile Enable compiler specific warnings (clang|gcc) (overrides -w)
-c when Enable compiler colours (always|auto|off) [default: auto]
-d Enable debugging flags
-e Enable -Werror
-h Show this help
-o Enable optimisation flags
-v Print results of configuration
- -w Enable warning flags
+ -w Enable warning flags (overrides -W)
Environment:
CC C compiler
EOF
@@ -25,20 +26,21 @@ exec 3>config.rc
conf() { echo "$1" >&3; }
colour=auto
-while getopts B:C:L:P:c:dehovw opt; do
+while getopts B:C:L:P:W:c:dehovw opt; do
qopt=${OPTARG@Q}
case $opt in
B) conf "LDLIBS+=($qopt)";;
C) conf "CFLAGS+=($qopt)";;
L) conf "LDFLAGS+=($qopt)";;
P) conf "CPPFLAGS+=($qopt)";;
+ W) warn="$OPTARG";;
c) colour="$OPTARG";;
d) conf "debug=1" >&3;;
e) conf "werror=1" >&3;;
h) usage; help; exit;;
o) conf "optimise=1" >&3;;
v) conf "verbose=1" >&3;;
- w) conf "warn=1" >&3;;
+ w) warn=1;;
?) usage >&2; exit 1;;
esac
done
@@ -49,5 +51,9 @@ case "$colour" in
off) conf "colour=0";;
*) usage >&2; exit 1;;
esac
+case "$warn" in
+ 1|clang|gcc) conf "warn=$warn";;
+ ?*) usage >&2; exit 1;;
+esac
if [[ $CC ]]; then conf "CC=${CC@Q}"; fi