c-common.c: Include "defaults.h".

* c-common.c: Include "defaults.h".
	(WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Define.
	(c_common_nodes_and_builtins): Create string_type_node,
	const_string_type_node, wint_type_node, intmax_type_node,
	uintmax_type_node, default_function_type, ptrdiff_type_node and
	unsigned_ptrdiff_type_node.
	* c-common.h (identifier_global_value): Declare.
	* c-decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
	(init_decl_processing): Don't create string_type_node,
	const_string_type_node, wint_type_node, intmax_type_node,
	uintmax_type_node, default_function_type, ptrdiff_type_node and
	unsigned_ptrdiff_type_node.
	(identifier_global_value): New function.

cp:
	* decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
	(init_decl_processing): Don't create string_type_node,
	const_string_type_node, wint_type_node, intmax_type_node,
	uintmax_type_node, default_function_type, ptrdiff_type_node and
	unsigned_ptrdiff_type_node.  Adjust position of call to
	c_common_nodes_and_builtins.
	(identifier_global_value): New function.

From-SVN: r37931
This commit is contained in:
Joseph Myers 2000-12-01 22:25:43 +00:00 committed by Joseph Myers
parent 239b8e589d
commit 5fd8e53691
6 changed files with 92 additions and 84 deletions

View File

@ -1,3 +1,19 @@
2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c: Include "defaults.h".
(WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Define.
(c_common_nodes_and_builtins): Create string_type_node,
const_string_type_node, wint_type_node, intmax_type_node,
uintmax_type_node, default_function_type, ptrdiff_type_node and
unsigned_ptrdiff_type_node.
* c-common.h (identifier_global_value): Declare.
* c-decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
(init_decl_processing): Don't create string_type_node,
const_string_type_node, wint_type_node, intmax_type_node,
uintmax_type_node, default_function_type, ptrdiff_type_node and
unsigned_ptrdiff_type_node.
(identifier_global_value): New function.
2000-12-01 Neil Booth <neilb@earthling.net>
* cppinit.c (initialize): Forgotten prototype.

View File

@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
#include "ggc.h"
#include "expr.h"
#include "c-common.h"
#include "defaults.h"
#include "tm_p.h"
#include "intl.h"
#include "diagnostic.h"
@ -40,6 +41,26 @@ cpp_reader parse_in;
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)
#ifndef WINT_TYPE
#define WINT_TYPE "unsigned int"
#endif
#ifndef INTMAX_TYPE
#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "int" \
: ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "long int" \
: "long long int"))
#endif
#ifndef UINTMAX_TYPE
#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "unsigned int" \
: ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "long unsigned int" \
: "long long unsigned int"))
#endif
/* The following symbols are subsumed in the c_global_trees array, and
listed here individually for documentation purposes.
@ -4899,6 +4920,23 @@ c_common_nodes_and_builtins ()
tree va_list_ref_type_node;
tree va_list_arg_type_node;
string_type_node = build_pointer_type (char_type_node);
const_string_type_node
= build_pointer_type (build_type_variant (char_type_node, 1, 0));
wint_type_node =
TREE_TYPE (identifier_global_value (get_identifier (WINT_TYPE)));
intmax_type_node =
TREE_TYPE (identifier_global_value (get_identifier (INTMAX_TYPE)));
uintmax_type_node =
TREE_TYPE (identifier_global_value (get_identifier (UINTMAX_TYPE)));
default_function_type = build_function_type (integer_type_node, NULL_TREE);
ptrdiff_type_node
= TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
va_list_type_node));

View File

@ -435,6 +435,8 @@ extern int warn_conversion;
extern tree (*make_fname_decl) PARAMS ((tree, const char *, int));
extern tree identifier_global_value PARAMS ((tree));
extern void declare_function_name PARAMS ((void));
extern void decl_attributes PARAMS ((tree, tree, tree));
extern void init_function_format_info PARAMS ((void));

View File

@ -70,25 +70,6 @@ enum decl_context
#define WCHAR_TYPE "int"
#endif
#ifndef WINT_TYPE
#define WINT_TYPE "unsigned int"
#endif
#ifndef INTMAX_TYPE
#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "int" \
: ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "long int" \
: "long long int"))
#endif
#ifndef UINTMAX_TYPE
#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "unsigned int" \
: ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "long unsigned int" \
: "long long unsigned int"))
#endif
/* Nonzero if we have seen an invalid cross reference
to a struct, union, or enum, but not yet printed the message. */
@ -3081,14 +3062,6 @@ init_decl_processing ()
signed_wchar_type_node = signed_type (wchar_type_node);
unsigned_wchar_type_node = unsigned_type (wchar_type_node);
wint_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WINT_TYPE)));
intmax_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (INTMAX_TYPE)));
uintmax_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (UINTMAX_TYPE)));
boolean_type_node = integer_type_node;
boolean_true_node = integer_one_node;
boolean_false_node = integer_zero_node;
@ -3106,10 +3079,6 @@ init_decl_processing ()
c_bool_true_node = build_int_2 (1, 0);
TREE_TYPE (c_bool_true_node) = c_bool_type_node;
string_type_node = build_pointer_type (char_type_node);
const_string_type_node
= build_pointer_type (build_type_variant (char_type_node, 1, 0));
/* 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
@ -3132,11 +3101,6 @@ init_decl_processing ()
void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
default_function_type = build_function_type (integer_type_node, NULL_TREE);
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
c_common_nodes_and_builtins ();
endlink = void_list_node;
@ -7203,3 +7167,13 @@ c_expand_decl_stmt (t)
&& DECL_SAVED_TREE (decl))
c_expand_body (decl, /*nested_p=*/1);
}
/* Return the IDENTIFIER_GLOBAL_VALUE of T, for use in common code, since
the definition of IDENTIFIER_GLOBAL_VALUE is different for C and C++. */
tree
identifier_global_value (t)
tree t;
{
return IDENTIFIER_GLOBAL_VALUE (t);
}

View File

@ -1,3 +1,13 @@
2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
* decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
(init_decl_processing): Don't create string_type_node,
const_string_type_node, wint_type_node, intmax_type_node,
uintmax_type_node, default_function_type, ptrdiff_type_node and
unsigned_ptrdiff_type_node. Adjust position of call to
c_common_nodes_and_builtins.
(identifier_global_value): New function.
2000-12-01 Nathan Sidwell <nathan@codesourcery.com>
* call.c (standard_conversion): Reject pointer to member

View File

@ -80,26 +80,6 @@ extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree));
#define WCHAR_TYPE "int"
#endif
#ifndef WINT_TYPE
#define WINT_TYPE "unsigned int"
#endif
#ifndef INTMAX_TYPE
#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "int" \
: ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "long int" \
: "long long int"))
#endif
#ifndef UINTMAX_TYPE
#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "unsigned int" \
: ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \
? "long unsigned int" \
: "long long unsigned int"))
#endif
static tree grokparms PARAMS ((tree));
static const char *redeclaration_error_message PARAMS ((tree, tree));
@ -6398,10 +6378,6 @@ init_decl_processing ()
record_builtin_type (RID_MAX, "unsigned short",
short_unsigned_type_node);
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_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);
@ -6486,15 +6462,7 @@ init_decl_processing ()
void_list_node = build_tree_list (NULL_TREE, void_type_node);
TREE_PARMLIST (void_list_node) = 1;
string_type_node = build_pointer_type (char_type_node);
const_string_type_node
= build_pointer_type (build_qualified_type (char_type_node,
TYPE_QUAL_CONST));
empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
#if 0
record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
#endif
/* 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. */
@ -6510,6 +6478,12 @@ init_decl_processing ()
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);
#endif
if (flag_new_abi)
delta_type_node = ptrdiff_type_node;
else if (flag_huge_objects)
@ -6522,15 +6496,7 @@ init_decl_processing ()
else
vtable_index_type = delta_type_node;
default_function_type
= build_function_type (integer_type_node, NULL_TREE);
ptr_type_node = build_pointer_type (void_type_node);
const_ptr_type_node
= build_pointer_type (build_qualified_type (void_type_node,
TYPE_QUAL_CONST));
vtt_parm_type = build_pointer_type (const_ptr_type_node);
c_common_nodes_and_builtins ();
lang_type_promotes_to = convert_type_from_ellipsis;
void_ftype_ptr
@ -6571,14 +6537,6 @@ init_decl_processing ()
wchar_array_type_node
= build_array_type (wchar_type_node, array_domain_type);
wint_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WINT_TYPE)));
intmax_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (INTMAX_TYPE)));
uintmax_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (UINTMAX_TYPE)));
if (flag_vtable_thunks)
{
/* Make sure we get a unique function type, so we can give
@ -14672,3 +14630,13 @@ lang_mark_tree (t)
ggc_mark_tree ((tree) lt);
}
}
/* Return the IDENTIFIER_GLOBAL_VALUE of T, for use in common code, since
the definition of IDENTIFIER_GLOBAL_VALUE is different for C and C++. */
tree
identifier_global_value (t)
tree t;
{
return IDENTIFIER_GLOBAL_VALUE (t);
}