Don't warn about unused static const variables.
authorPer Bothner <bothner@gcc.gnu.org>
Wed, 13 Apr 1994 20:10:21 +0000 (13:10 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Wed, 13 Apr 1994 20:10:21 +0000 (13:10 -0700)
From-SVN: r7046

gcc/toplev.c

index f2e90feceb49d6d0abebe533ea697283358b311a..463871dff0ae955b7f2dde10966d3b1822f73a2c 100644 (file)
@@ -2325,16 +2325,15 @@ compile_file (name)
 
          }
        /* Warn about static fns or vars defined but not used,
-          but not about inline functions
-          since unused inline statics is normal practice.  */
+          but not about inline functions or static consts
+          since defining those in header files is normal practice.  */
        if (warn_unused
-           && (TREE_CODE (decl) == FUNCTION_DECL
-               || TREE_CODE (decl) == VAR_DECL)
+           && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
+               || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
            && ! DECL_IN_SYSTEM_HEADER (decl)
            && ! DECL_EXTERNAL (decl)
            && ! TREE_PUBLIC (decl)
            && ! TREE_USED (decl)
-           && ! DECL_INLINE (decl)
            && ! DECL_REGISTER (decl)
            /* The TREE_USED bit for file-scope decls
               is kept in the identifier, to handle multiple