aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/c-common.c23
-rw-r--r--gcc/c-common.h2
-rw-r--r--gcc/c-lang.c4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/lex.c6
-rw-r--r--gcc/objc/objc-act.c4
7 files changed, 44 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 38b63f9..fa8e677 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2001-01-03 Joseph S. Myers <jsm28@cam.ac.uk>
+ * 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.
+
+2001-01-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
* configure.in: Check for the mktemp command.
* configure: Regenerate.
* gccbug.in: Use a separate temporary file $TEMP0 for one use of
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");
+}
diff --git a/gcc/c-common.h b/gcc/c-common.h
index c37c38a..a5e43e4 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -513,6 +513,8 @@ extern void c_common_nodes_and_builtins PARAMS ((void));
extern tree build_va_arg PARAMS ((tree, tree));
+extern void c_common_lang_init PARAMS ((void));
+
/* Nonzero if the type T promotes to itself.
ANSI C states explicitly the list of types that promote;
in particular, short promotes to int even if they have the same width. */
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index 5217391..b96895d 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -62,9 +62,7 @@ lang_init_options ()
void
lang_init ()
{
- /* If still "unspecified", make it match -fbounded-pointers. */
- if (flag_bounds_check < 0)
- flag_bounds_check = flag_bounded_pointers;
+ c_common_lang_init ();
/* If still unspecified, make it match pedantic && -std=c99. */
if (mesg_implicit_function_declaration < 0)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 492a4dc..7404a1a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2001-01-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * lex.c (lang_init): Call c_common_lang_init.
+
2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
* search.c (lookup_fnfields_here): Remove.
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 0565704..a203ac9 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -1,6 +1,6 @@
/* Separate lexical analyzer for GNU C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -262,9 +262,7 @@ lang_init_options ()
void
lang_init ()
{
- /* If still "unspecified", make it match -fbounded-pointers. */
- if (flag_bounds_check < 0)
- flag_bounds_check = flag_bounded_pointers;
+ c_common_lang_init ();
if (flag_gnu_xref) GNU_xref_begin (input_filename);
init_repo (input_filename);
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 5b6e33a..99f2d23 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -1,6 +1,6 @@
/* Implement classes and message passing for Objective C.
Copyright (C) 1992, 1993, 1994, 1995, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Steve Naroff.
This file is part of GNU CC.
@@ -704,6 +704,8 @@ lang_init ()
not to be built in. */
lineno = 0;
+ c_common_lang_init ();
+
/* If gen_declaration desired, open the output file. */
if (flag_gen_declaration)
{