This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Warnings about rcs_id strings: let's settle this


> Joe Buck would very much like to see us do something here for the 3.3
> release.
How about the attached patch then. I would like to do a better job
as discussed here for 3.4 if that's OK? But will this do for 3.3?
One caveat. I cant build a 3.3 tree easily at all, so this patch is
COMPLETELY untested. I would greatly appreciate it if someone would
do that for me.

2003-05-02  Kean Johnston  <jkj@sco.com>

	* toplev.c (check_global_declarations): Restore 3.2 behaviour
with
	regards to unused statics.

Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.690.2.18
diff -u -r1.690.2.18 toplev.c
--- toplev.c	2 May 2003 21:01:19 -0000	1.690.2.18
+++ toplev.c	3 May 2003 16:59:52 -0000
@@ -2037,9 +2037,14 @@
 	  assemble_external (decl);
 	}
 
-      /* Warn about static fns or vars defined but not used.  */
-      if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
-	   || (warn_unused_variable && TREE_CODE (decl) == VAR_DECL))
+      /* Warn about static fns or vars defined but not used,
+	 but not about inline functions or static consts
+	 since defining those in header files is normal practice.  */
+      if (((warn_unused_function
+	    && TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE
(decl))
+	   || (warn_unused_variable
+	       && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY
(decl)))
+	  && ! DECL_IN_SYSTEM_HEADER (decl)
 	  && ! TREE_USED (decl)
 	  /* The TREE_USED bit for file-scope decls is kept in the
identifier,
 	     to handle multiple external decls in different scopes.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]