VOID_TYPE_P and error_mark_node

Geoff Keating geoffk@cygnus.com
Wed Jun 7 10:52:00 GMT 2000

Recently, a number of tests of the form

   foo == void_type_node

have been changed to

   VOID_TYPE_P (foo)

This is fine, but before when 'foo' was error_mark_node the test would
fail, and now it causes an --enable-checking=tree error.

The attached patch changes VOID_TYPE_P so that it rejects
error_mark_node.  This seemed like the easiest thing.  It fixes all of
the tree checking failures in C++.

Bootstrapped & tests OK on powerpc-unknown-linux-gnu.  OK to commit?

- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/treechk-voidtype.patch=============
2000-06-07  Geoff Keating  <geoffk@cygnus.com>

	* tree.h (VOID_TYPE_P): Don't look at the TYPE_MAIN_VARIANT
	of an error_type_node.

Index: gcc/tree.h
RCS file: /cvs/gcc/egcs/gcc/tree.h,v
retrieving revision 1.177
diff -p -u -u -p -r1.177 tree.h
--- tree.h	2000/06/05 13:16:13	1.177
+++ tree.h	2000/06/07 17:50:21
@@ -454,7 +454,7 @@ extern void tree_class_check_failed PARA
 /* Nonzero if this type is the (possibly qualified) void type.  */
-#define VOID_TYPE_P(NODE) (TYPE_MAIN_VARIANT (NODE) == void_type_node)
+#define VOID_TYPE_P(NODE) ((NODE) != error_mark_node && TYPE_MAIN_VARIANT (NODE) == void_type_node)
 /* Nonzero if this type is complete or is cv void.  */

More information about the Gcc-patches mailing list