aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2001-01-03 20:56:22 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2001-01-03 20:56:22 +0000
commit03dc032560d43abc8a9867472fdb22cbf0c6b9c7 (patch)
treef0e8c65e787de4d8629a814f63958c000e5b164f /gcc/c-common.c
parent955be6336a2f53d6b15909ddcccee87cfee57674 (diff)
downloadgcc-03dc032560d43abc8a9867472fdb22cbf0c6b9c7.zip
gcc-03dc032560d43abc8a9867472fdb22cbf0c6b9c7.tar.gz
gcc-03dc032560d43abc8a9867472fdb22cbf0c6b9c7.tar.bz2
c-common.c (c_common_lang_init): New function.
* c-common.c (c_common_lang_init): New function. Warn if format warning options which only have effects when used with -Wformat are used without -Wformat. * c-common.h (c_common_lang_init): Declare. * c-lang.c (lang_init): Call c_common_lang_init. * objc/objc-act.c (lang_init): Call c_common_lang_init. cp: * lex.c (lang_init): Call c_common_lang_init. From-SVN: r38672
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 27dc087..71234b7 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -6555,3 +6555,26 @@ boolean_increment (code, arg)
TREE_SIDE_EFFECTS (val) = 1;
return val;
}
+
+
+/* Do the parts of lang_init common to C and C++. */
+void
+c_common_lang_init ()
+{
+ /* If still "unspecified", make it match -fbounded-pointers. */
+ if (flag_bounds_check < 0)
+ flag_bounds_check = flag_bounded_pointers;
+
+ /* Special format checking options don't work without -Wformat; warn if
+ they are used. */
+ if (warn_format_y2k && !warn_format)
+ warning ("-Wformat-y2k ignored without -Wformat");
+ if (warn_format_extra_args && !warn_format)
+ warning ("-Wformat-extra-args ignored without -Wformat");
+ if (warn_format_nonliteral && !warn_format)
+ warning ("-Wformat-nonliteral ignored without -Wformat");
+ if (warn_format_security && !warn_format)
+ warning ("-Wformat-security ignored without -Wformat");
+ if (warn_missing_format_attribute && !warn_format)
+ warning ("-Wmissing-format-attribute ignored without -Wformat");
+}