aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-10-17 07:52:06 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2000-10-17 07:52:06 +0100
commit74ff46299b5d4b97dc736fc77fb3a2618c119e85 (patch)
tree0d78db7f736f6806e242f06d781a29dd0b8f8ae2 /gcc/c-decl.c
parent1d3b0e2c196a53b8d0e0b8ecabf5b110f666c442 (diff)
downloadgcc-74ff46299b5d4b97dc736fc77fb3a2618c119e85.zip
gcc-74ff46299b5d4b97dc736fc77fb3a2618c119e85.tar.gz
gcc-74ff46299b5d4b97dc736fc77fb3a2618c119e85.tar.bz2
c-common.h (warn_missing_format_attribute): New variable.
* c-common.h (warn_missing_format_attribute): New variable. * c-decl.c (warn_missing_format_attribute): New variable. (c_decode_option): Decode -Wmissing-format-attribute and -Wno-missing-format-attribute. * c-common.c (check_function_format): If -Wmissing-format-attribute, give a warning where a vprintf or vscanf function is called by a function without its own printf or scanf attribute. * toplev.c (documented_lang_options): Add -Wmissing-format-attribute. * invoke.texi: Document -Wmissing-format-attribute. cp: * decl2.c (warn_missing_format_attribute): New variable. (lang_decode_option): Decode -Wmissing-format-attribute. testsuite: * gcc.dg/format-miss-1.c: New test. From-SVN: r36897
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 419d85f..f95cccc 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -416,6 +416,10 @@ int warn_cast_qual;
int warn_bad_function_cast;
+/* Warn about functions which might be candidates for format attributes. */
+
+int warn_missing_format_attribute;
+
/* Warn about traditional constructs whose meanings changed in ANSI C. */
int warn_traditional;
@@ -716,6 +720,10 @@ c_decode_option (argc, argv)
warn_missing_noreturn = 1;
else if (!strcmp (p, "-Wno-missing-noreturn"))
warn_missing_noreturn = 0;
+ else if (!strcmp (p, "-Wmissing-format-attribute"))
+ warn_missing_format_attribute = 1;
+ else if (!strcmp (p, "-Wno-missing-format-attribute"))
+ warn_missing_format_attribute = 0;
else if (!strcmp (p, "-Wpointer-arith"))
warn_pointer_arith = 1;
else if (!strcmp (p, "-Wno-pointer-arith"))