This is the mail archive of the gcc-patches@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 regression in 4.0


Dale Johannesen <dalej@apple.com> writes:

> +       /* Permit void foo (...) to match an earlier int foo (...) if
> + 	 implicit int was used.  */

This comment ...

> +       else if (TREE_CODE (newdecl) == FUNCTION_DECL
> + 	       && TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == void_type_node
> + 	       && TYPE_MAIN_VARIANT (TREE_TYPE (oldtype)) == integer_type_node
> + 	       && C_DECL_IMPLICIT (olddecl) && !DECL_INITIAL (olddecl))

... is inconsistent with use of C_DECL_IMPLICIT here ...

> + 	{
> + 	  pedwarn ("%Jconflicting types for %qD", newdecl, newdecl);
> + 	  /* Make sure we keep void as the return type.  */
> + 	  TREE_TYPE (olddecl) = *oldtypep = oldtype = newtype;
> + 	  C_FUNCTION_IMPLICIT_INT (olddecl) = 0;

... which is inconsistent with C_FUNCTION_IMPLICIT_INT here.

C_DECL_IMPLICIT == implicit function declaration (i.e. function called
with no declaration in scope); C_FUNCTION_IMPLICIT_INT == function
explicitly declared using implicit int.  Given the original bug, I
think the conditional is correct, and the comment and statement should
be changed to match.  Please do that, retest, and resubmit.

zw


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