diff options
author | Per Bothner <bothner@gcc.gnu.org> | 1994-04-13 13:10:21 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 1994-04-13 13:10:21 -0700 |
commit | 7062b881467ee80ba7ddfe5fa46540c425d47ad8 (patch) | |
tree | 8b88c17014141214093bdabb47d146745f653aaa /gcc | |
parent | ce49ea8a38c9f3b283897ddf77953e7bd2048cd7 (diff) | |
download | gcc-7062b881467ee80ba7ddfe5fa46540c425d47ad8.zip gcc-7062b881467ee80ba7ddfe5fa46540c425d47ad8.tar.gz gcc-7062b881467ee80ba7ddfe5fa46540c425d47ad8.tar.bz2 |
Don't warn about unused static const variables.
From-SVN: r7046
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/toplev.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index f2e90fe..463871d 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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 |