summaryrefslogtreecommitdiffstats
path: root/.gitlab/ci/gcc-Wall
blob: 6669504a3647c84ced36bd389c867765e2e243ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# gcc -Wall plus other important warnings not included in -Wall

for arg in "$@"
do
	case $arg in
	-O*) Wuninitialized=-Wuninitialized;;  # only makes sense with `-O'
	esac
done

GCC="gcc${COMPILER_VERSION:+-$COMPILER_VERSION}"

#PEDANTIC="-std=gnu99"
#PEDANTIC="-pedantic -std=gnu99"
#PEDANTIC="-pedantic -std=gnu99 -Wno-variadic-macros"
#CONVERSION="-Wconversion"
# -Wpacked \

# This does more than expected for gcc (mixed code with declarations)
# -Wdeclaration-after-statement \

EXTRA="-Wextra \
 -Wsign-compare \
 -Werror-implicit-function-declaration \
 -Wpointer-arith \
 -Wwrite-strings \
 -Wswitch \
 -Wmissing-format-attribute \
 -Wstrict-aliasing=3 \
 -Winit-self \
 -Wunsafe-loop-optimizations \
 -Wold-style-definition \
 -Wno-missing-field-initializers \
 -Wno-unused-parameter \
 -Wno-long-long \
 -Wmaybe-uninitialized \
 -Wvla \
 -Wformat-overflow \
 -Wformat-truncation"

exec $GCC $PEDANTIC $CONVERSION \
	-Wall $Wuninitialized \
	-Wno-switch \
	-Wdisabled-optimization \
	-Wwrite-strings \
	-Wpointer-arith \
	-Wbad-function-cast \
	-Wmissing-prototypes \
	-Wmissing-declarations \
	-Wstrict-prototypes \
	-Wnested-externs \
	-Wcomment \
	-Winline \
	-Wcast-align=strict \
	-Wcast-qual \
	-Wredundant-decls $EXTRA \
	"$@"