summaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-22 22:42:19 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-22 22:42:19 +0000
commite53f41d59c354bdea1de607ebf74f51f5b4301b5 (patch)
treeca99c93ee8a42bd45375966c5fac2b44cca0e3f8 /gcc/c-family
parenta02a80035c4946255a8c994258298cb6a7971be5 (diff)
downloadgcc-e53f41d59c354bdea1de607ebf74f51f5b4301b5.tar.gz
PR28901 Add two levels for -Wunused-const-variable.
There is some controversy about enabling -Wunused-const-variable for all unused static const variables because some feel there are too many errors exposed in header files. Create two levels for -Wunused-const-variable. One level to only check for unused static const variables in the main compilation file. Which is enabled by -Wunused-variable. And a second level that also checks for unused static const variables in included files. Which must be explicitly enabled. gcc/ChangeLog PR c/28901 * cgraphunit.c (check_global_declaration): Check level of warn_unused_const_variable and main_input_filename. * doc/invoke.texi (Warning Options): Add -Wunused-const-variable=. (-Wunused-variable): For C implies -Wunused-const-variable=1. (-Wunused-const-variable): Explain levels 1 and 2. gcc/c-family/ChangeLog PR c/28901 * c.opt (Wunused-const-variable): Turn into Alias for... (Wunused-const-variable=): New option. gcc/testsuite/ChangeLog PR c/28901 * gcc.dg/unused-variable-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233616 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c.opt6
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f3dd70965e2..f11503ecd15 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-20 Mark Wielaard <mjw@redhat.com>
+
+ PR c/28901
+ * c.opt (Wunused-const-variable): Turn into Alias for...
+ (Wunused-const-variable=): New option.
+
2016-02-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/69865
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 638e9c24f81..7c5f6c7b5cc 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -949,7 +949,11 @@ C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wunused)
; documented in common.opt
Wunused-const-variable
-C ObjC C++ ObjC++ Var(warn_unused_const_variable) Warning LangEnabledBy(C ObjC,Wunused-variable)
+C ObjC C++ ObjC++ Warning Alias(Wunused-const-variable=, 2, 0)
+Warn when a const variable is unused.
+
+Wunused-const-variable=
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_unused_const_variable) Warning LangEnabledBy(C ObjC,Wunused-variable, 1, 0)
Warn when a const variable is unused.
Wvariadic-macros