aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorHamza Mahfooz <someguy@effective-light.com>2023-07-31 19:03:47 +0000
committerJoseph Myers <joseph@codesourcery.com>2023-07-31 19:03:47 +0000
commitffc74822468a39324722eef4c4412ea3224ca976 (patch)
tree7b257346376759ccd7b4a037bbcbe8a02af21cbd /gcc/doc
parentac0e0966ebf08c454d53042a649403e2880ccbc1 (diff)
downloadgcc-ffc74822468a39324722eef4c4412ea3224ca976.zip
gcc-ffc74822468a39324722eef4c4412ea3224ca976.tar.gz
gcc-ffc74822468a39324722eef4c4412ea3224ca976.tar.bz2
c: add -Wmissing-variable-declarations [PR65213]
Resolves: PR c/65213 - Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations] gcc/c-family/ChangeLog: PR c/65213 * c.opt (-Wmissing-variable-declarations): New option. gcc/c/ChangeLog: PR c/65213 * c-decl.cc (start_decl): Handle -Wmissing-variable-declarations. gcc/ChangeLog: PR c/65213 * doc/invoke.texi (-Wmissing-variable-declarations): Document new option. gcc/testsuite/ChangeLog: PR c/65213 * gcc.dg/Wmissing-variable-declarations.c: New test. Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c43260f..104766f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -498,8 +498,8 @@ Objective-C and Objective-C++ Dialects}.
@item C and Objective-C-only Warning Options
@gccoptlist{-Wbad-function-cast -Wmissing-declarations
--Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
--Wold-style-declaration -Wold-style-definition
+-Wmissing-parameter-type -Wmissing-prototypes -Wmissing-variable-declarations
+-Wnested-externs -Wold-style-declaration -Wold-style-definition
-Wstrict-prototypes -Wtraditional -Wtraditional-conversion
-Wdeclaration-after-statement -Wpointer-sign}
@@ -9611,6 +9611,13 @@ provide prototypes and a non-matching declaration declares an
overload rather than conflict with an earlier declaration.
Use @option{-Wmissing-declarations} to detect missing declarations in C++.
+@opindex Wmissing-variable-declarations
+@opindex Wno-missing-variable-declarations
+@item -Wmissing-variable-declarations @r{(C and Objective-C only)}
+Warn if a global variable is defined without a previous declaration.
+Use this option to detect global variables that do not have a matching
+extern declaration in a header file.
+
@opindex Wmissing-declarations
@opindex Wno-missing-declarations
@item -Wmissing-declarations