#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));
tree names, old_bindings;
{
tree t;
+ tree search_bindings = old_bindings;
+
for (t = names; t; t = TREE_CHAIN (t))
{
tree binding, t1, id;
|| !(IDENTIFIER_BINDING (id) || IDENTIFIER_CLASS_VALUE (id)))
continue;
- for (t1 = old_bindings; t1; t1 = TREE_CHAIN (t1))
+ for (t1 = search_bindings; t1; t1 = TREE_CHAIN (t1))
if (TREE_VEC_ELT (t1, 0) == id)
goto skip_it;
+ my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
binding = make_tree_vec (4);
-
- if (id)
- {
- my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
- TREE_VEC_ELT (binding, 0) = id;
- TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id);
- TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id);
- TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
- IDENTIFIER_BINDING (id) = NULL_TREE;
- IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
- }
+ TREE_VEC_ELT (binding, 0) = id;
+ TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id);
+ TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id);
+ TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
+ IDENTIFIER_BINDING (id) = NULL_TREE;
+ IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
TREE_CHAIN (binding) = old_bindings;
old_bindings = binding;
skip_it:
for (t = s->old_bindings; t; t = TREE_CHAIN (t))
{
tree id = TREE_VEC_ELT (t, 0);
- if (id)
- {
- SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1));
- IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2);
- IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
- }
+
+ SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1));
+ IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2);
+ IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
}
/* If we were in the middle of compiling a function, restore our
/* Or in the innermost namespace. */
if (! t)
t = namespace_binding (name, DECL_CONTEXT (x));
- /* Does it have linkage? */
- if (t && ! (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+ /* Does it have linkage? Note that if this isn't a DECL, it's an
+ OVERLOAD, which is OK. */
+ if (t && DECL_P (t) && ! (TREE_STATIC (t) || DECL_EXTERNAL (t)))
t = NULL_TREE;
if (t)
different_binding_level = 1;
{
tree decl = lookup_label (name);
struct named_label_list *ent;
+ register struct binding_level *p;
for (ent = named_labels; ent; ent = ent->next)
if (ent->label_decl == decl)
break;
- /* After labels, make any new cleanups go into their
+ /* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- current_binding_level->more_cleanups_ok = 0;
+ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain)
+ p->more_cleanups_ok = 0;
if (name == get_identifier ("wchar_t"))
cp_pedwarn ("label named wchar_t");
/* Note that we've seen a definition of a case label, and complain if this
is a bad place for one. */
-void
+tree
finish_case_label (low_value, high_value)
tree low_value;
tree high_value;
{
- tree cond;
+ tree cond, r;
+ register struct binding_level *p;
if (! switch_stack)
{
low_value);
else
error ("`default' label not within a switch statement");
- return;
+ return NULL_TREE;
}
if (processing_template_decl)
/* For templates, just add the case label; we'll do semantic
analysis at instantiation-time. */
label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- add_stmt (build_case_label (low_value, high_value, label));
- return;
+ return add_stmt (build_case_label (low_value, high_value, label));
}
/* Find the condition on which this switch statement depends. */
if (cond && TREE_CODE (cond) == TREE_LIST)
cond = TREE_VALUE (cond);
- c_add_case_label (switch_stack->cases, cond, low_value, high_value);
+ r = c_add_case_label (switch_stack->cases, cond, low_value, high_value);
+ if (r == error_mark_node)
+ r = NULL_TREE;
check_switch_goto (switch_stack->level);
- /* After labels, make any new cleanups go into their
+ /* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- current_binding_level->more_cleanups_ok = 0;
+ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain)
+ p->more_cleanups_ok = 0;
current_function_return_value = NULL_TREE;
+
+ return r;
}
\f
/* Return the list of declarations of the current level.
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);
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. */
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)
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
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
return decl;
if (virtualp)
- {
- DECL_VIRTUAL_P (decl) = 1;
- if (DECL_VINDEX (decl) == NULL_TREE)
- DECL_VINDEX (decl) = error_mark_node;
- IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1;
- }
+ DECL_VIRTUAL_P (decl) = 1;
return decl;
}
}
/* Until core issue 180 is resolved, allow 'friend typename A::B'.
- But don't allow implicit typenames. */
+ But don't allow implicit typenames except with a class-key. */
if (!current_aggr && (TREE_CODE (type) != TYPENAME_TYPE
|| IMPLICIT_TYPENAME_P (type)))
{
other parameters have default arguments. */
if (TREE_CODE (parmtype) == REFERENCE_TYPE
&& TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype
- && (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
+ && sufficient_parms_p (TREE_CHAIN (parmtypes))
&& !(DECL_TEMPLATE_INSTANTIATION (decl)
&& is_member_template (DECL_TI_TEMPLATE (decl))))
{
existence. Theoretically, they should never even be
instantiated, but that's hard to forestall. */
else if (TYPE_MAIN_VARIANT (parmtype) == ctype
- && (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
+ && sufficient_parms_p (TREE_CHAIN (parmtypes))
&& !(DECL_TEMPLATE_INSTANTIATION (decl)
&& is_member_template (DECL_TI_TEMPLATE (decl))))
{
/* Initialize RTL machinery. We cannot do this until
CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this
even when processing a template; this is how we get
- CFUN set up, and our per-function variables initialized. */
+ CFUN set up, and our per-function variables initialized.
+ FIXME factor out the non-RTL stuff. */
bl = current_binding_level;
init_function_start (decl1, input_filename, lineno);
current_binding_level = bl;
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);
+}