C PATCH: Allow `void' statements

Mark Mitchell mark@codesourcery.com
Tue Mar 21 11:34:00 GMT 2000


A minor goof in Nathan's recent patch to clean up the completeness of
`void' was causing us to disallow statements like `(void) f ();' in C.

I checked in this patch.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-03-21  Mark Mitchell  <mark@codesourcery.com>

	* c-common.c (c_expand_expr_stmt): Use COMPLETE_TYPE_OR_VOID_P,
	not COMPLETE_TYPE_P, to check the type of the expression.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.98
diff -c -p -r1.98 c-common.c
*** c-common.c	2000/03/21 18:10:38	1.98
--- c-common.c	2000/03/21 19:32:57
*************** c_expand_expr_stmt (expr)
*** 2139,2145 ****
      expr = default_conversion (expr);
  
    if (TREE_TYPE (expr) != error_mark_node
!       && !COMPLETE_TYPE_P (TREE_TYPE (expr))
        && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
      error ("expression statement has incomplete type");
  
--- 2139,2145 ----
      expr = default_conversion (expr);
  
    if (TREE_TYPE (expr) != error_mark_node
!       && !COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (expr))
        && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
      error ("expression statement has incomplete type");
  


More information about the Gcc-patches mailing list