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]

[C patch] void_type_node


Hi,
We rather embarrasingly fail on things like
	typedef void VOID;
	VOID f1 ();
	volatile void f2 ();
	....
		f1 ();
		f2 ();
Here's a patch which adds a new macro VOID_TYPE_P, which is
true for all cv void types. I've used that macro when we're testing
for a void type, not when we're checking for the end of a parameter
list. I've not gone through the C++ front end (yet).

Using void_type_node to mark the end of non-varadic parameter lists
is rather hokey - though I can guess why that happened. Would it be too
much of a structural change to have
	ellipsis_parm_node for ...
	unspecified_parm_node for `foo ()' -- as opposed to `foo (void)'
	NULL_TREE for the other cases
? -- For those who may not have noticed, g++ tries to treat
`extern "C" int foo ()' as `extern "C" int foo (...)', and tries to DTRT,
but it fails in ways that are breaking conformant programs. It looks to
me awkward to fix with the existing scheme.

ok? booted & tested on i686-pc-linux-gnu

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-05-30  Nathan Sidwell  <nathan@codesourcery.com>

	* tree.h (VOID_TYPE_P): New macro.
	(COMPLETE_OR_VOID_TYPE_P): Use VOID_TYPE_P.
	* c-decl.c (grokdeclarator): Use VOID_TYPE_P.
	(get_parm_info): Likewise.
	(store_parm_decls): Likewise.
	(combine_parm_decls): Likewise.
	(finish_function): Likewise.
	* c-parse.y (primary): Likewise.
	* c-typeck.c (build_function_call): Likewise.
	(build_binary_op): Likewise.
	(build_conditional_expr): Likewise.
	(internal_build_compound_expr): Likewise.
	(convert_for_assignment): Likewise.
	* stmt.c (expend_expr_stmt): Likewise.
	(warn_if_unused_value): Likewise.
	(expand_return): Likewise.

Index: tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.h,v
retrieving revision 1.173
diff -c -3 -p -r1.173 tree.h
*** tree.h	2000/05/27 15:21:15	1.173
--- tree.h	2000/05/30 07:53:32
*************** extern void tree_class_check_failed PARA
*** 453,461 ****
  /* Nonzero if this type is a complete type.  */
  #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
  
  /* Nonzero if this type is complete or is cv void.  */
  #define COMPLETE_OR_VOID_TYPE_P(NODE) \
!     (COMPLETE_TYPE_P (NODE) || TREE_CODE (NODE) == VOID_TYPE)
  
  /* Nonzero if this type is complete or is an array with unspecified bound.  */
  #define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
--- 453,464 ----
  /* Nonzero if this type is a complete type.  */
  #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
  
+ /* Nonzero if this type is the (possibly qualified) void type.  */
+ #define VOID_TYPE_P(NODE) (TYPE_MAIN_VARIANT (NODE) == void_type_node)
+ 
  /* Nonzero if this type is complete or is cv void.  */
  #define COMPLETE_OR_VOID_TYPE_P(NODE) \
!     (COMPLETE_TYPE_P (NODE) || VOID_TYPE_P (NODE))
  
  /* Nonzero if this type is complete or is an array with unspecified bound.  */
  #define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.113
diff -c -3 -p -r1.113 c-decl.c
*** c-decl.c	2000/05/24 09:08:42	1.113
--- c-decl.c	2000/05/30 07:53:15
*************** grokdeclarator (declarator, declspecs, d
*** 4288,4294 ****
  
  	  /* Check for some types that there cannot be arrays of.  */
  
! 	  if (TYPE_MAIN_VARIANT (type) == void_type_node)
  	    {
  	      error ("declaration of `%s' as array of voids", name);
  	      type = error_mark_node;
--- 4288,4294 ----
  
  	  /* Check for some types that there cannot be arrays of.  */
  
! 	  if (VOID_TYPE_P (type))
  	    {
  	      error ("declaration of `%s' as array of voids", name);
  	      type = error_mark_node;
*************** grokdeclarator (declarator, declspecs, d
*** 4596,4602 ****
       We don't complain about parms either, but that is because
       a better error message can be made later.  */
  
!   if (TYPE_MAIN_VARIANT (type) == void_type_node && decl_context != PARM
        && ! ((decl_context != FIELD && TREE_CODE (type) != FUNCTION_TYPE)
  	    && ((specbits & (1 << (int) RID_EXTERN))
  		|| (current_binding_level == global_binding_level
--- 4596,4602 ----
       We don't complain about parms either, but that is because
       a better error message can be made later.  */
  
!   if (VOID_TYPE_P (type) && decl_context != PARM
        && ! ((decl_context != FIELD && TREE_CODE (type) != FUNCTION_TYPE)
  	    && ((specbits & (1 << (int) RID_EXTERN))
  		|| (current_binding_level == global_binding_level
*************** grokdeclarator (declarator, declspecs, d
*** 4721,4727 ****
  	  pedwarn ("ANSI C forbids qualified function types");
  
  	if (pedantic
! 	    && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl))) == void_type_node
  	    && TYPE_QUALS (TREE_TYPE (TREE_TYPE (decl)))
  	    && ! DECL_IN_SYSTEM_HEADER (decl))
  	  pedwarn ("ANSI C forbids qualified void function return type");
--- 4721,4727 ----
  	  pedwarn ("ANSI C forbids qualified function types");
  
  	if (pedantic
! 	    && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl)))
  	    && TYPE_QUALS (TREE_TYPE (TREE_TYPE (decl)))
  	    && ! DECL_IN_SYSTEM_HEADER (decl))
  	  pedwarn ("ANSI C forbids qualified void function return type");
*************** grokdeclarator (declarator, declspecs, d
*** 4729,4735 ****
  	/* GNU C interprets a `volatile void' return type to indicate
  	   that the function does not return.  */
  	if ((type_quals & TYPE_QUAL_VOLATILE)
! 	    && TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
  	  warning ("`noreturn' function returns non-void value");
  
  	if (extern_ref)
--- 4729,4735 ----
  	/* GNU C interprets a `volatile void' return type to indicate
  	   that the function does not return.  */
  	if ((type_quals & TYPE_QUAL_VOLATILE)
! 	    && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
  	  warning ("`noreturn' function returns non-void value");
  
  	if (extern_ref)
*************** get_parm_info (void_at_end)
*** 4944,4950 ****
    /* Just `void' (and no ellipsis) is special.  There are really no parms.  */
    if (void_at_end && parms != 0
        && TREE_CHAIN (parms) == 0
!       && TYPE_MAIN_VARIANT (TREE_TYPE (parms)) == void_type_node
        && DECL_NAME (parms) == 0)
      {
        parms = NULL_TREE;
--- 4944,4950 ----
    /* Just `void' (and no ellipsis) is special.  There are really no parms.  */
    if (void_at_end && parms != 0
        && TREE_CHAIN (parms) == 0
!       && VOID_TYPE_P (TREE_TYPE (parms))
        && DECL_NAME (parms) == 0)
      {
        parms = NULL_TREE;
*************** get_parm_info (void_at_end)
*** 5005,5011 ****
  	  DECL_ARG_TYPE (decl) = integer_type_node;
  
  	types = tree_cons (NULL_TREE, TREE_TYPE (decl), types);
! 	if (TYPE_MAIN_VARIANT (TREE_VALUE (types)) == void_type_node && ! erred
  	    && DECL_NAME (decl) == 0)
  	  {
  	    error ("`void' in parameter list must be the entire list");
--- 5005,5011 ----
  	  DECL_ARG_TYPE (decl) = integer_type_node;
  
  	types = tree_cons (NULL_TREE, TREE_TYPE (decl), types);
! 	if (VOID_TYPE_P (TREE_VALUE (types)) && ! erred
  	    && DECL_NAME (decl) == 0)
  	  {
  	    error ("`void' in parameter list must be the entire list");
*************** store_parm_decls ()
*** 5989,5996 ****
  	      if (DECL_NAME (parm) == 0)
  		error_with_decl (parm, "parameter name omitted");
  	      else if (TREE_CODE (TREE_TYPE (parm)) != ERROR_MARK
! 		       && (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
! 			   == void_type_node))
  		{
  		  error_with_decl (parm, "parameter `%s' declared void");
  		  /* Change the type to error_mark_node so this parameter
--- 5989,5995 ----
  	      if (DECL_NAME (parm) == 0)
  		error_with_decl (parm, "parameter name omitted");
  	      else if (TREE_CODE (TREE_TYPE (parm)) != ERROR_MARK
! 		       && VOID_TYPE_P (TREE_TYPE (parm)))
  		{
  		  error_with_decl (parm, "parameter `%s' declared void");
  		  /* Change the type to error_mark_node so this parameter
*************** store_parm_decls ()
*** 6093,6099 ****
  	    }
  
  	  /* If the declaration says "void", complain and ignore it.  */
! 	  if (found && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == void_type_node)
  	    {
  	      error_with_decl (found, "parameter `%s' declared void");
  	      TREE_TYPE (found) = integer_type_node;
--- 6092,6098 ----
  	    }
  
  	  /* If the declaration says "void", complain and ignore it.  */
! 	  if (found && VOID_TYPE_P (TREE_TYPE (found)))
  	    {
  	      error_with_decl (found, "parameter `%s' declared void");
  	      TREE_TYPE (found) = integer_type_node;
*************** combine_parm_decls (specparms, parmlist,
*** 6391,6397 ****
  	}
  
        /* If the declaration says "void", complain and ignore it.  */
!       if (found && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == void_type_node)
  	{
  	  error_with_decl (found, "parameter `%s' declared void");
  	  TREE_TYPE (found) = integer_type_node;
--- 6390,6396 ----
  	}
  
        /* If the declaration says "void", complain and ignore it.  */
!       if (found && VOID_TYPE_P (TREE_TYPE (found)))
  	{
  	  error_with_decl (found, "parameter `%s' declared void");
  	  TREE_TYPE (found) = integer_type_node;
*************** finish_function (nested)
*** 6563,6569 ****
    if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null)
      warning ("`noreturn' function does return");
    else if (warn_return_type && can_reach_end
! 	   && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) != void_type_node)
      /* If this function returns non-void and control can drop through,
         complain.  */
      warning ("control reaches end of non-void function");
--- 6562,6568 ----
    if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null)
      warning ("`noreturn' function does return");
    else if (warn_return_type && can_reach_end
! 	   && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))))
      /* If this function returns non-void and control can drop through,
         complain.  */
      warning ("control reaches end of non-void function");
Index: c-parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-parse.y,v
retrieving revision 1.38
diff -c -3 -p -r1.38 c-parse.y
*** c-parse.y	2000/05/09 19:55:47	1.38
--- c-parse.y	2000/05/30 07:53:19
*************** primary:
*** 639,646 ****
  				     IDENTIFIER_POINTER (DECL_NAME ($$)));
  			  else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ($$)))
  				    != TYPE_MODE (integer_type_node))
! 				   && (TREE_TYPE (TREE_TYPE ($$))
! 				       != void_type_node))
  			    pedwarn ("type mismatch in implicit declaration for built-in function `%s'",
  				     IDENTIFIER_POINTER (DECL_NAME ($$)));
  			  /* If it really returns void, change that to int.  */
--- 639,645 ----
  				     IDENTIFIER_POINTER (DECL_NAME ($$)));
  			  else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ($$)))
  				    != TYPE_MODE (integer_type_node))
! 				   && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE ($$))))
  			    pedwarn ("type mismatch in implicit declaration for built-in function `%s'",
  				     IDENTIFIER_POINTER (DECL_NAME ($$)));
  			  /* If it really returns void, change that to int.  */
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-typeck.c,v
retrieving revision 1.66
diff -c -3 -p -r1.66 c-typeck.c
*** c-typeck.c	2000/05/17 08:15:25	1.66
--- c-typeck.c	2000/05/30 07:53:22
*************** build_function_call (function, params)
*** 1467,1473 ****
  		  function, coerced_params, NULL_TREE);
  
    TREE_SIDE_EFFECTS (result) = 1;
!   if (TREE_TYPE (result) == void_type_node)
      return result;
    return require_complete_type (result);
  }
--- 1467,1473 ----
  		  function, coerced_params, NULL_TREE);
  
    TREE_SIDE_EFFECTS (result) = 1;
!   if (VOID_TYPE_P (TREE_TYPE (result)))
      return result;
    return require_complete_type (result);
  }
*************** build_binary_op (code, orig_op0, orig_op
*** 2099,2105 ****
  	     and both must be object or both incomplete.  */
  	  if (comp_target_types (type0, type1))
  	    result_type = common_type (type0, type1);
! 	  else if (TYPE_MAIN_VARIANT (tt0) == void_type_node)
  	    {
  	      /* op0 != orig_op0 detects the case of something
  		 whose value is 0 but which isn't a valid null ptr const.  */
--- 2099,2105 ----
  	     and both must be object or both incomplete.  */
  	  if (comp_target_types (type0, type1))
  	    result_type = common_type (type0, type1);
! 	  else if (VOID_TYPE_P (tt0))
  	    {
  	      /* op0 != orig_op0 detects the case of something
  		 whose value is 0 but which isn't a valid null ptr const.  */
*************** build_binary_op (code, orig_op0, orig_op
*** 2107,2113 ****
  		  && TREE_CODE (tt1) == FUNCTION_TYPE)
  		pedwarn ("ANSI C forbids comparison of `void *' with function pointer");
  	    }
! 	  else if (TYPE_MAIN_VARIANT (tt1) == void_type_node)
  	    {
  	      if (pedantic && (!integer_zerop (op1) || op1 != orig_op1)
  		  && TREE_CODE (tt0) == FUNCTION_TYPE)
--- 2107,2113 ----
  		  && TREE_CODE (tt1) == FUNCTION_TYPE)
  		pedwarn ("ANSI C forbids comparison of `void *' with function pointer");
  	    }
! 	  else if (VOID_TYPE_P (tt1))
  	    {
  	      if (pedantic && (!integer_zerop (op1) || op1 != orig_op1)
  		  && TREE_CODE (tt0) == FUNCTION_TYPE)
*************** build_conditional_expr (ifexp, op1, op2)
*** 3408,3420 ****
        else if (integer_zerop (op2) && TREE_TYPE (type2) == void_type_node
  	       && TREE_CODE (orig_op2) != NOP_EXPR)
  	result_type = qualify_type (type1, type2);
!       else if (TYPE_MAIN_VARIANT (TREE_TYPE (type1)) == void_type_node)
  	{
  	  if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
  	    pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer");
  	  result_type = qualify_type (type1, type2);
  	}
!       else if (TYPE_MAIN_VARIANT (TREE_TYPE (type2)) == void_type_node)
  	{
  	  if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
  	    pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer");
--- 3408,3420 ----
        else if (integer_zerop (op2) && TREE_TYPE (type2) == void_type_node
  	       && TREE_CODE (orig_op2) != NOP_EXPR)
  	result_type = qualify_type (type1, type2);
!       else if (VOID_TYPE_P (TREE_TYPE (type1)))
  	{
  	  if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
  	    pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer");
  	  result_type = qualify_type (type1, type2);
  	}
!       else if (VOID_TYPE_P (TREE_TYPE (type2)))
  	{
  	  if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
  	    pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer");
*************** internal_build_compound_expr (list, firs
*** 3533,3539 ****
  	 any side-effects, unless it was explicitly cast to (void).  */
        if ((extra_warnings || warn_unused_value)
             && ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR
!                 && TREE_TYPE (TREE_VALUE (list)) == void_type_node))
          warning ("left-hand operand of comma expression has no effect");
  
        /* When pedantic, a compound expression can be neither an lvalue
--- 3533,3539 ----
  	 any side-effects, unless it was explicitly cast to (void).  */
        if ((extra_warnings || warn_unused_value)
             && ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR
!                 && VOID_TYPE_P (TREE_TYPE (TREE_VALUE (list)))))
          warning ("left-hand operand of comma expression has no effect");
  
        /* When pedantic, a compound expression can be neither an lvalue
*************** convert_for_assignment (type, rhs, errty
*** 4010,4017 ****
  		 and vice versa; otherwise, targets must be the same.
  		 Meanwhile, the lhs target must have all the qualifiers of
  		 the rhs.  */
! 	      if (TYPE_MAIN_VARIANT (ttl) == void_type_node
! 		  || TYPE_MAIN_VARIANT (ttr) == void_type_node
  		  || comp_target_types (memb_type, rhstype))
  		{
  		  /* If this type won't generate any warnings, use it.  */
--- 4010,4016 ----
  		 and vice versa; otherwise, targets must be the same.
  		 Meanwhile, the lhs target must have all the qualifiers of
  		 the rhs.  */
! 	      if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
  		  || comp_target_types (memb_type, rhstype))
  		{
  		  /* If this type won't generate any warnings, use it.  */
*************** convert_for_assignment (type, rhs, errty
*** 4086,4102 ****
        /* Any non-function converts to a [const][volatile] void *
  	 and vice versa; otherwise, targets must be the same.
  	 Meanwhile, the lhs target must have all the qualifiers of the rhs.  */
!       if (TYPE_MAIN_VARIANT (ttl) == void_type_node
! 	  || TYPE_MAIN_VARIANT (ttr) == void_type_node
  	  || comp_target_types (type, rhstype)
  	  || (unsigned_type (TYPE_MAIN_VARIANT (ttl))
  	      == unsigned_type (TYPE_MAIN_VARIANT (ttr))))
  	{
  	  if (pedantic
! 	      && ((TYPE_MAIN_VARIANT (ttl) == void_type_node
! 		   && TREE_CODE (ttr) == FUNCTION_TYPE)
  		  ||
! 		  (TYPE_MAIN_VARIANT (ttr) == void_type_node
  		   /* Check TREE_CODE to catch cases like (void *) (char *) 0
  		      which are not ANSI null ptr constants.  */
  		   && (!integer_zerop (rhs) || TREE_CODE (rhs) == NOP_EXPR)
--- 4085,4099 ----
        /* Any non-function converts to a [const][volatile] void *
  	 and vice versa; otherwise, targets must be the same.
  	 Meanwhile, the lhs target must have all the qualifiers of the rhs.  */
!       if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
  	  || comp_target_types (type, rhstype)
  	  || (unsigned_type (TYPE_MAIN_VARIANT (ttl))
  	      == unsigned_type (TYPE_MAIN_VARIANT (ttr))))
  	{
  	  if (pedantic
! 	      && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE)
  		  ||
! 		  (VOID_TYPE_P (ttr)
  		   /* Check TREE_CODE to catch cases like (void *) (char *) 0
  		      which are not ANSI null ptr constants.  */
  		   && (!integer_zerop (rhs) || TREE_CODE (rhs) == NOP_EXPR)
*************** convert_for_assignment (type, rhs, errty
*** 4113,4120 ****
  				     errtype, funname, parmnum);
  	      /* If this is not a case of ignoring a mismatch in signedness,
  		 no warning.  */
! 	      else if (TYPE_MAIN_VARIANT (ttl) == void_type_node
! 		       || TYPE_MAIN_VARIANT (ttr) == void_type_node
  		       || comp_target_types (type, rhstype))
  		;
  	      /* If there is a mismatch, do warn.  */
--- 4110,4116 ----
  				     errtype, funname, parmnum);
  	      /* If this is not a case of ignoring a mismatch in signedness,
  		 no warning.  */
! 	      else if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
  		       || comp_target_types (type, rhstype))
  		;
  	      /* If there is a mismatch, do warn.  */
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stmt.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 stmt.c
*** stmt.c	2000/05/27 15:21:16	1.147
--- stmt.c	2000/05/30 07:53:30
*************** expand_expr_stmt (exp)
*** 1860,1866 ****
        if (! TREE_SIDE_EFFECTS (exp)
  	  && (extra_warnings || warn_unused_value)
  	  && !(TREE_CODE (exp) == CONVERT_EXPR
! 	       && TREE_TYPE (exp) == void_type_node))
  	warning_with_file_and_line (emit_filename, emit_lineno,
  				    "statement with no effect");
        else if (warn_unused_value)
--- 1860,1866 ----
        if (! TREE_SIDE_EFFECTS (exp)
  	  && (extra_warnings || warn_unused_value)
  	  && !(TREE_CODE (exp) == CONVERT_EXPR
! 	       && VOID_TYPE_P (TREE_TYPE (exp))))
  	warning_with_file_and_line (emit_filename, emit_lineno,
  				    "statement with no effect");
        else if (warn_unused_value)
*************** warn_if_unused_value (exp)
*** 1970,1976 ****
      case CONVERT_EXPR:
      case NON_LVALUE_EXPR:
        /* Don't warn about values cast to void.  */
!       if (TREE_TYPE (exp) == void_type_node)
  	return 0;
        /* Don't warn about conversions not explicit in the user's program.  */
        if (TREE_NO_UNUSED_WARNING (exp))
--- 1970,1976 ----
      case CONVERT_EXPR:
      case NON_LVALUE_EXPR:
        /* Don't warn about values cast to void.  */
!       if (VOID_TYPE_P (TREE_TYPE (exp)))
  	return 0;
        /* Don't warn about conversions not explicit in the user's program.  */
        if (TREE_NO_UNUSED_WARNING (exp))
*************** expand_return (retval)
*** 2849,2855 ****
    else if ((TREE_CODE (retval) == MODIFY_EXPR || TREE_CODE (retval) == INIT_EXPR)
  	   && TREE_CODE (TREE_OPERAND (retval, 0)) == RESULT_DECL)
      retval_rhs = TREE_OPERAND (retval, 1);
!   else if (TREE_TYPE (retval) == void_type_node)
      /* Recognize tail-recursive call to void function.  */
      retval_rhs = retval;
    else
--- 2849,2855 ----
    else if ((TREE_CODE (retval) == MODIFY_EXPR || TREE_CODE (retval) == INIT_EXPR)
  	   && TREE_CODE (TREE_OPERAND (retval, 0)) == RESULT_DECL)
      retval_rhs = TREE_OPERAND (retval, 1);
!   else if (VOID_TYPE_P (TREE_TYPE (retval)))
      /* Recognize tail-recursive call to void function.  */
      retval_rhs = retval;
    else
*************** expand_return (retval)
*** 3074,3080 ****
      }
    else if (cleanups
        && retval_rhs != 0
!       && TREE_TYPE (retval_rhs) != void_type_node
        && (GET_CODE (result_rtl) == REG
  	  || (GET_CODE (result_rtl) == PARALLEL)))
      {
--- 3074,3080 ----
      }
    else if (cleanups
        && retval_rhs != 0
!       && !VOID_TYPE_P (TREE_TYPE (retval_rhs))
        && (GET_CODE (result_rtl) == REG
  	  || (GET_CODE (result_rtl) == PARALLEL)))
      {

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