This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 7/12 ] New configure option --enable-espf=(all|ssp|pie|no)
- From: Magnus Granberg <zorry at gentoo dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 07 Sep 2012 16:29:32 +0200
- Subject: [PATCH 7/12 ] New configure option --enable-espf=(all|ssp|pie|no)
Patch: Wformat.patch
Enable -Wformat and -Wformat_security
Gentoo Hardened Project
Magnus Granberg
--- a/gcc/c-family/c-common.c 2012-02-13 21:12:54.000000000 +0100
+++ b/gcc/c-family/c-common.c 2012-07-28 00:04:05.351725091 +0200
@@ -202,7 +202,11 @@ int warn_unknown_pragmas; /* Tri state v
/* Warn about format/argument anomalies in calls to formatted I/O functions
(*printf, *scanf, strftime, strfmon, etc.). */
+#ifdef ENABLE_ESPF
+int warn_format = 1;
+#else
int warn_format;
+#endif
/* C/ObjC language option variables. */
--- a/gcc/c-family/c-format.c 2011-06-07 23:52:46.000000000 +0200
+++ b/gcc/c-family/c-format.c 2012-07-28 00:43:00.612794680 +0200
@@ -52,6 +52,11 @@ set_Wformat (int setting)
/* Make sure not to disable -Wnonnull if -Wformat=0 is specified. */
if (setting)
warn_nonnull = setting;
+
+#ifdef ENABLE_ESPF
+ if (setting == 1)
+ warn_format_security = 1;
+#endif
}