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: [PATCH] Fix PR c/6343 (was: Re: GCC 3.1 Prerelease)


>>>>> "Franz" == Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:

> +  if (SUPPORTS_WEAK
> +      && DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl)
> +      && (TREE_CODE (decl) != VAR_DECL
> +	  || ! TREE_STATIC (decl))
> +      && TREE_USED (decl)
> +      && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
> +    warning_with_decl (decl, "weak declaration of `%s' after first use may result in unspecified behaviour");

I intended that TREE_SYMBOL_REFERENCED should be used rather than
TREE_USED, not in addition.  I'd probably check DECL_ASSEMBLER_NAME_SET_P
here, too; if the name hasn't been generated, it hasn't been referenced.
Perhaps we want a new macro, say

#define DECL_SYMBOL_REFERENCED(DECL) \
 (DECL_ASSEMBLER_NAME_SET_P (DECL) \
  && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)))

Thanks,
Jason


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