Updated C/C++ common builtin tree nodes patch

Joseph S. Myers jsm28@cam.ac.uk
Thu Jan 4 10:55:00 GMT 2001


This patch is an updated version of my patch
<URL: http://gcc.gnu.org/ml/gcc-patches/2000-12/msg00082.html > to share
more code for C/C++ common builtin tree nodes: this version will apply
to current GCC, and is updated to allow for some changes in the C++
front end code since the original version of the patch.

This patch moves the creation of many tree nodes shared by C and C++
to common code (for a saving of 85 lines of code and much greater
clarity of where new such nodes should be added).  The only change in
behaviour should be that __int128_t and __uint128_t are (if
appropriate) declared for C as well as C++, though there are a few
conditionals on C++ that may not need to be conditional on C++.

Bootstrapped with no regressions on i686-pc-linux-gnu.  OK to commit?

gcc/ChangeLog:
2001-01-04  Joseph S. Myers  <jsm28@cam.ac.uk>

	* c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
	(flag_short_double, flag_short_wchar): Define.
	(c_common_nodes_and_builtins): Create many tree nodes shared
	between C and C++ here instead of in cp/decl.c and ...
	* c-decl.c (init_decl_processing): ... here.
	(SIZE_TYPE, WCHAR_TYPE): Don't define.
	(flag_short_double, flag_short_wchar): Don't define.
	(record_builtin_type): New function.
	(build_void_list_node): New function.
	* c-common.h (flag_short_double, flag_short_wchar,
	record_builtin_type, build_void_list_node): Declare.

gcc/cp/ChangeLog:
2001-01-04  Joseph S. Myers  <jsm28@cam.ac.uk>

	* decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define.
	(record_builtin_type): Make non-static.
	(flag_short_double): Don't declare.
	(init_decl_processing): Remove the creation of many tree nodes now
	in c_common_nodes_and_builtins.
	(build_void_list_node): New function.
	* decl2.c (flag_short_double, flag_short_wchar): Don't define.
	* cp-tree.h (flag_short_wchar): Don't declare.

--- c-common.c.orig	Wed Jan  3 20:42:11 2001
+++ c-common.c	Wed Jan  3 23:51:02 2001
@@ -41,6 +41,20 @@ cpp_reader *parse_in;		/* Declared in c-
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)

+/* We let tm.h override the types used here, to handle trivial differences
+   such as the choice of unsigned int or long unsigned int for size_t.
+   When machines start needing nontrivial differences in the size type,
+   it would be best to do something here to figure out automatically
+   from other information what type to use.  */
+
+#ifndef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+#endif
+
+#ifndef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+#endif
+
 #ifndef PTRDIFF_TYPE
 #define PTRDIFF_TYPE "long int"
 #endif
@@ -172,6 +186,14 @@ int flag_no_builtin;

 int flag_no_nonansi_builtin;

+/* Nonzero means give `double' the same size as `float'.  */
+
+int flag_short_double;
+
+/* Nonzero means give `wchar_t' the same size as `short'.  */
+
+int flag_short_wchar;
+
 /* If non-NULL, dump the tree structure for the entire translation
    unit to this file.  */

@@ -5096,6 +5118,8 @@ lang_get_alias_set (t)
 void
 c_common_nodes_and_builtins ()
 {
+  int wchar_type_size;
+  tree array_domain_type;
   tree temp;
   tree memcpy_ftype, memset_ftype, strlen_ftype;
   tree bzero_ftype, bcmp_ftype, puts_ftype, printf_ftype;
@@ -5121,6 +5145,140 @@ c_common_nodes_and_builtins ()
   tree traditional_len_endlink;
   tree va_list_ref_type_node;
   tree va_list_arg_type_node;
+
+  /* Define `int' and `char' first so that dbx will output them first.  */
+  record_builtin_type (RID_INT, NULL_PTR, integer_type_node);
+  record_builtin_type (RID_CHAR, "char", char_type_node);
+
+  /* `signed' is the same as `int'.  FIXME: the declarations of "signed",
+     "unsigned long", "long long unsigned" and "unsigned short" were in C++
+     but not C.  Are the conditionals here needed?  */
+  if (c_language == clk_cplusplus)
+    record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node);
+  record_builtin_type (RID_LONG, "long int", long_integer_type_node);
+  record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
+  record_builtin_type (RID_MAX, "long unsigned int",
+		       long_unsigned_type_node);
+  if (c_language == clk_cplusplus)
+    record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
+  record_builtin_type (RID_MAX, "long long int",
+		       long_long_integer_type_node);
+  record_builtin_type (RID_MAX, "long long unsigned int",
+		       long_long_unsigned_type_node);
+  if (c_language == clk_cplusplus)
+    record_builtin_type (RID_MAX, "long long unsigned",
+			 long_long_unsigned_type_node);
+  record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
+  record_builtin_type (RID_MAX, "short unsigned int",
+		       short_unsigned_type_node);
+  if (c_language == clk_cplusplus)
+    record_builtin_type (RID_MAX, "unsigned short",
+			 short_unsigned_type_node);
+
+  /* Define both `signed char' and `unsigned char'.  */
+  record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
+  record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
+
+  /* These are types that type_for_size and type_for_mode use.  */
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
+#if HOST_BITS_PER_WIDE_INT >= 64
+  pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node));
+#endif
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
+#if HOST_BITS_PER_WIDE_INT >= 64
+  pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node));
+#endif
+
+  /* Create the widest literal types.  */
+  widest_integer_literal_type_node
+    = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+			widest_integer_literal_type_node));
+
+  widest_unsigned_literal_type_node
+    = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
+  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+			widest_unsigned_literal_type_node));
+
+  /* `unsigned long' is the standard type for sizeof.
+     Note that stddef.h uses `unsigned long',
+     and this must agree, even if long and int are the same size.  */
+  c_size_type_node =
+    TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE)));
+  signed_size_type_node = signed_type (c_size_type_node);
+  if (flag_traditional)
+    c_size_type_node = signed_size_type_node;
+  set_sizetype (c_size_type_node);
+
+  build_common_tree_nodes_2 (flag_short_double);
+
+  record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node);
+  record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node);
+  record_builtin_type (RID_MAX, "long double", long_double_type_node);
+
+  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
+			complex_integer_type_node));
+  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
+			complex_float_type_node));
+  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
+			complex_double_type_node));
+  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
+			complex_long_double_type_node));
+
+  record_builtin_type (RID_VOID, NULL_PTR, void_type_node);
+
+  void_list_node = build_void_list_node ();
+
+  /* Make a type to be the domain of a few array types
+     whose domains don't really matter.
+     200 is small enough that it always fits in size_t
+     and large enough that it can hold most function names for the
+     initializations of __FUNCTION__ and __PRETTY_FUNCTION__.  */
+  array_domain_type = build_index_type (size_int (200));
+
+  /* Make a type for arrays of characters.
+     With luck nothing will ever really depend on the length of this
+     array type.  */
+  char_array_type_node
+    = build_array_type (char_type_node, array_domain_type);
+
+  /* Likewise for arrays of ints.  */
+  int_array_type_node
+    = build_array_type (integer_type_node, array_domain_type);
+
+#ifdef MD_INIT_BUILTINS
+  MD_INIT_BUILTINS;
+#endif
+
+  /* This is special for C++ so functions can be overloaded.  */
+  wchar_type_node = get_identifier (flag_short_wchar
+				    ? "short unsigned int"
+				    : WCHAR_TYPE);
+  wchar_type_node = TREE_TYPE (identifier_global_value (wchar_type_node));
+  wchar_type_size = TYPE_PRECISION (wchar_type_node);
+  if (c_language == clk_cplusplus)
+    {
+      if (TREE_UNSIGNED (wchar_type_node))
+	wchar_type_node = make_unsigned_type (wchar_type_size);
+      else
+	wchar_type_node = make_signed_type (wchar_type_size);
+      record_builtin_type (RID_WCHAR, "wchar_t", wchar_type_node);
+    }
+  else
+    {
+      signed_wchar_type_node = signed_type (wchar_type_node);
+      unsigned_wchar_type_node = unsigned_type (wchar_type_node);
+    }
+
+  /* This is for wide string constants.  */
+  wchar_array_type_node
+    = build_array_type (wchar_type_node, array_domain_type);

   string_type_node = build_pointer_type (char_type_node);
   const_string_type_node
--- c-common.h.orig	Wed Jan  3 20:42:11 2001
+++ c-common.h	Wed Jan  3 23:44:00 2001
@@ -351,6 +351,14 @@ extern c_language_kind c_language;

 extern int flag_const_strings;

+/* Nonzero means give `double' the same size as `float'.  */
+
+extern int flag_short_double;
+
+/* Nonzero means give `wchar_t' the same size as `short'.  */
+
+extern int flag_short_wchar;
+
 /* Warn about *printf or *scanf format/argument anomalies. */

 extern int warn_format;
@@ -463,6 +471,9 @@ extern int warn_long_long;
 extern tree (*make_fname_decl)                  PARAMS ((tree, const char *, int));

 extern tree identifier_global_value		PARAMS ((tree));
+extern void record_builtin_type			PARAMS ((enum rid,
+							 const char *, tree));
+extern tree build_void_list_node		PARAMS ((void));

 extern void declare_function_name		PARAMS ((void));
 extern void decl_attributes			PARAMS ((tree, tree, tree));
--- c-decl.c.orig	Tue Jan  2 18:29:52 2001
+++ c-decl.c	Wed Jan  3 23:44:00 2001
@@ -52,20 +52,6 @@ enum decl_context
   BITFIELD,			/* Likewise but with specified width */
   TYPENAME};			/* Typename (inside cast or sizeof)  */

-/* We let tm.h override the types used here, to handle trivial differences
-   such as the choice of unsigned int or long unsigned int for size_t.
-   When machines start needing nontrivial differences in the size type,
-   it would be best to do something here to figure out automatically
-   from other information what type to use.  */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
-

 /* Nonzero if we have seen an invalid cross reference
    to a struct, union, or enum, but not yet printed the message.  */
@@ -304,14 +290,6 @@ static void c_expand_body

 int flag_cond_mismatch;

-/* Nonzero means give `double' the same size as `float'.  */
-
-int flag_short_double;
-
-/* Nonzero means give `wchar_t' the same size as `short'.  */
-
-int flag_short_wchar;
-
 /* Nonzero means don't recognize the keyword `asm'.  */

 int flag_no_asm;
@@ -2962,9 +2940,6 @@ init_decl_processing ()
 {
   register tree endlink;
   tree ptr_ftype_void, ptr_ftype_ptr;
-  int wchar_type_size;
-  tree array_domain_type;
-  tree t;

   current_function_decl = NULL;
   named_labels = NULL;
@@ -2977,96 +2952,7 @@ init_decl_processing ()

   build_common_tree_nodes (flag_signed_char);

-  /* Define `int' and `char' first so that dbx will output them first.  */
-  pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_INT],
-			integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("char"),
-			char_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("long int"),
-			long_integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"),
-			unsigned_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("long unsigned int"),
-			long_unsigned_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("long long int"),
-			long_long_integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"),
-			long_long_unsigned_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("short int"),
-			short_integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("short unsigned int"),
-			short_unsigned_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"),
-			signed_char_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"),
-			unsigned_char_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
-#if HOST_BITS_PER_WIDE_INT >= 64
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intTI_type_node));
-#endif
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
-#if HOST_BITS_PER_WIDE_INT >= 64
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intTI_type_node));
-#endif
-
-  /* `unsigned long' is the standard type for sizeof.
-     Traditionally, use a signed type.
-     Note that stddef.h uses `unsigned long',
-     and this must agree, even if long and int are the same size.  */
-  t = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
-  signed_size_type_node = signed_type (t);
-  if (flag_traditional && TREE_UNSIGNED (t))
-    t = signed_type (t);
-
-  c_size_type_node = t;
-  set_sizetype (t);
-
-  /* Create the widest literal types.  */
-  widest_integer_literal_type_node
-    = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
-  widest_unsigned_literal_type_node
-    = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
-			widest_integer_literal_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
-			widest_unsigned_literal_type_node));
-
-  build_common_tree_nodes_2 (flag_short_double);
-
-  pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT],
-			float_type_node));
-  pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE],
-			double_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"),
-			long_double_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
-			complex_integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
-			complex_float_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
-			complex_double_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
-			complex_long_double_type_node));
-  pushdecl (build_decl (TYPE_DECL,
-			ridpointers[(int) RID_VOID], void_type_node));
-
-#ifdef MD_INIT_BUILTINS
-  MD_INIT_BUILTINS;
-#endif
-
-  wchar_type_node = get_identifier (flag_short_wchar
-				    ? "short unsigned int"
-				    : WCHAR_TYPE);
-  wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node));
-  wchar_type_size = TYPE_PRECISION (wchar_type_node);
-  signed_wchar_type_node = signed_type (wchar_type_node);
-  unsigned_wchar_type_node = unsigned_type (wchar_type_node);
+  c_common_nodes_and_builtins ();

   boolean_type_node = integer_type_node;
   boolean_true_node = integer_one_node;
@@ -3085,30 +2971,6 @@ init_decl_processing ()
   c_bool_true_node = build_int_2 (1, 0);
   TREE_TYPE (c_bool_true_node) = c_bool_type_node;

-  /* Make a type to be the domain of a few array types
-     whose domains don't really matter.
-     200 is small enough that it always fits in size_t
-     and large enough that it can hold most function names for the
-     initializations of __FUNCTION__ and __PRETTY_FUNCTION__.  */
-  array_domain_type = build_index_type (build_int_2 (200, 0));
-
-  /* make a type for arrays of characters.
-     With luck nothing will ever really depend on the length of this
-     array type.  */
-  char_array_type_node = build_array_type (char_type_node, array_domain_type);
-
-  /* Likewise for arrays of ints.  */
-  int_array_type_node
-    = build_array_type (integer_type_node, array_domain_type);
-
-  /* This is for wide string constants.  */
-  wchar_array_type_node
-    = build_array_type (wchar_type_node, array_domain_type);
-
-  void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
-
-  c_common_nodes_and_builtins ();
-
   endlink = void_list_node;
   ptr_ftype_void = build_function_type (ptr_type_node, endlink);
   ptr_ftype_ptr
@@ -7186,4 +7048,29 @@ identifier_global_value	(t)
      tree t;
 {
   return IDENTIFIER_GLOBAL_VALUE (t);
+}
+
+/* Record a builtin type for C.  If NAME is non-NULL, it is the name used;
+   otherwise the name is found in ridpointers from RID_INDEX.  */
+
+void
+record_builtin_type (rid_index, name, type)
+     enum rid rid_index;
+     const char *name;
+     tree type;
+{
+  tree id;
+  if (name == 0)
+    id = ridpointers[(int) rid_index];
+  else
+    id = get_identifier (name);
+  pushdecl (build_decl (TYPE_DECL, id, type));
+}
+
+/* Build the void_list_node (void_type_node having been created).  */
+tree
+build_void_list_node ()
+{
+  tree t = build_tree_list (NULL_TREE, void_type_node);
+  return t;
 }
--- cp/decl.c.orig	Wed Jan  3 18:58:53 2001
+++ cp/decl.c	Wed Jan  3 23:46:21 2001
@@ -62,24 +62,6 @@ extern int (*valid_lang_attribute) PARAM
 #endif
 #endif

-/* We let tm.h override the types used here, to handle trivial differences
-   such as the choice of unsigned int or long unsigned int for size_t.
-   When machines start needing nontrivial differences in the size type,
-   it would be best to do something here to figure out automatically
-   from other information what type to use.  */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#endif
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
-
 static tree grokparms				PARAMS ((tree));
 static const char *redeclaration_error_message	PARAMS ((tree, tree));

@@ -109,7 +91,6 @@ static tree lookup_tag PARAMS ((enum tre
 			      struct binding_level *, int));
 static void set_identifier_type_value_with_scope
 	PARAMS ((tree, tree, struct binding_level *));
-static void record_builtin_type PARAMS ((enum rid, const char *, tree));
 static void record_unknown_type PARAMS ((tree, const char *));
 static tree build_library_fn_1 PARAMS ((tree, enum tree_code, tree));
 static int member_function_or_else PARAMS ((tree, tree, enum overload_flags));
@@ -334,10 +315,6 @@ int flag_hosted = 1;

 int flag_noniso_default_format_attributes = 1;

-/* Nonzero means give `double' the same size as `float'.  */
-
-extern int flag_short_double;
-
 /* Nonzero if we want to conserve space in the .o files.  We do this
    by putting uninitialized data and runtime initialized data into
    .common instead of .data at the expense of not flagging multiple
@@ -6153,7 +6130,7 @@ end_only_namespace_names ()
    in the array RID_POINTERS.  NAME is the name used when looking
    up the builtin type.  TYPE is the _TYPE node for the builtin type.  */

-static void
+void
 record_builtin_type (rid_index, name, type)
      enum rid rid_index;
      const char *name;
@@ -6309,8 +6286,6 @@ void
 init_decl_processing ()
 {
   tree fields[20];
-  int wchar_type_size;
-  tree array_domain_type;

   /* Check to see that the user did not specify an invalid combination
      of command-line options.  */
@@ -6382,67 +6357,7 @@ init_decl_processing ()
       pushdecl (fake_std_node);
     }

-  /* Define `int' and `char' first so that dbx will output them first.  */
-  record_builtin_type (RID_INT, NULL_PTR, integer_type_node);
-  record_builtin_type (RID_CHAR, "char", char_type_node);
-
-  /* `signed' is the same as `int' */
-  record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node);
-  record_builtin_type (RID_LONG, "long int", long_integer_type_node);
-  record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
-  record_builtin_type (RID_MAX, "long unsigned int",
-		       long_unsigned_type_node);
-  record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
-  record_builtin_type (RID_MAX, "long long int",
-		       long_long_integer_type_node);
-  record_builtin_type (RID_MAX, "long long unsigned int",
-		       long_long_unsigned_type_node);
-  record_builtin_type (RID_MAX, "long long unsigned",
-		       long_long_unsigned_type_node);
-  record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
-  record_builtin_type (RID_MAX, "short unsigned int",
-		       short_unsigned_type_node);
-  record_builtin_type (RID_MAX, "unsigned short",
-		       short_unsigned_type_node);
-
-  /* Define both `signed char' and `unsigned char'.  */
-  record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
-  record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
-
-  /* `unsigned long' is the standard type for sizeof.
-     Note that stddef.h uses `unsigned long',
-     and this must agree, even if long and int are the same size.  */
-  c_size_type_node =
-    TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
-  signed_size_type_node = signed_type (c_size_type_node);
-  set_sizetype (c_size_type_node);
-
-  /* Create the widest literal types. */
-  widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
-			widest_integer_literal_type_node));
-
-  widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
-			widest_unsigned_literal_type_node));
-
-  /* These are types that type_for_size and type_for_mode use.  */
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
-#if HOST_BITS_PER_WIDE_INT >= 64
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node));
-#endif
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
-#if HOST_BITS_PER_WIDE_INT >= 64
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node));
-#endif
-
-  build_common_tree_nodes_2 (flag_short_double);
+  c_common_nodes_and_builtins ();

   java_byte_type_node = record_builtin_java_type ("__java_byte", 8);
   java_short_type_node = record_builtin_java_type ("__java_short", 16);
@@ -6470,42 +6385,9 @@ init_decl_processing ()
   TREE_TYPE (boolean_true_node) = boolean_type_node;

   signed_size_zero_node = build_int_2 (0, 0);
-  record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node);
-  record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node);
-  record_builtin_type (RID_MAX, "long double", long_double_type_node);
-
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
-			complex_integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
-			complex_float_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
-			complex_double_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
-			complex_long_double_type_node));
-
   TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype));

-  record_builtin_type (RID_VOID, NULL_PTR, void_type_node);
-  void_list_node = build_tree_list (NULL_TREE, void_type_node);
-  TREE_PARMLIST (void_list_node) = 1;
-
   empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
-  /* Make a type to be the domain of a few array types
-     whose domains don't really matter.
-     200 is small enough that it always fits in size_t.  */
-  array_domain_type = build_index_type (size_int (200));
-
-  /* Make a type for arrays of characters.
-     With luck nothing will ever really depend on the length of this
-     array type.  */
-  char_array_type_node
-    = build_array_type (char_type_node, array_domain_type);
-
-  /* Likewise for arrays of ints.  */
-  int_array_type_node
-    = build_array_type (integer_type_node, array_domain_type);
-
-  c_common_nodes_and_builtins ();

 #if 0
   record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
@@ -6529,10 +6411,6 @@ init_decl_processing ()
   void_ftype_ptr
     = build_exception_variant (void_ftype_ptr, empty_except_spec);

-#ifdef MD_INIT_BUILTINS
-  MD_INIT_BUILTINS;
-#endif
-
   /* C++ extensions */

   unknown_type_node = make_node (UNKNOWN_TYPE);
@@ -6548,22 +6426,6 @@ init_decl_processing ()
   TYPE_POINTER_TO (unknown_type_node) = unknown_type_node;
   TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;

-  /* This is special for C++ so functions can be overloaded.  */
-  wchar_type_node = get_identifier (flag_short_wchar
-				    ? "short unsigned int"
-				    : WCHAR_TYPE);
-  wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node));
-  wchar_type_size = TYPE_PRECISION (wchar_type_node);
-  if (TREE_UNSIGNED (wchar_type_node))
-    wchar_type_node = make_unsigned_type (wchar_type_size);
-  else
-    wchar_type_node = make_signed_type (wchar_type_size);
-  record_builtin_type (RID_WCHAR, "wchar_t", wchar_type_node);
-
-  /* This is for wide string constants.  */
-  wchar_array_type_node
-    = build_array_type (wchar_type_node, array_domain_type);
-
   if (flag_vtable_thunks)
     {
       /* Make sure we get a unique function type, so we can give
@@ -14659,6 +14521,15 @@ identifier_global_value	(t)
      tree t;
 {
   return IDENTIFIER_GLOBAL_VALUE (t);
+}
+
+/* Build the void_list_node (void_type_node having been created).  */
+tree
+build_void_list_node ()
+{
+  tree t = build_tree_list (NULL_TREE, void_type_node);
+  TREE_PARMLIST (t) = 1;
+  return t;
 }

 static int
--- cp/decl2.c.orig	Wed Jan  3 18:58:53 2001
+++ cp/decl2.c	Wed Jan  3 23:46:56 2001
@@ -144,10 +144,6 @@ static tree decl_namespace_list;

 int flag_cond_mismatch;

-/* Nonzero means give `double' the same size as `float'.  */
-
-int flag_short_double;
-
 /* Nonzero means don't recognize the keyword `asm'.  */

 int flag_no_asm;
@@ -452,11 +448,6 @@ int max_tinst_depth = 50;
    template functions with identical types, but different template
    arguments.  */
 int name_mangling_version = 2;
-
-/* Nonzero if wchar_t should be `unsigned short' instead of whatever it
-   would normally be, for use with WINE.  */
-
-int flag_short_wchar;

 /* Nonzero if squashed mangling is to be performed.
    This uses the B and K codes to reference previously seen class types
--- cp/cp-tree.h.orig	Wed Jan  3 18:58:53 2001
+++ cp/cp-tree.h	Wed Jan  3 23:44:00 2001
@@ -1131,10 +1131,6 @@ extern int flag_default_inline;
    version 0.  */
 extern int name_mangling_version;

-/* Nonzero if wchar_t should be `unsigned short' instead of whatever it
-   would normally be, for use with WINE.  */
-extern int flag_short_wchar;
-
 /* Nonzero if squashed mangling is to be performed.
    This uses the B and K codes to reference previously seen class types
    and class qualifiers.       */

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list