]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/53322 - -Wunused-local-typedefs is not enabled by Wall or Wunused
authorDodji Seketeli <dodji@redhat.com>
Tue, 22 May 2012 03:50:26 +0000 (03:50 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Tue, 22 May 2012 03:50:26 +0000 (05:50 +0200)
As the audit trail of this shows, -Wunused-local-typedefs is not
turned on by -Wunused after all.  Sigh.

Now that we have the EnabledBy construct for the *.opt files, it's
more precise and concise to use that to make -Wunused-local-typedefs
be triggered by -Wunused.

I have changed the gcc+.dg/warn/Wunused-local-typedefs.C test case to
make it use -Wunused instead of -Wunused-local-typedefs.  I had to
adjust it to avoid the warnings due to the other -W* options triggered
by -Wunused there.

While testing the compiler, it turned out that some local typedefs
were not being used when the experimental "Concepts" support is turned
off, in the libstdc++ test suite.  I also had to remove some obvious
useless local typedef usage in the fortran front-end.  Fixed thus.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

gcc/c-family/

PR c++/53322
* c.opt (Wunused-local-typedefs): Use EnabledBy(Wunused).

libstdc++-v3/

PR c++/53322
* include/bits/stl_algobase.h (lower_bound)
(lexicographical_compare): Do not declare unused local typedefs
here when Concepts are turned off.

gcc/fortran/

PR c++/53322
* f95-lang.c (gfc_init_builtin_functions): Remove the unused
typedef builtin_type.

gcc/testsuite/

PR c++/53322
* g++.dg/warn/Wunused-local-typedefs.C: Adjust to use -Wunused
instead of -Wunused-local-typedefs.

From-SVN: r187757

gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algobase.h

index 1a84751f3c7454edf8e4915195bbb6b6bb7adfcf..b71174d18634c4830a9c72b626c63bfbf45a585a 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-22  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/53322
+       * c.opt (Wunused-local-typedefs): Use EnabledBy(Wunused).
+
 2012-05-17  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * c.opt (--pedantic-errors,-pedantic-errors): Do not handle here.
index 53d97521b1cebaabc61fda6ebd93bf52d94f8476..0b72d79ae918305ef5fded10c146046def3836e0 100644 (file)
@@ -671,7 +671,7 @@ C ObjC Var(warn_unsuffixed_float_constants) Warning
 Warn about unsuffixed float constants
 
 Wunused-local-typedefs
-C ObjC C++ ObjC++ Var(warn_unused_local_typedefs) Warning
+C ObjC C++ ObjC++ Var(warn_unused_local_typedefs) Warning EnabledBy(Wunused)
 Warn when typedefs locally defined in a function are not used
 
 Wunused-macros
index 59cfa32297a5b372a1d9335de60613ce7fbddec7..0880b3172292d4d3f5427c4ced68327a95e25335 100644 (file)
@@ -1,3 +1,9 @@
+2012-05-22  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/53322
+       * f95-lang.c (gfc_init_builtin_functions): Remove the unused
+       typedef builtin_type.
+
 2012-05-14  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR fortran/52428
index 3f0c3033673afb47995b2fa273128750c4f12689..7250ca2d769f097c1ff1b912e46570ea5d642095 100644 (file)
@@ -641,7 +641,6 @@ gfc_init_builtin_functions (void)
 #undef DEF_POINTER_TYPE
     BT_LAST
   };
-  typedef enum builtin_type builtin_type;
 
   tree mfunc_float[6];
   tree mfunc_double[6];
index 26329cd209d05eec93ee6797f9f264671a4748fd..5aa76109b6b2eeda53a47d19eaf209ba8b585457 100644 (file)
@@ -1,3 +1,9 @@
+2012-05-22  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/53322
+       * g++.dg/warn/Wunused-local-typedefs.C: Adjust to use -Wunused
+       instead of -Wunused-local-typedefs.
+
 2012-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/51184
index 87feb528446da9cb313ca8beeda500435cb45129..4fc8640ed7b2337ed2986a3038ebee48556bc669 100644 (file)
@@ -1,5 +1,5 @@
 // Origin PR c++/33255
-// { dg-options "-Wunused-local-typedefs" }
+// { dg-options "-Wunused" } <-- should trigger -Wunused-local-typedefs
 // { dg-do compile }
 
 void
@@ -59,7 +59,7 @@ test3_tmpl(void)
 {
     typedef struct ST<int> foo;
     ST<int> v;
-    const foo &var = v;
+    const foo __attribute__((unused))&var = v;
 }
 
 void
@@ -72,7 +72,7 @@ void
 test4(void)
 {
   typedef int foo;
-  int vec[1] = {sizeof (foo)};
+  int __attribute__((unused))vec[1] = {sizeof (foo)};
 }
 
 void
@@ -87,11 +87,11 @@ test5(void)
   typedef C0 T4;
 
   int v0 = (T0) 2;
-  char v1 = static_cast<T1> (0);
-  reinterpret_cast<T2> (&v0);
+  char __attribute__((unused)) v1 = static_cast<T1> (0);
+  if (reinterpret_cast<T2> (&v0));
   unsigned* const c = 0;
-  unsigned* v2 = const_cast<T3* const> (c);
-  C0 *p0 = 0;
+  unsigned* __attribute__((unused))v2 = const_cast<T3* const> (c);
+  C0 *__attribute__((unused))p0 = 0;
   C1 *p1 = 0;
   p0 = dynamic_cast<T4*> (p1);  
 }
@@ -101,7 +101,7 @@ test6(void)
 {
   struct C0 {};
   typedef C0 foo;
-  C0 *v = new foo;
+  C0 *__attribute__((unused))v = new foo;
 }
 
 template<class T, class U>
index fd5b2464fad8681b42ae5820a0133ef645092c63..23afda31337a8bf2f98f99f227778034152346f7 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-22  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/53322
+       * include/bits/stl_algobase.h (lower_bound)
+       (lexicographical_compare): Do not declare unused local typedefs
+       here when Concepts are turned off.
+
 2012-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * testsuite/22_locale/num_put/put/char/9780-2.cc: Avoid -Wall warnings.
index a48cf9ada6db766ce7573380edfb4c24924fa8c3..fe30f6ce9f5e7c2931cfb424257f2e27ca4a7650 100644 (file)
@@ -944,8 +944,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
                const _Tp& __val)
     {
+#ifdef _GLIBCXX_CONCEPT_CHECKS
       typedef typename iterator_traits<_ForwardIterator>::value_type
        _ValueType;
+#endif
       typedef typename iterator_traits<_ForwardIterator>::difference_type
        _DistanceType;
 
@@ -1083,9 +1085,11 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     lexicographical_compare(_II1 __first1, _II1 __last1,
                            _II2 __first2, _II2 __last2)
     {
+#ifdef _GLIBCXX_CONCEPT_CHECKS
       // concept requirements
       typedef typename iterator_traits<_II1>::value_type _ValueType1;
       typedef typename iterator_traits<_II2>::value_type _ValueType2;
+#endif
       __glibcxx_function_requires(_InputIteratorConcept<_II1>)
       __glibcxx_function_requires(_InputIteratorConcept<_II2>)
       __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)