[03/10] Move COMPLETE_OR_VOID_TYPE_P to the C and C++ frontends

Message ID 87woqji8k5.fsf@arm.com
State New
Headers show
Series
  • Splitting the C and C++ concept of "complete type"
Related show

Commit Message

Richard Sandiford Oct. 15, 2018, 2:33 p.m.
There was only one use of this macro outside the frontends, in dbxout.c.
This patch expands that use and moves the macro's definition to c-common.h.

There's no expectation that dbx will support sizeless types,
so keeping the current definition should be fine.

2018-10-15  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree.h (COMPLETE_OR_VOID_TYPE_P): Move to c-common.h.
	* dbxout.c (dbxout_typedefs): Expand definition of
	COMPLETE_OR_VOID_TYPE_P.

gcc/c-family/
	* c-common.h (COMPLETE_OR_VOID_TYPE_P): Moved from tree.h.

Patch

Index: gcc/tree.h
===================================================================
--- gcc/tree.h	2018-10-15 14:12:59.036511679 +0100
+++ gcc/tree.h	2018-10-15 14:13:04.148469305 +0100
@@ -602,10 +602,6 @@  #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE
 /* Nonzero if this type is the (possibly qualified) void type.  */
 #define VOID_TYPE_P(NODE) (TREE_CODE (NODE) == VOID_TYPE)
 
-/* 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) \
   (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE)))
Index: gcc/dbxout.c
===================================================================
--- gcc/dbxout.c	2018-10-15 14:12:59.024511777 +0100
+++ gcc/dbxout.c	2018-10-15 14:13:04.148469305 +0100
@@ -1093,7 +1093,7 @@  dbxout_typedefs (tree syms)
 	  tree type = TREE_TYPE (syms);
 	  if (TYPE_NAME (type)
 	      && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
-	      && COMPLETE_OR_VOID_TYPE_P (type)
+	      && (DEFINITE_TYPE_P (type) || VOID_TYPE_P (type))
 	      && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
 	    dbxout_symbol (TYPE_NAME (type), 0);
 	}
Index: gcc/c-family/c-common.h
===================================================================
--- gcc/c-family/c-common.h	2018-10-15 14:08:44.946617301 +0100
+++ gcc/c-family/c-common.h	2018-10-15 14:13:04.148469305 +0100
@@ -742,6 +742,10 @@  #define C_TYPE_FUNCTION_P(type) \
 #define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
   (!C_TYPE_FUNCTION_P (type))
 
+/* 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))
+
 struct visibility_flags
 {
   unsigned inpragma : 1;	/* True when in #pragma GCC visibility.  */