'-O(?:2|3)',
);
my @def_cflags_format = (
- '-Wformat',
+ '-Wformat(?:=2)?', # -Wformat=2 implies -Wformat, accept it too
'-Werror=format-security', # implies -Wformat-security
);
my @def_cflags_fortify = (
# stores string values of flag regexps above, see compile_flag_regexp().
my %flag_renames = (
'-O(?:2|3)' => '-O2',
+ '-Wformat(?:=2)?' => '-Wformat',
'-Wl,(?:-z,)?relro' => '-Wl,-z,relro',
'-Wl,(?:-z,)?now' => '-Wl,-z,now',
);
gcc -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.c
gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest
+# -Wformat=2 implies -Wformat.
+gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat=2 -Werror=format-security -D_FORTIFY_SOURCE=2 -c test.c
+
# Compiling and linking in one step must also check CFLAGS/CPPFLAGS.
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-z,relro -o test test.c -ltest
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest