From 7062b881467ee80ba7ddfe5fa46540c425d47ad8 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Wed, 13 Apr 1994 13:10:21 -0700 Subject: [PATCH] Don't warn about unused static const variables. From-SVN: r7046 --- gcc/toplev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/toplev.c b/gcc/toplev.c index f2e90feceb49..463871dff0ae 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 -- 2.43.5