/* Forward declarations. */
-static tree grokparms (), grokdeclarator ();
-tree pushdecl ();
-tree builtin_function ();
-void shadow_tag_warned ();
-
-static tree lookup_tag ();
-static tree lookup_tag_reverse ();
-tree lookup_name_current_level ();
-static char *redeclaration_error_message ();
-static void layout_array_type ();
+static struct binding_level * make_binding_level PROTO((void));
+static void clear_limbo_values PROTO((tree));
+static int duplicate_decls PROTO((tree, tree, int));
+static char *redeclaration_error_message PROTO((tree, tree));
+static void storedecls PROTO((tree));
+static void storetags PROTO((tree));
+static tree lookup_tag PROTO((enum tree_code, tree,
+ struct binding_level *, int));
+static tree lookup_tag_reverse PROTO((tree));
+static tree grokdeclarator PROTO((tree, tree, enum decl_context,
+ int));
+static tree grokparms PROTO((tree, int));
+static int field_decl_cmp PROTO((tree *, tree *));
+static void layout_array_type PROTO((tree));
\f
/* C-specific option variables. */
keep_next_if_subblocks = 0;
}
+/* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */
+
+static void
+clear_limbo_values (block)
+ tree block;
+{
+ tree tem;
+
+ for (tem = BLOCK_VARS (block); tem; tem = TREE_CHAIN (tem))
+ if (DECL_NAME (tem) != 0)
+ IDENTIFIER_LIMBO_VALUE (DECL_NAME (tem)) = 0;
+
+ for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem))
+ clear_limbo_values (tem);
+}
+
/* Exit a binding level.
Pop the level off, and restore the state of the identifier-decl mappings
that were in effect when this level was entered.
if (functionbody)
{
+ clear_limbo_values (block);
+
/* If this is the top level block of a function,
the vars are the function's parameters.
Don't leave them in the BLOCK because they are
if (TREE_CODE (decl) == FUNCTION_DECL)
gen_aux_info_record (decl, 0, 0, TYPE_ARG_TYPES (TREE_TYPE (decl)) != 0);
- /* For C and Objective-C, we by default put things in .common when
- possible. */
- DECL_COMMON (decl) = 1;
+ /* ANSI specifies that a tentative definition which is not merged with
+ a non-tentative definition behaves exactly like a definition with an
+ initializer equal to zero. (Section 3.7.2)
+ -fno-common gives strict ANSI behavior. Usually you don't want it.
+ This matters only for variables with external linkage. */
+ if (! flag_no_common)
+ DECL_COMMON (decl) = 1;
/* Set attributes here so if duplicate decl, will have proper attributes. */
decl_attributes (decl, attributes, prefix_attributes);
ref = make_node (code);
pushtag (name, ref);
C_TYPE_BEING_DEFINED (ref) = 1;
+ TYPE_PACKED (ref) = flag_pack_struct;
return ref;
}
enum_next_value = integer_zero_node;
enum_overflow = 0;
+ if (flag_short_enums)
+ TYPE_PACKED (enumtype) = 1;
+
return enumtype;
}
highprec = min_precision (maxnode, TREE_UNSIGNED (enumtype));
precision = MAX (lowprec, highprec);
- if (flag_short_enums || TYPE_PACKED (enumtype)
- || precision > TYPE_PRECISION (integer_type_node))
- /* Use the width of the narrowest normal C type which is wide enough. */
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size (precision, 1));
+ if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
+ {
+ tree narrowest = type_for_size (precision, 1);
+ if (narrowest == 0)
+ {
+ warning ("enumeration values exceed range of largest integer");
+ narrowest = long_long_integer_type_node;
+ }
+
+ TYPE_PRECISION (enumtype) = TYPE_PRECISION (narrowest);
+ }
else
TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
if (void_at_end)
return saveable_tree_cons (parmdecls, nonparms,
- nreverse (saveable_tree_cons (NULL_TREE, void_type_node, types)));
+ nreverse (saveable_tree_cons (NULL_TREE,
+ void_type_node,
+ types)));
return saveable_tree_cons (parmdecls, nonparms, nreverse (types));
}