Enable -Wformat and -Wformat-security by default. --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -202,7 +202,7 @@ int warn_unknown_pragmas; /* Tri state variable. */ /* Warn about format/argument anomalies in calls to formatted I/O functions (*printf, *scanf, strftime, strfmon, etc.). */ -int warn_format; +int warn_format = 1; /* C/ObjC language option variables. */ --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -392,7 +392,7 @@ C ObjC C++ ObjC++ Var(warn_format_contains_nul) Warning Warn about format strings that contain NUL bytes Wformat-security -C ObjC C++ ObjC++ Var(warn_format_security) Warning +C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning Warn about possible security problems with format functions Wformat-y2k --- a/gcc/doc/gcc.info +++ b/gcc/doc/gcc.info @@ -3237,6 +3237,9 @@ option was used. `-Wformat-nonliteral', `-Wformat-security', and `-Wformat=2' are available, but are not included in `-Wall'. + In Gentoo this option is enabled by default for C, C++, ObjC, ObjC++. + To disable, use `-Wformat=0'. + `-Wformat-y2k' If `-Wformat' is specified, also warn about `strftime' formats that may yield only a two-digit year. @@ -3279,6 +3282,11 @@ option was used. about, but in future warnings may be added to `-Wformat-security' that are not included in `-Wformat-nonliteral'.) + In Gentoo this option is enabled by default for C, C++, ObjC, ObjC++. + To disable, use `-Wno-format-security', or disable all format warnings + with `-Wformat=0'. To make format security warnings fatal, specify + `-Werror=format-security'. + `-Wformat=2' Enable `-Wformat' plus format checks not included in `-Wformat'. Currently equivalent to `-Wformat -Wformat-nonliteral