PR c/17178, PR c/17820
authorAndrew Pinski <pinskia@physics.uc.edu>
Mon, 4 Oct 2004 00:10:07 +0000 (00:10 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Mon, 4 Oct 2004 00:10:07 +0000 (17:10 -0700)
2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c/17178, PR c/17820
        * c-decl.c (pop_scope): Do not warn about unused static
        variables as they warned in the middle-end.

2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c/17178
        * gcc.dg/unused-4.c: Adjust to be correct.

        PR c/17820
        * gcc.dg/unused-7.c: New test.

From-SVN: r88467

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/unused-4.c
gcc/testsuite/gcc.dg/unused-7.c [new file with mode: 0644]

index b4e62b7dc1770a889999e611f5b10d1be04488ec..758866c9e24646c578f9e6a71d8af3fb1ddf485d 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c/17178, PR c/17820
+       * c-decl.c (pop_scope): Do not warn about unused static
+       variables as they warned in the middle-end.
+
 2004-10-03  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * builtins.c (expand_builtin_memcpy): Delete duplicate code
index df61736c4aa38afcc6b7a43e33a29ee3777eef87..cd003a3b9725ccffb6c1d582800468022789161a 100644 (file)
@@ -767,10 +767,8 @@ pop_scope (void)
              && !DECL_IN_SYSTEM_HEADER (p)
              && DECL_NAME (p)
              && !DECL_ARTIFICIAL (p)
-             && (scope != file_scope
-                 || (TREE_STATIC (p) && !TREE_PUBLIC (p)
-                     && !TREE_THIS_VOLATILE (p)))
-             && scope != external_scope)
+             && scope != file_scope
+             && scope != external_scope) 
            warning ("%Junused variable %qD", p, p);
 
          if (b->inner_comp)
index 02dec9c340c3dfc0ed470daf5e7f2933c40ba1b6..abe42d85371d4376be73b12cbc72bb3710483a26 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR c/17178
+       * gcc.dg/unused-4.c: Adjust to be correct.
+
+       PR c/17820
+       * gcc.dg/unused-7.c: New test.
+
 2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR c++/17797
index 4b33a7fbb698f3e3236c29df5a9a42c48b24c3c4..99e845f45a3c1bb1d2ff434edfe9b97f447e331c 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-Wunused -O3" } */
 
-static const int i = 0;                /* { dg-warning "unused variable" } */
+static const int i = 0;
 static void f() { }            /* { dg-warning "defined but not used" } */
 static inline void g() { }
diff --git a/gcc/testsuite/gcc.dg/unused-7.c b/gcc/testsuite/gcc.dg/unused-7.c
new file mode 100644 (file)
index 0000000..f991ff7
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused-parameter" } */
+
+static int a = 10; /* { dg-warning "defined but not used" } */
+