This is the mail archive of the 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

On Sat, 2003-05-03 at 10:02, Kean Johnston wrote:
> > 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  <>
> 	* 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))

DECL_INLINE is not the right thing to test; that says whether the
compiler thinks inlining the function is a good idea, not whether it was
declared "inline" or not.  (And that notion is language-specific, so
it's not even clear it would make sense to have a check for it in
toplev.c.  One should, in fact, wonder whether it makes sense for any of
these checks to be language-independent code at all.)

Your modified test case fails because of this issue; with -O3 (as in the
test case) all functions are marked DECL_INLINE, and therefore "f" is
not warned about.

In any case, the alleged showstopper here was that rcs_id got warned
about, not anything to do with functions.  Therefore, I've undone the
function part of your patch, and am re-testing.

Mark Mitchell
CodeSourcery, LLC

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