[05/10] Move complete_or_array_type_p to the C and C++ frontends

Message ID 87o9bvi8hq.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:34 p.m.
complete_or_array_type_p was defined in tree.h but unused outside
the frontends.  This patch moves it to c-common.h.

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

gcc/
	* tree.h (complete_or_array_type_p): Move to c-common.h.

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

Patch

Index: gcc/tree.h
===================================================================
--- gcc/tree.h	2018-10-15 14:13:08.520433065 +0100
+++ gcc/tree.h	2018-10-15 14:13:13.584391090 +0100
@@ -4859,17 +4859,6 @@  ptrofftype_p (tree type)
 	  && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype));
 }
 
-/* Return true if the argument is a complete type or an array
-   of unknown bound (whose type is incomplete but) whose elements
-   have complete type.  */
-static inline bool
-complete_or_array_type_p (const_tree type)
-{
-  return COMPLETE_TYPE_P (type)
-         || (TREE_CODE (type) == ARRAY_TYPE
-	     && COMPLETE_TYPE_P (TREE_TYPE (type)));
-}
-
 /* Return true if the value of T could be represented as a poly_widest_int.  */
 
 inline bool
Index: gcc/c-family/c-common.h
===================================================================
--- gcc/c-family/c-common.h	2018-10-15 14:13:08.516433099 +0100
+++ gcc/c-family/c-common.h	2018-10-15 14:13:13.584391090 +0100
@@ -750,6 +750,17 @@  #define COMPLETE_OR_VOID_TYPE_P(NODE) \
 #define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
   (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE)))
 
+/* Return true if the argument is a complete type or an array
+   of unknown bound (whose type is incomplete but) whose elements
+   have complete type.  */
+static inline bool
+complete_or_array_type_p (const_tree type)
+{
+  return COMPLETE_TYPE_P (type)
+         || (TREE_CODE (type) == ARRAY_TYPE
+	     && COMPLETE_TYPE_P (TREE_TYPE (type)));
+}
+
 struct visibility_flags
 {
   unsigned inpragma : 1;	/* True when in #pragma GCC visibility.  */