cpp oddities. was: sparc-sun-solaris2.8 headers: fixinc, cpplib

Robert Lipe robertlipe@usa.net
Mon Dec 18 11:13:00 GMT 2000


Neil Booth wrote:
> Robert Lipe wrote:-
> 
> I would imagine the above warning does not check for being in a system
> header before being issued.

I don't know if it's a correct test, but the code is definitely trying
to test it in toplev.c

      /* 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)
          && ! DECL_EXTERNAL (decl)
          && ! TREE_PUBLIC (decl)
          && ! TREE_USED (decl)
          && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
          /* The TREE_USED bit for file-scope decls
             is kept in the identifier, to handle multiple
             external decls in different scopes.  */
          && ! TREE_USED (DECL_NAME (decl)))
        warning_with_decl (decl, "`%s' defined but not used");


It definitely did not warn about this a few weeks ago.

> I'll commit the change, which has bootstrapped for me without
> regressions, and get back to look at these.

Lovely.   Thanx for your prompt help.

RJL


More information about the Gcc mailing list