Commit 6645c3fa by Kazu Hirata Committed by Jeff Law

* c-decl.c: Fix formatting.

From-SVN: r35608
parent 7da92c08
2000-08-10 Kazu Hirata <kazu@hxi.com>
* c-decl.c: Fix formatting.
2000-08-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-08-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-lex.c (parse_float, yylex): For -Wtraditional, issue a * c-lex.c (parse_float, yylex): For -Wtraditional, issue a
......
...@@ -19,7 +19,6 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -19,7 +19,6 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
/* Process declarations and symbol lookup for C front end. /* Process declarations and symbol lookup for C front end.
Also constructs types; the standard scalar types at initialization, Also constructs types; the standard scalar types at initialization,
and structure, union, array and enum types when they are declared. */ and structure, union, array and enum types when they are declared. */
...@@ -227,7 +226,7 @@ struct binding_level ...@@ -227,7 +226,7 @@ struct binding_level
/* Nonzero means make a BLOCK if this level has any subblocks. */ /* Nonzero means make a BLOCK if this level has any subblocks. */
char keep_if_subblocks; char keep_if_subblocks;
/* Number of decls in `names' that have incomplete /* Number of decls in `names' that have incomplete
structure or union types. */ structure or union types. */
int n_incomplete; int n_incomplete;
...@@ -238,7 +237,7 @@ struct binding_level ...@@ -238,7 +237,7 @@ struct binding_level
}; };
#define NULL_BINDING_LEVEL (struct binding_level *) NULL #define NULL_BINDING_LEVEL (struct binding_level *) NULL
/* The binding level currently in effect. */ /* The binding level currently in effect. */
static struct binding_level *current_binding_level; static struct binding_level *current_binding_level;
...@@ -267,7 +266,7 @@ static int keep_next_level_flag; ...@@ -267,7 +266,7 @@ static int keep_next_level_flag;
if it has subblocks. */ if it has subblocks. */
static int keep_next_if_subblocks; static int keep_next_if_subblocks;
/* The chain of outer levels of label scopes. /* The chain of outer levels of label scopes.
This uses the same data structure used for binding levels, This uses the same data structure used for binding levels,
but it works differently: each link in the chain records but it works differently: each link in the chain records
...@@ -355,7 +354,7 @@ int flag_allow_single_precision = 0; ...@@ -355,7 +354,7 @@ int flag_allow_single_precision = 0;
int flag_signed_bitfields = 1; int flag_signed_bitfields = 1;
int explicit_flag_signed_bitfields = 0; int explicit_flag_signed_bitfields = 0;
/* Nonzero means warn about use of implicit int. */ /* Nonzero means warn about use of implicit int. */
int warn_implicit_int; int warn_implicit_int;
...@@ -364,7 +363,7 @@ int warn_implicit_int; ...@@ -364,7 +363,7 @@ int warn_implicit_int;
int warn_long_long = 1; int warn_long_long = 1;
/* Nonzero means message about use of implicit function declarations; /* Nonzero means message about use of implicit function declarations;
1 means warning; 2 means error. */ 1 means warning; 2 means error. */
int mesg_implicit_function_declaration = -1; int mesg_implicit_function_declaration = -1;
...@@ -385,7 +384,7 @@ int warn_cast_qual; ...@@ -385,7 +384,7 @@ int warn_cast_qual;
int warn_bad_function_cast; int warn_bad_function_cast;
/* Warn about functions which might be candidates for attribute noreturn. */ /* Warn about functions which might be candidates for attribute noreturn. */
int warn_missing_noreturn; int warn_missing_noreturn;
...@@ -452,14 +451,14 @@ int warn_main; ...@@ -452,14 +451,14 @@ int warn_main;
/* Warn about #pragma directives that are not recognised. */ /* Warn about #pragma directives that are not recognised. */
int warn_unknown_pragmas = 0; /* Tri state variable. */ int warn_unknown_pragmas = 0; /* Tri state variable. */
/* Warn about comparison of signed and unsigned values. /* Warn about comparison of signed and unsigned values.
If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */ If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */
int warn_sign_compare = -1; int warn_sign_compare = -1;
/* Warn about testing equality of floating point numbers. */ /* Warn about testing equality of floating point numbers. */
int warn_float_equal = 0; int warn_float_equal = 0;
...@@ -467,7 +466,7 @@ int warn_float_equal = 0; ...@@ -467,7 +466,7 @@ int warn_float_equal = 0;
int warn_multichar = 1; int warn_multichar = 1;
/* Wrapper since C and C++ expand_expr_stmt are different. */ /* Wrapper since C and C++ expand_expr_stmt are different. */
expand_expr_stmt_fn lang_expand_expr_stmt = c_expand_expr_stmt; expand_expr_stmt_fn lang_expand_expr_stmt = c_expand_expr_stmt;
...@@ -485,7 +484,7 @@ int dollars_in_ident = DOLLARS_IN_IDENTIFIERS; ...@@ -485,7 +484,7 @@ int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
/* Decode the string P as a language-specific option for C. /* Decode the string P as a language-specific option for C.
Return the number of strings consumed. Should not complain Return the number of strings consumed. Should not complain
if it does not recognise the option. */ if it does not recognise the option. */
int int
c_decode_option (argc, argv) c_decode_option (argc, argv)
int argc ATTRIBUTE_UNUSED; int argc ATTRIBUTE_UNUSED;
...@@ -659,7 +658,7 @@ c_decode_option (argc, argv) ...@@ -659,7 +658,7 @@ c_decode_option (argc, argv)
{ {
warn_implicit_int = 1; warn_implicit_int = 1;
if (mesg_implicit_function_declaration != 2) if (mesg_implicit_function_declaration != 2)
mesg_implicit_function_declaration = 1; mesg_implicit_function_declaration = 1;
} }
else if (!strcmp (p, "-Wno-implicit")) else if (!strcmp (p, "-Wno-implicit"))
warn_implicit_int = 0, mesg_implicit_function_declaration = 0; warn_implicit_int = 0, mesg_implicit_function_declaration = 0;
...@@ -841,7 +840,7 @@ print_lang_identifier (file, node, indent) ...@@ -841,7 +840,7 @@ print_lang_identifier (file, node, indent)
/* Hook called at end of compilation to assume 1 elt /* Hook called at end of compilation to assume 1 elt
for a top-level array decl that wasn't complete before. */ for a top-level array decl that wasn't complete before. */
void void
finish_incomplete_decl (decl) finish_incomplete_decl (decl)
tree decl; tree decl;
...@@ -865,8 +864,7 @@ finish_incomplete_decl (decl) ...@@ -865,8 +864,7 @@ finish_incomplete_decl (decl)
/* Create a new `struct binding_level'. */ /* Create a new `struct binding_level'. */
static static struct binding_level *
struct binding_level *
make_binding_level () make_binding_level ()
{ {
/* NOSTRICT */ /* NOSTRICT */
...@@ -967,7 +965,7 @@ pushlevel (tag_transparent) ...@@ -967,7 +965,7 @@ pushlevel (tag_transparent)
keep_next_if_subblocks = 0; keep_next_if_subblocks = 0;
} }
/* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */ /* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */
static void static void
clear_limbo_values (block) clear_limbo_values (block)
...@@ -982,7 +980,7 @@ clear_limbo_values (block) ...@@ -982,7 +980,7 @@ clear_limbo_values (block)
for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem)) for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem))
clear_limbo_values (tem); clear_limbo_values (tem);
} }
/* Exit a binding level. /* Exit a binding level.
Pop the level off, and restore the state of the identifier-decl mappings Pop the level off, and restore the state of the identifier-decl mappings
that were in effect when this level was entered. that were in effect when this level was entered.
...@@ -1183,8 +1181,8 @@ poplevel (keep, reverse, functionbody) ...@@ -1183,8 +1181,8 @@ poplevel (keep, reverse, functionbody)
else if (block) else if (block)
{ {
if (!block_previously_created) if (!block_previously_created)
current_binding_level->blocks current_binding_level->blocks
= chainon (current_binding_level->blocks, block); = chainon (current_binding_level->blocks, block);
} }
/* If we did not make a block for the level just exited, /* If we did not make a block for the level just exited,
any blocks made for inner levels any blocks made for inner levels
...@@ -1207,8 +1205,7 @@ poplevel (keep, reverse, functionbody) ...@@ -1207,8 +1205,7 @@ poplevel (keep, reverse, functionbody)
cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set
in `grokdeclarator' as soon as we have created the FUNCTION_TYPE in `grokdeclarator' as soon as we have created the FUNCTION_TYPE
node which will represent the "scope" for these "parameter list local" node which will represent the "scope" for these "parameter list local"
tagged types. tagged types. */
*/
if (functionbody) if (functionbody)
for (link = tags; link; link = TREE_CHAIN (link)) for (link = tags; link; link = TREE_CHAIN (link))
...@@ -1318,7 +1315,7 @@ pop_label_level () ...@@ -1318,7 +1315,7 @@ pop_label_level ()
DECL_NAME (TREE_VALUE (link))); DECL_NAME (TREE_VALUE (link)));
} }
else if (warn_unused_label && !TREE_USED (TREE_VALUE (link))) else if (warn_unused_label && !TREE_USED (TREE_VALUE (link)))
warning_with_decl (TREE_VALUE (link), warning_with_decl (TREE_VALUE (link),
"label `%s' defined but not used"); "label `%s' defined but not used");
IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) = 0; IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) = 0;
...@@ -1418,7 +1415,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1418,7 +1415,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
if (DECL_P (olddecl)) if (DECL_P (olddecl))
DECL_MACHINE_ATTRIBUTES (newdecl) DECL_MACHINE_ATTRIBUTES (newdecl)
= merge_machine_decl_attributes (olddecl, newdecl); = merge_machine_decl_attributes (olddecl, newdecl);
if (TREE_CODE (newtype) == ERROR_MARK if (TREE_CODE (newtype) == ERROR_MARK
|| TREE_CODE (oldtype) == ERROR_MARK) || TREE_CODE (oldtype) == ERROR_MARK)
...@@ -1456,7 +1453,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1456,7 +1453,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
"built-in function `%s' declared as non-function"); "built-in function `%s' declared as non-function");
else else
warning_with_decl (newdecl, warning_with_decl (newdecl,
"built-in function `%s' declared as non-function"); "built-in function `%s' declared as non-function");
} }
else else
{ {
...@@ -1500,18 +1497,18 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1500,18 +1497,18 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
} }
else if (!types_match) else if (!types_match)
{ {
/* Accept the return type of the new declaration if same modes. */ /* Accept the return type of the new declaration if same modes. */
tree oldreturntype = TREE_TYPE (oldtype); tree oldreturntype = TREE_TYPE (oldtype);
tree newreturntype = TREE_TYPE (newtype); tree newreturntype = TREE_TYPE (newtype);
if (TYPE_MODE (oldreturntype) == TYPE_MODE (newreturntype)) if (TYPE_MODE (oldreturntype) == TYPE_MODE (newreturntype))
{ {
/* Function types may be shared, so we can't just modify /* Function types may be shared, so we can't just modify
the return type of olddecl's function type. */ the return type of olddecl's function type. */
tree trytype tree trytype
= build_function_type (newreturntype, = build_function_type (newreturntype,
TYPE_ARG_TYPES (oldtype)); TYPE_ARG_TYPES (oldtype));
types_match = comptypes (newtype, trytype); types_match = comptypes (newtype, trytype);
if (types_match) if (types_match)
oldtype = trytype; oldtype = trytype;
...@@ -1529,11 +1526,11 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1529,11 +1526,11 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
the return type of olddecl's function type. */ the return type of olddecl's function type. */
tree trytype tree trytype
= build_function_type (TREE_TYPE (oldtype), = build_function_type (TREE_TYPE (oldtype),
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
TREE_VALUE (TYPE_ARG_TYPES (newtype)), TREE_VALUE (TYPE_ARG_TYPES (newtype)),
TREE_CHAIN (TYPE_ARG_TYPES (oldtype)))); TREE_CHAIN (TYPE_ARG_TYPES (oldtype))));
types_match = comptypes (newtype, trytype); types_match = comptypes (newtype, trytype);
if (types_match) if (types_match)
oldtype = trytype; oldtype = trytype;
} }
...@@ -1668,11 +1665,11 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1668,11 +1665,11 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
: "`%s' previously declared here")); : "`%s' previously declared here"));
} }
else if (TREE_CODE (newdecl) == TYPE_DECL else if (TREE_CODE (newdecl) == TYPE_DECL
&& (DECL_IN_SYSTEM_HEADER (olddecl) && (DECL_IN_SYSTEM_HEADER (olddecl)
|| DECL_IN_SYSTEM_HEADER (newdecl))) || DECL_IN_SYSTEM_HEADER (newdecl)))
{ {
warning_with_decl (newdecl, "redefinition of `%s'"); warning_with_decl (newdecl, "redefinition of `%s'");
warning_with_decl warning_with_decl
(olddecl, (olddecl,
((DECL_INITIAL (olddecl) ((DECL_INITIAL (olddecl)
&& current_binding_level == global_binding_level) && current_binding_level == global_binding_level)
...@@ -1705,7 +1702,8 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1705,7 +1702,8 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node
|| TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node) || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
{ {
error_with_decl (newdecl, "prototype for `%s' follows and number of arguments doesn't match"); error_with_decl (newdecl,
"prototype for `%s' follows and number of arguments doesn't match");
error_with_decl (olddecl, "non-prototype definition here"); error_with_decl (olddecl, "non-prototype definition here");
errmsg = 1; errmsg = 1;
break; break;
...@@ -1752,7 +1750,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1752,7 +1750,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
warning_with_decl (newdecl, "static declaration for `%s' follows non-static"); warning_with_decl (newdecl, "static declaration for `%s' follows non-static");
/* If warn_traditional, warn when a non-static function /* If warn_traditional, warn when a non-static function
declaration follows a static one. */ declaration follows a static one. */
if (warn_traditional if (warn_traditional
&& TREE_CODE (olddecl) == FUNCTION_DECL && TREE_CODE (olddecl) == FUNCTION_DECL
&& !TREE_PUBLIC (olddecl) && !TREE_PUBLIC (olddecl)
...@@ -1924,7 +1922,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -1924,7 +1922,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
} }
/* Merge the storage class information. */ /* Merge the storage class information. */
DECL_WEAK (newdecl) |= DECL_WEAK (olddecl); DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
/* For functions, static overrides non-static. */ /* For functions, static overrides non-static. */
if (TREE_CODE (newdecl) == FUNCTION_DECL) if (TREE_CODE (newdecl) == FUNCTION_DECL)
{ {
...@@ -2172,23 +2170,23 @@ pushdecl (x) ...@@ -2172,23 +2170,23 @@ pushdecl (x)
on a standard type by checking the current value of lineno. */ on a standard type by checking the current value of lineno. */
if (TREE_CODE (x) == TYPE_DECL) if (TREE_CODE (x) == TYPE_DECL)
{ {
if (DECL_SOURCE_LINE (x) == 0) if (DECL_SOURCE_LINE (x) == 0)
{ {
if (TYPE_NAME (TREE_TYPE (x)) == 0) if (TYPE_NAME (TREE_TYPE (x)) == 0)
TYPE_NAME (TREE_TYPE (x)) = x; TYPE_NAME (TREE_TYPE (x)) = x;
} }
else if (TREE_TYPE (x) != error_mark_node else if (TREE_TYPE (x) != error_mark_node
&& DECL_ORIGINAL_TYPE (x) == NULL_TREE) && DECL_ORIGINAL_TYPE (x) == NULL_TREE)
{ {
tree tt = TREE_TYPE (x); tree tt = TREE_TYPE (x);
DECL_ORIGINAL_TYPE (x) = tt; DECL_ORIGINAL_TYPE (x) = tt;
tt = build_type_copy (tt); tt = build_type_copy (tt);
TYPE_NAME (tt) = x; TYPE_NAME (tt) = x;
TREE_USED (tt) = TREE_USED (x); TREE_USED (tt) = TREE_USED (x);
TREE_TYPE (x) = tt; TREE_TYPE (x) = tt;
} }
} }
/* Multiple external decls of the same identifier ought to match. /* Multiple external decls of the same identifier ought to match.
Check against both global declarations (when traditional) and out of Check against both global declarations (when traditional) and out of
...@@ -2273,7 +2271,7 @@ pushdecl (x) ...@@ -2273,7 +2271,7 @@ pushdecl (x)
if (b == global_binding_level) if (b == global_binding_level)
{ {
/* Install a global value. */ /* Install a global value. */
/* If the first global decl has external linkage, /* If the first global decl has external linkage,
warn if we later see static one. */ warn if we later see static one. */
if (IDENTIFIER_GLOBAL_VALUE (name) == 0 && TREE_PUBLIC (x)) if (IDENTIFIER_GLOBAL_VALUE (name) == 0 && TREE_PUBLIC (x))
...@@ -2379,7 +2377,8 @@ pushdecl (x) ...@@ -2379,7 +2377,8 @@ pushdecl (x)
} }
} }
#if 0 /* This case is probably sometimes the right thing to do. */ #if 0
/* This case is probably sometimes the right thing to do. */
/* If we have a local external declaration, /* If we have a local external declaration,
then any file-scope declaration should not then any file-scope declaration should not
have been static. */ have been static. */
...@@ -2398,7 +2397,7 @@ pushdecl (x) ...@@ -2398,7 +2397,7 @@ pushdecl (x)
&& TREE_PUBLIC (x)) && TREE_PUBLIC (x))
{ {
if (oldglobal == 0) if (oldglobal == 0)
TREE_PUBLIC (name) = 1; TREE_PUBLIC (name) = 1;
/* Save this decl, so that we can do type checking against /* Save this decl, so that we can do type checking against
other decls after it falls out of scope. other decls after it falls out of scope.
...@@ -2508,9 +2507,11 @@ implicitly_declare (functionid) ...@@ -2508,9 +2507,11 @@ implicitly_declare (functionid)
/* We used to reuse an old implicit decl here, /* We used to reuse an old implicit decl here,
but this loses with inline functions because it can clobber but this loses with inline functions because it can clobber
the saved decl chains. */ the saved decl chains. */
/* if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0) #if 0
if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0)
decl = IDENTIFIER_IMPLICIT_DECL (functionid); decl = IDENTIFIER_IMPLICIT_DECL (functionid);
else */ else
#endif
decl = build_decl (FUNCTION_DECL, functionid, default_function_type); decl = build_decl (FUNCTION_DECL, functionid, default_function_type);
/* Warn of implicit decl following explicit local extern decl. /* Warn of implicit decl following explicit local extern decl.
...@@ -2582,7 +2583,7 @@ redeclaration_error_message (newdecl, olddecl) ...@@ -2582,7 +2583,7 @@ redeclaration_error_message (newdecl, olddecl)
is equivalent to what this code used to do before the build_type_copy is equivalent to what this code used to do before the build_type_copy
call. The variant type distinction should not matter for traditional call. The variant type distinction should not matter for traditional
code, because it doesn't have type qualifiers. */ code, because it doesn't have type qualifiers. */
if (flag_traditional if (flag_traditional
&& TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl)) && TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl))
return 0; return 0;
if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl)) if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl))
...@@ -2706,7 +2707,7 @@ shadow_label (name) ...@@ -2706,7 +2707,7 @@ shadow_label (name)
for (dup = named_labels; dup; dup = TREE_CHAIN (dup)) for (dup = named_labels; dup; dup = TREE_CHAIN (dup))
if (TREE_VALUE (dup) == decl) if (TREE_VALUE (dup) == decl)
{ {
error ("duplicate label declaration `%s'", error ("duplicate label declaration `%s'",
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
error_with_decl (TREE_VALUE (dup), error_with_decl (TREE_VALUE (dup),
"this is a previous declaration"); "this is a previous declaration");
...@@ -2744,7 +2745,7 @@ define_label (filename, line, name) ...@@ -2744,7 +2745,7 @@ define_label (filename, line, name)
if (warn_traditional && lookup_name (name)) if (warn_traditional && lookup_name (name))
warning ("traditional C lacks a separate namespace for labels, identifier `%s' conflicts", warning ("traditional C lacks a separate namespace for labels, identifier `%s' conflicts",
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
if (DECL_INITIAL (decl) != 0) if (DECL_INITIAL (decl) != 0)
{ {
error ("duplicate label `%s'", IDENTIFIER_POINTER (name)); error ("duplicate label `%s'", IDENTIFIER_POINTER (name));
...@@ -2920,7 +2921,7 @@ lookup_name_current_level (name) ...@@ -2920,7 +2921,7 @@ lookup_name_current_level (name)
/* Mark ARG for GC. */ /* Mark ARG for GC. */
static void static void
mark_binding_level (arg) mark_binding_level (arg)
void *arg; void *arg;
{ {
...@@ -2955,7 +2956,9 @@ init_decl_processing () ...@@ -2955,7 +2956,9 @@ init_decl_processing ()
named_labels = NULL; named_labels = NULL;
current_binding_level = NULL_BINDING_LEVEL; current_binding_level = NULL_BINDING_LEVEL;
free_binding_level = NULL_BINDING_LEVEL; free_binding_level = NULL_BINDING_LEVEL;
pushlevel (0); /* make the binding_level structure for global names */
/* Make the binding_level structure for global names. */
pushlevel (0);
global_binding_level = current_binding_level; global_binding_level = current_binding_level;
build_common_tree_nodes (flag_signed_char); build_common_tree_nodes (flag_signed_char);
...@@ -3006,17 +3009,17 @@ init_decl_processing () ...@@ -3006,17 +3009,17 @@ init_decl_processing ()
signed_size_type_node = signed_type (t); signed_size_type_node = signed_type (t);
if (flag_traditional && TREE_UNSIGNED (t)) if (flag_traditional && TREE_UNSIGNED (t))
t = signed_type (t); t = signed_type (t);
set_sizetype (t); set_sizetype (t);
/* Create the widest literal types. */ /* Create the widest literal types. */
widest_integer_literal_type_node widest_integer_literal_type_node
= make_signed_type (HOST_BITS_PER_WIDE_INT * 2); = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
widest_unsigned_literal_type_node widest_unsigned_literal_type_node
= make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2); = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
pushdecl (build_decl (TYPE_DECL, NULL_TREE, pushdecl (build_decl (TYPE_DECL, NULL_TREE,
widest_integer_literal_type_node)); widest_integer_literal_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, pushdecl (build_decl (TYPE_DECL, NULL_TREE,
widest_unsigned_literal_type_node)); widest_unsigned_literal_type_node));
build_common_tree_nodes_2 (flag_short_double); build_common_tree_nodes_2 (flag_short_double);
...@@ -3050,7 +3053,8 @@ init_decl_processing () ...@@ -3050,7 +3053,8 @@ init_decl_processing ()
signed_wchar_type_node = signed_type (wchar_type_node); signed_wchar_type_node = signed_type (wchar_type_node);
unsigned_wchar_type_node = unsigned_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))); wint_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WINT_TYPE)));
boolean_type_node = integer_type_node; boolean_type_node = integer_type_node;
boolean_true_node = integer_one_node; boolean_true_node = integer_one_node;
...@@ -3070,8 +3074,7 @@ init_decl_processing () ...@@ -3070,8 +3074,7 @@ init_decl_processing ()
/* make a type for arrays of characters. /* make a type for arrays of characters.
With luck nothing will ever really depend on the length of this With luck nothing will ever really depend on the length of this
array type. */ array type. */
char_array_type_node char_array_type_node = build_array_type (char_type_node, array_domain_type);
= build_array_type (char_type_node, array_domain_type);
/* Likewise for arrays of ints. */ /* Likewise for arrays of ints. */
int_array_type_node int_array_type_node
...@@ -3083,8 +3086,7 @@ init_decl_processing () ...@@ -3083,8 +3086,7 @@ init_decl_processing ()
void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE); void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
default_function_type default_function_type = build_function_type (integer_type_node, NULL_TREE);
= build_function_type (integer_type_node, NULL_TREE);
ptrdiff_type_node ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node); unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
...@@ -3098,7 +3100,7 @@ init_decl_processing () ...@@ -3098,7 +3100,7 @@ init_decl_processing ()
tree_cons (NULL_TREE, ptr_type_node, endlink)); tree_cons (NULL_TREE, ptr_type_node, endlink));
/* Types which are common to the fortran compiler and libf2c. When /* Types which are common to the fortran compiler and libf2c. When
changing these, you also need to be concerned with f/com.h. */ changing these, you also need to be concerned with f/com.h. */
if (TYPE_PRECISION (float_type_node) if (TYPE_PRECISION (float_type_node)
== TYPE_PRECISION (long_integer_type_node)) == TYPE_PRECISION (long_integer_type_node))
...@@ -3172,7 +3174,7 @@ init_decl_processing () ...@@ -3172,7 +3174,7 @@ init_decl_processing ()
tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
type_for_mode (ptr_mode, 0), type_for_mode (ptr_mode, 0),
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
ptr_type_node, ptr_type_node,
endlink)))), endlink)))),
BUILT_IN_EH_RETURN, BUILT_IN_NORMAL, NULL_PTR); BUILT_IN_EH_RETURN, BUILT_IN_NORMAL, NULL_PTR);
...@@ -3238,7 +3240,7 @@ c_make_fname_decl (id, name, type_dep) ...@@ -3238,7 +3240,7 @@ c_make_fname_decl (id, name, type_dep)
TREE_TYPE (init) = type; TREE_TYPE (init) = type;
DECL_INITIAL (decl) = init; DECL_INITIAL (decl) = init;
finish_decl (pushdecl (decl), init, NULL_TREE); finish_decl (pushdecl (decl), init, NULL_TREE);
return decl; return decl;
} }
...@@ -3418,7 +3420,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -3418,7 +3420,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
NORMAL, initialized); NORMAL, initialized);
register tree tem; register tree tem;
if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "main")) && !strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "main"))
warning_with_decl (decl, "`%s' is usually a function"); warning_with_decl (decl, "`%s' is usually a function");
...@@ -3483,7 +3485,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -3483,7 +3485,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
if (initialized) if (initialized)
{ {
#if 0 /* Seems redundant with grokdeclarator. */ #if 0
/* Seems redundant with grokdeclarator. */
if (current_binding_level != global_binding_level if (current_binding_level != global_binding_level
&& DECL_EXTERNAL (decl) && DECL_EXTERNAL (decl)
&& TREE_CODE (decl) != FUNCTION_DECL) && TREE_CODE (decl) != FUNCTION_DECL)
...@@ -3669,7 +3672,7 @@ finish_decl (decl, init, asmspec_tree) ...@@ -3669,7 +3672,7 @@ finish_decl (decl, init, asmspec_tree)
error_with_decl (decl, "storage size of `%s' isn't constant"); error_with_decl (decl, "storage size of `%s' isn't constant");
} }
if (TREE_USED (type)) if (TREE_USED (type))
TREE_USED (decl) = 1; TREE_USED (decl) = 1;
} }
...@@ -3677,11 +3680,11 @@ finish_decl (decl, init, asmspec_tree) ...@@ -3677,11 +3680,11 @@ finish_decl (decl, init, asmspec_tree)
builtin any more. Also reset DECL_RTL so we can give it its new builtin any more. Also reset DECL_RTL so we can give it its new
name. */ name. */
if (TREE_CODE (decl) == FUNCTION_DECL && asmspec) if (TREE_CODE (decl) == FUNCTION_DECL && asmspec)
{ {
DECL_BUILT_IN_CLASS (decl) = NOT_BUILT_IN; DECL_BUILT_IN_CLASS (decl) = NOT_BUILT_IN;
DECL_RTL (decl) = 0; DECL_RTL (decl) = 0;
DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec); DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
} }
/* Output the assembler code and/or RTL code for variables and functions, /* Output the assembler code and/or RTL code for variables and functions,
unless the type is an undefined structure or union. unless the type is an undefined structure or union.
...@@ -3765,7 +3768,8 @@ push_parm_decl (parm) ...@@ -3765,7 +3768,8 @@ push_parm_decl (parm)
tree olddecl; tree olddecl;
olddecl = lookup_name (DECL_NAME (decl)); olddecl = lookup_name (DECL_NAME (decl));
if (pedantic && olddecl != 0 && TREE_CODE (olddecl) == TYPE_DECL) if (pedantic && olddecl != 0 && TREE_CODE (olddecl) == TYPE_DECL)
pedwarn_with_decl (decl, "ANSI C forbids parameter `%s' shadowing typedef"); pedwarn_with_decl (decl,
"ANSI C forbids parameter `%s' shadowing typedef");
} }
#endif #endif
...@@ -3997,7 +4001,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -3997,7 +4001,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
{ {
if (ridpointers[i] == id) if (ridpointers[i] == id)
{ {
if (i == (int) RID_LONG && specbits & (1<<i)) if (i == (int) RID_LONG && specbits & (1 << i))
{ {
if (longlong) if (longlong)
error ("`long long long' is too long for GCC"); error ("`long long long' is too long for GCC");
...@@ -4021,7 +4025,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4021,7 +4025,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
else if (TREE_CODE (id) == TYPE_DECL) else if (TREE_CODE (id) == TYPE_DECL)
{ {
type = TREE_TYPE (id); type = TREE_TYPE (id);
decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id); decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id);
typedef_decl = id; typedef_decl = id;
} }
/* Built-in types come as identifiers. */ /* Built-in types come as identifiers. */
...@@ -4042,7 +4046,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4042,7 +4046,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
else if (TREE_CODE (id) != ERROR_MARK) else if (TREE_CODE (id) != ERROR_MARK)
type = id; type = id;
found: {} found:
;
} }
typedef_type = type; typedef_type = type;
...@@ -4067,7 +4072,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4067,7 +4072,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if ((warn_implicit_int || warn_return_type) && funcdef_flag) if ((warn_implicit_int || warn_return_type) && funcdef_flag)
warn_about_return_type = 1; warn_about_return_type = 1;
else if (warn_implicit_int || flag_isoc99) else if (warn_implicit_int || flag_isoc99)
pedwarn_c99 ("type defaults to `int' in declaration of `%s'", name); pedwarn_c99 ("type defaults to `int' in declaration of `%s'",
name);
} }
defaulted_int = 1; defaulted_int = 1;
...@@ -4082,7 +4088,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4082,7 +4088,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if ((specbits & 1 << (int) RID_LONG) && ! longlong if ((specbits & 1 << (int) RID_LONG) && ! longlong
&& TYPE_MAIN_VARIANT (type) == double_type_node) && TYPE_MAIN_VARIANT (type) == double_type_node)
{ {
specbits &= ~ (1 << (int) RID_LONG); specbits &= ~(1 << (int) RID_LONG);
type = long_double_type_node; type = long_double_type_node;
} }
...@@ -4143,7 +4149,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4143,7 +4149,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
&& TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE) && TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE)
{ {
error ("complex invalid for `%s'", name); error ("complex invalid for `%s'", name);
specbits &= ~ (1 << (int) RID_COMPLEX); specbits &= ~(1 << (int) RID_COMPLEX);
} }
/* Decide whether an integer type is signed or not. /* Decide whether an integer type is signed or not.
...@@ -4259,8 +4265,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4259,8 +4265,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
error ("function definition declared `register'"); error ("function definition declared `register'");
if (specbits & 1 << (int) RID_TYPEDEF) if (specbits & 1 << (int) RID_TYPEDEF)
error ("function definition declared `typedef'"); error ("function definition declared `typedef'");
specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER) specbits &= ~((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
| (1 << (int) RID_AUTO)); | (1 << (int) RID_AUTO));
} }
else if (decl_context != NORMAL && nclasses > 0) else if (decl_context != NORMAL && nclasses > 0)
{ {
...@@ -4271,7 +4277,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4271,7 +4277,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
switch (decl_context) switch (decl_context)
{ {
case FIELD: case FIELD:
error ("storage class specified for structure field `%s'", name); error ("storage class specified for structure field `%s'",
name);
break; break;
case PARM: case PARM:
error ("storage class specified for parameter `%s'", name); error ("storage class specified for parameter `%s'", name);
...@@ -4280,9 +4287,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4280,9 +4287,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
error ("storage class specified for typename"); error ("storage class specified for typename");
break; break;
} }
specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER) specbits &= ~((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
| (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC) | (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC)
| (1 << (int) RID_EXTERN)); | (1 << (int) RID_EXTERN));
} }
} }
else if (specbits & 1 << (int) RID_EXTERN && initialized && ! funcdef_flag) else if (specbits & 1 << (int) RID_EXTERN && initialized && ! funcdef_flag)
...@@ -4405,9 +4412,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4405,9 +4412,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if (pedantic) if (pedantic)
{ {
if (TREE_CONSTANT (size)) if (TREE_CONSTANT (size))
pedwarn ("ISO C89 forbids array `%s' whose size can't be evaluated", name); pedwarn ("ISO C89 forbids array `%s' whose size can't be evaluated",
name);
else else
pedwarn ("ISO C89 forbids variable-size array `%s'", name); pedwarn ("ISO C89 forbids variable-size array `%s'",
name);
} }
} }
...@@ -4434,8 +4443,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4434,8 +4443,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
itype = build_index_type (itype); itype = build_index_type (itype);
} }
#if 0 /* This had bad results for pointers to arrays, as in #if 0
union incomplete (*foo)[4]; */ /* This had bad results for pointers to arrays, as in
union incomplete (*foo)[4]; */
/* Complain about arrays of incomplete types, except in typedefs. */ /* Complain about arrays of incomplete types, except in typedefs. */
if (!COMPLETE_TYPE_P (type) if (!COMPLETE_TYPE_P (type)
...@@ -4446,8 +4456,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4446,8 +4456,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
warning ("array type has incomplete element type"); warning ("array type has incomplete element type");
#endif #endif
#if 0 /* We shouldn't have a function type here at all! #if 0
Functions aren't allowed as array elements. */ /* We shouldn't have a function type here at all!
Functions aren't allowed as array elements. */
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
&& (constp || volatilep)) && (constp || volatilep))
pedwarn ("ANSI C forbids const or volatile function types"); pedwarn ("ANSI C forbids const or volatile function types");
...@@ -4462,8 +4473,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4462,8 +4473,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if (type_quals) if (type_quals)
type = c_build_qualified_type (type, type_quals); type = c_build_qualified_type (type, type_quals);
#if 0 /* don't clear these; leave them set so that the array type #if 0
or the variable is itself const or volatile. */ /* Don't clear these; leave them set so that the array type
or the variable is itself const or volatile. */
type_quals = TYPE_UNQUALIFIED; type_quals = TYPE_UNQUALIFIED;
#endif #endif
...@@ -4745,7 +4757,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4745,7 +4757,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
type = build_array_type (c_build_qualified_type (TREE_TYPE (type), type = build_array_type (c_build_qualified_type (TREE_TYPE (type),
type_quals), type_quals),
TYPE_DOMAIN (type)); TYPE_DOMAIN (type));
#if 0 /* Leave the field const or volatile as well. */ #if 0
/* Leave the field const or volatile as well. */
type_quals = TYPE_UNQUALIFIED; type_quals = TYPE_UNQUALIFIED;
#endif #endif
} }
...@@ -4957,8 +4970,10 @@ grokparms (parms_info, funcdef_flag) ...@@ -4957,8 +4970,10 @@ grokparms (parms_info, funcdef_flag)
TREE_TYPE (parm) = error_mark_node; TREE_TYPE (parm) = error_mark_node;
} }
} }
#if 0 /* This has been replaced by parm_tags_warning #if 0
which uses a more accurate criterion for what to warn about. */ /* This has been replaced by parm_tags_warning, which
uses a more accurate criterion for what to warn
about. */
else else
{ {
/* Now warn if is a pointer to an incomplete type. */ /* Now warn if is a pointer to an incomplete type. */
...@@ -4979,11 +4994,10 @@ grokparms (parms_info, funcdef_flag) ...@@ -4979,11 +4994,10 @@ grokparms (parms_info, funcdef_flag)
typelt = TREE_CHAIN (typelt); typelt = TREE_CHAIN (typelt);
} }
return first_parm; return first_parm;
} }
} }
/* Return a tree_list node with info on a parameter list just parsed. /* Return a tree_list node with info on a parameter list just parsed.
The TREE_PURPOSE is a chain of decls of those parms. The TREE_PURPOSE is a chain of decls of those parms.
The TREE_VALUE is a list of structure, union and enum tags defined. The TREE_VALUE is a list of structure, union and enum tags defined.
...@@ -5009,8 +5023,7 @@ get_parm_info (void_at_end) ...@@ -5009,8 +5023,7 @@ get_parm_info (void_at_end)
But if the `void' is qualified (by `const' or `volatile') or has a But if the `void' is qualified (by `const' or `volatile') or has a
storage class specifier (`register'), then the behavior is undefined; storage class specifier (`register'), then the behavior is undefined;
by not counting it as the special case of `void' we will cause an by not counting it as the special case of `void' we will cause an
error later. Typedefs for `void' are OK (see DR#157). error later. Typedefs for `void' are OK (see DR#157). */
*/
if (void_at_end && parms != 0 if (void_at_end && parms != 0
&& TREE_CHAIN (parms) == 0 && TREE_CHAIN (parms) == 0
&& VOID_TYPE_P (TREE_TYPE (parms)) && VOID_TYPE_P (TREE_TYPE (parms))
...@@ -5027,7 +5040,7 @@ get_parm_info (void_at_end) ...@@ -5027,7 +5040,7 @@ get_parm_info (void_at_end)
/* Extract enumerator values and other non-parms declared with the parms. /* Extract enumerator values and other non-parms declared with the parms.
Likewise any forward parm decls that didn't have real parm decls. */ Likewise any forward parm decls that didn't have real parm decls. */
for (decl = parms; decl; ) for (decl = parms; decl;)
{ {
tree next = TREE_CHAIN (decl); tree next = TREE_CHAIN (decl);
...@@ -5038,7 +5051,8 @@ get_parm_info (void_at_end) ...@@ -5038,7 +5051,8 @@ get_parm_info (void_at_end)
} }
else if (TREE_ASM_WRITTEN (decl)) else if (TREE_ASM_WRITTEN (decl))
{ {
error_with_decl (decl, "parameter `%s' has just a forward declaration"); error_with_decl (decl,
"parameter `%s' has just a forward declaration");
TREE_CHAIN (decl) = new_parms; TREE_CHAIN (decl) = new_parms;
new_parms = decl; new_parms = decl;
} }
...@@ -5115,13 +5129,13 @@ parmlist_tags_warning () ...@@ -5115,13 +5129,13 @@ parmlist_tags_warning ()
: "enum"), : "enum"),
IDENTIFIER_POINTER (TREE_PURPOSE (elt))); IDENTIFIER_POINTER (TREE_PURPOSE (elt)));
else else
{ {
/* For translation these need to be seperate warnings */ /* For translation these need to be seperate warnings */
if (code == RECORD_TYPE) if (code == RECORD_TYPE)
warning ("anonymous struct declared inside parameter list"); warning ("anonymous struct declared inside parameter list");
else if (code == UNION_TYPE) else if (code == UNION_TYPE)
warning ("anonymous union declared inside parameter list"); warning ("anonymous union declared inside parameter list");
else else
warning ("anonymous enum declared inside parameter list"); warning ("anonymous enum declared inside parameter list");
} }
if (! already) if (! already)
...@@ -5362,7 +5376,7 @@ finish_struct (t, fieldlist, attributes) ...@@ -5362,7 +5376,7 @@ finish_struct (t, fieldlist, attributes)
{ {
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0) if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
error_with_decl (x, "negative width in bit-field `%s'"); error_with_decl (x, "negative width in bit-field `%s'");
else if (0 < compare_tree_int (DECL_INITIAL (x), else if (0 < compare_tree_int (DECL_INITIAL (x),
TYPE_PRECISION (TREE_TYPE (x)))) TYPE_PRECISION (TREE_TYPE (x))))
pedwarn_with_decl (x, "width of `%s' exceeds its type"); pedwarn_with_decl (x, "width of `%s' exceeds its type");
else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0) else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0)
...@@ -5426,7 +5440,7 @@ finish_struct (t, fieldlist, attributes) ...@@ -5426,7 +5440,7 @@ finish_struct (t, fieldlist, attributes)
else else
{ {
register tree y = fieldlist; register tree y = fieldlist;
while (1) while (1)
{ {
if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x))) if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x)))
...@@ -5440,7 +5454,8 @@ finish_struct (t, fieldlist, attributes) ...@@ -5440,7 +5454,8 @@ finish_struct (t, fieldlist, attributes)
error_with_decl (TREE_CHAIN (x), "duplicate member `%s'"); error_with_decl (TREE_CHAIN (x), "duplicate member `%s'");
TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x)); TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));
} }
else x = TREE_CHAIN (x); else
x = TREE_CHAIN (x);
} }
/* Now we have the nearly final fieldlist. Record it, /* Now we have the nearly final fieldlist. Record it,
...@@ -5876,7 +5891,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5876,7 +5891,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
&& old_decl != 0 && TREE_USED (old_decl) && old_decl != 0 && TREE_USED (old_decl)
&& TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0) && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
warning_with_decl (decl1, warning_with_decl (decl1,
"`%s' was used with no prototype before its definition"); "`%s' was used with no prototype before its definition");
/* Optionally warn of any global def with no previous declaration. */ /* Optionally warn of any global def with no previous declaration. */
else if (warn_missing_declarations else if (warn_missing_declarations
&& TREE_PUBLIC (decl1) && TREE_PUBLIC (decl1)
...@@ -5889,7 +5904,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5889,7 +5904,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
&& old_decl != 0 && TREE_USED (old_decl) && old_decl != 0 && TREE_USED (old_decl)
&& old_decl == IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1))) && old_decl == IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)))
warning_with_decl (decl1, warning_with_decl (decl1,
"`%s' was used with no declaration before its definition"); "`%s' was used with no declaration before its definition");
/* This is a definition, not a reference. /* This is a definition, not a reference.
So normally clear DECL_EXTERNAL. So normally clear DECL_EXTERNAL.
...@@ -5900,7 +5915,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5900,7 +5915,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
#ifdef SET_DEFAULT_DECL_ATTRIBUTES #ifdef SET_DEFAULT_DECL_ATTRIBUTES
SET_DEFAULT_DECL_ATTRIBUTES (decl1, attributes); SET_DEFAULT_DECL_ATTRIBUTES (decl1, attributes);
#endif #endif
/* This function exists in static storage. /* This function exists in static storage.
(This does not mean `static' in the C sense!) */ (This does not mean `static' in the C sense!) */
TREE_STATIC (decl1) = 1; TREE_STATIC (decl1) = 1;
...@@ -5909,7 +5924,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5909,7 +5924,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
if (current_function_decl != 0) if (current_function_decl != 0)
TREE_PUBLIC (decl1) = 0; TREE_PUBLIC (decl1) = 0;
/* Warn for unlikely, improbable, or stupid declarations of `main'. */ /* Warn for unlikely, improbable, or stupid declarations of `main'. */
if (warn_main > 0 if (warn_main > 0
&& strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))) == 0) && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))) == 0)
{ {
...@@ -5917,7 +5932,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5917,7 +5932,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
int argct = 0; int argct = 0;
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1))) if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
!= integer_type_node) != integer_type_node)
pedwarn_with_decl (decl1, "return type of `%s' is not `int'"); pedwarn_with_decl (decl1, "return type of `%s' is not `int'");
for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args; for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args;
...@@ -5943,7 +5958,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5943,7 +5958,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node)) != char_type_node))
pedwarn_with_decl (decl1, pedwarn_with_decl (decl1,
"second argument of `%s' should be `char **'"); "second argument of `%s' should be `char **'");
break; break;
case 3: case 3:
...@@ -5952,14 +5967,14 @@ start_function (declspecs, declarator, prefix_attributes, attributes) ...@@ -5952,14 +5967,14 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node)) != char_type_node))
pedwarn_with_decl (decl1, pedwarn_with_decl (decl1,
"third argument of `%s' should probably be `char **'"); "third argument of `%s' should probably be `char **'");
break; break;
} }
} }
/* It is intentional that this message does not mention the third /* It is intentional that this message does not mention the third
argument, which is warned for only pedantically, because it's argument, which is warned for only pedantically, because it's
blessed by mention in an appendix of the standard. */ blessed by mention in an appendix of the standard. */
if (argct > 0 && (argct < 2 || argct > 3)) if (argct > 0 && (argct < 2 || argct > 3))
pedwarn_with_decl (decl1, "`%s' takes only zero or two arguments"); pedwarn_with_decl (decl1, "`%s' takes only zero or two arguments");
...@@ -6124,8 +6139,7 @@ store_parm_decls () ...@@ -6124,8 +6139,7 @@ store_parm_decls ()
won't depend on its type. */ won't depend on its type. */
TREE_TYPE (dummy) = integer_type_node; TREE_TYPE (dummy) = integer_type_node;
DECL_ARG_TYPE (dummy) = integer_type_node; DECL_ARG_TYPE (dummy) = integer_type_node;
DECL_ARGUMENTS (fndecl) DECL_ARGUMENTS (fndecl) = chainon (DECL_ARGUMENTS (fndecl), dummy);
= chainon (DECL_ARGUMENTS (fndecl), dummy);
} }
#endif #endif
...@@ -6227,7 +6241,7 @@ store_parm_decls () ...@@ -6227,7 +6241,7 @@ store_parm_decls ()
TREE_PURPOSE (parm) = found; TREE_PURPOSE (parm) = found;
/* Mark this decl as "already found" */ /* Mark this decl as "already found". */
DECL_WEAK (found) = 1; DECL_WEAK (found) = 1;
} }
...@@ -6238,7 +6252,7 @@ store_parm_decls () ...@@ -6238,7 +6252,7 @@ store_parm_decls ()
any actual PARM_DECLs not matched with any names. */ any actual PARM_DECLs not matched with any names. */
nonparms = 0; nonparms = 0;
for (parm = parmdecls; parm; ) for (parm = parmdecls; parm;)
{ {
tree next = TREE_CHAIN (parm); tree next = TREE_CHAIN (parm);
TREE_CHAIN (parm) = 0; TREE_CHAIN (parm) = 0;
...@@ -6249,19 +6263,19 @@ store_parm_decls () ...@@ -6249,19 +6263,19 @@ store_parm_decls ()
{ {
/* Complain about args with incomplete types. */ /* Complain about args with incomplete types. */
if (!COMPLETE_TYPE_P (TREE_TYPE (parm))) if (!COMPLETE_TYPE_P (TREE_TYPE (parm)))
{ {
error_with_decl (parm, "parameter `%s' has incomplete type"); error_with_decl (parm, "parameter `%s' has incomplete type");
TREE_TYPE (parm) = error_mark_node; TREE_TYPE (parm) = error_mark_node;
} }
if (! DECL_WEAK (parm)) if (! DECL_WEAK (parm))
{ {
error_with_decl (parm, error_with_decl (parm,
"declaration for parameter `%s' but no such parameter"); "declaration for parameter `%s' but no such parameter");
/* Pretend the parameter was not missing. /* Pretend the parameter was not missing.
This gets us to a standard state and minimizes This gets us to a standard state and minimizes
further error messages. */ further error messages. */
specparms specparms
= chainon (specparms, = chainon (specparms,
tree_cons (parm, NULL_TREE, NULL_TREE)); tree_cons (parm, NULL_TREE, NULL_TREE));
} }
...@@ -6270,8 +6284,9 @@ store_parm_decls () ...@@ -6270,8 +6284,9 @@ store_parm_decls ()
parm = next; parm = next;
} }
/* Chain the declarations together in the order of the list of names. */ /* Chain the declarations together in the order of the list of
/* Store that chain in the function decl, replacing the list of names. */ names. Store that chain in the function decl, replacing the
list of names. */
parm = specparms; parm = specparms;
DECL_ARGUMENTS (fndecl) = 0; DECL_ARGUMENTS (fndecl) = 0;
{ {
...@@ -6530,7 +6545,7 @@ combine_parm_decls (specparms, parmlist, void_at_end) ...@@ -6530,7 +6545,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
/* Complain about any actual PARM_DECLs not matched with any names. */ /* Complain about any actual PARM_DECLs not matched with any names. */
for (parm = parmdecls; parm; ) for (parm = parmdecls; parm;)
{ {
tree next = TREE_CHAIN (parm); tree next = TREE_CHAIN (parm);
TREE_CHAIN (parm) = 0; TREE_CHAIN (parm) = 0;
...@@ -6577,7 +6592,7 @@ combine_parm_decls (specparms, parmlist, void_at_end) ...@@ -6577,7 +6592,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
types = tree_cons (NULL_TREE, TREE_TYPE (parm), types); types = tree_cons (NULL_TREE, TREE_TYPE (parm), types);
} }
} }
if (void_at_end) if (void_at_end)
return tree_cons (parmdecls, nonparms, return tree_cons (parmdecls, nonparms,
nreverse (tree_cons (NULL_TREE, void_type_node, types))); nreverse (tree_cons (NULL_TREE, void_type_node, types)));
...@@ -6624,7 +6639,7 @@ finish_function (nested) ...@@ -6624,7 +6639,7 @@ finish_function (nested)
!= integer_type_node) != integer_type_node)
{ {
/* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned. /* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned.
If warn_main is -1 (-Wno-main) we don't want to be warned. */ If warn_main is -1 (-Wno-main) we don't want to be warned. */
if (! warn_main) if (! warn_main)
pedwarn_with_decl (fndecl, "return type of `%s' is not `int'"); pedwarn_with_decl (fndecl, "return type of `%s' is not `int'");
} }
...@@ -6700,16 +6715,16 @@ finish_function (nested) ...@@ -6700,16 +6715,16 @@ finish_function (nested)
size_as_int); size_as_int);
else else
warning_with_decl (fndecl, warning_with_decl (fndecl,
"size of return value of `%s' is larger than %d bytes", "size of return value of `%s' is larger than %d bytes",
larger_than_size); larger_than_size);
} }
} }
if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested) if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested)
{ {
/* Stop pointing to the local nodes about to be freed. /* Stop pointing to the local nodes about to be freed.
But DECL_INITIAL must remain nonzero so we know this But DECL_INITIAL must remain nonzero so we know this
was an actual function definition. was an actual function definition.
For a nested function, this is done in pop_c_function_context. For a nested function, this is done in pop_c_function_context.
If rest_of_compilation set this to 0, leave it 0. */ If rest_of_compilation set this to 0, leave it 0. */
if (DECL_INITIAL (fndecl) != 0) if (DECL_INITIAL (fndecl) != 0)
...@@ -6725,7 +6740,7 @@ finish_function (nested) ...@@ -6725,7 +6740,7 @@ finish_function (nested)
static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors); static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
else else
#endif #endif
assemble_constructor (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl))); assemble_constructor (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)));
} }
if (DECL_STATIC_DESTRUCTOR (fndecl)) if (DECL_STATIC_DESTRUCTOR (fndecl))
...@@ -6819,6 +6834,7 @@ pop_c_function_context (f) ...@@ -6819,6 +6834,7 @@ pop_c_function_context (f)
} }
/* Mark the language specific parts of F for GC. */ /* Mark the language specific parts of F for GC. */
void void
mark_c_function_context (f) mark_c_function_context (f)
struct function *f; struct function *f;
...@@ -6843,16 +6859,18 @@ copy_lang_decl (node) ...@@ -6843,16 +6859,18 @@ copy_lang_decl (node)
} }
/* Mark ARG for GC. */ /* Mark ARG for GC. */
void void
lang_mark_false_label_stack (arg) lang_mark_false_label_stack (arg)
struct label_node *arg; struct label_node *arg;
{ {
/* C doesn't use false_label_stack. It better be NULL. */ /* C doesn't use false_label_stack. It better be NULL. */
if (arg != NULL) if (arg != NULL)
abort(); abort ();
} }
/* Mark the language specific bits in T for GC. */ /* Mark the language specific bits in T for GC. */
void void
lang_mark_tree (t) lang_mark_tree (t)
tree t; tree t;
...@@ -6874,7 +6892,7 @@ lang_mark_tree (t) ...@@ -6874,7 +6892,7 @@ lang_mark_tree (t)
/* The functions below are required for functionality of doing /* The functions below are required for functionality of doing
function at once processing in the C front end. Currently these function at once processing in the C front end. Currently these
functions are not called from anywhere in the C front end, but as functions are not called from anywhere in the C front end, but as
these changes continue, that will change. */ these changes continue, that will change. */
/* Returns non-zero if the current statement is a full expression, /* Returns non-zero if the current statement is a full expression,
i.e. temporaries created during that statement should be destroyed i.e. temporaries created during that statement should be destroyed
...@@ -6887,9 +6905,9 @@ stmts_are_full_exprs_p () ...@@ -6887,9 +6905,9 @@ stmts_are_full_exprs_p ()
} }
/* Nonzero if TYPE is an anonymous union or struct type. Always 0 in /* Nonzero if TYPE is an anonymous union or struct type. Always 0 in
C. */ C. */
int int
anon_aggr_type_p (node) anon_aggr_type_p (node)
tree node ATTRIBUTE_UNUSED; tree node ATTRIBUTE_UNUSED;
{ {
...@@ -6907,7 +6925,7 @@ current_function_name_declared () ...@@ -6907,7 +6925,7 @@ current_function_name_declared ()
return 0; return 0;
} }
/* Code to generate the RTL for a case label in C. */ /* Code to generate the RTL for a case label in C. */
void void
do_case (low_value, high_value) do_case (low_value, high_value)
...@@ -6922,7 +6940,7 @@ do_case (low_value, high_value) ...@@ -6922,7 +6940,7 @@ do_case (low_value, high_value)
value2 = check_case_value (high_value); value2 = check_case_value (high_value);
label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
if (pedantic && (high_value != NULL_TREE)) if (pedantic && (high_value != NULL_TREE))
pedwarn ("ISO C forbids case ranges"); pedwarn ("ISO C forbids case ranges");
...@@ -6930,20 +6948,19 @@ do_case (low_value, high_value) ...@@ -6930,20 +6948,19 @@ do_case (low_value, high_value)
{ {
tree duplicate; tree duplicate;
int success; int success;
if (high_value == NULL_TREE && value1 != NULL_TREE && if (high_value == NULL_TREE && value1 != NULL_TREE &&
pedantic && ! INTEGRAL_TYPE_P (TREE_TYPE (value1))) pedantic && ! INTEGRAL_TYPE_P (TREE_TYPE (value1)))
pedwarn ("label must have integral type in ISO C"); pedwarn ("label must have integral type in ISO C");
if (low_value == NULL_TREE) if (low_value == NULL_TREE)
success = pushcase (NULL_TREE, 0, label, &duplicate); success = pushcase (NULL_TREE, 0, label, &duplicate);
else if (high_value == NULL_TREE) else if (high_value == NULL_TREE)
success = pushcase (value1, convert_and_check, label, success = pushcase (value1, convert_and_check, label, &duplicate);
&duplicate);
else else
success = pushcase_range (value1, value2, convert_and_check, success = pushcase_range (value1, value2, convert_and_check,
label, &duplicate); label, &duplicate);
if (success == 1) if (success == 1)
{ {
if (low_value == NULL_TREE) if (low_value == NULL_TREE)
...@@ -6951,18 +6968,20 @@ do_case (low_value, high_value) ...@@ -6951,18 +6968,20 @@ do_case (low_value, high_value)
else else
error ("case label not within a switch statement"); error ("case label not within a switch statement");
} }
else if (success == 2) { else if (success == 2)
if (low_value == NULL_TREE) {
{ if (low_value == NULL_TREE)
error ("multiple default labels in one switch"); {
error_with_decl (duplicate, "this is the first default label"); error ("multiple default labels in one switch");
} error_with_decl (duplicate, "this is the first default label");
else }
error ("dupicate case value"); else
if (high_value != NULL_TREE) error ("dupicate case value");
error_with_decl (duplicate, "this is the first entry for that value"); if (high_value != NULL_TREE)
} error_with_decl (duplicate,
else if (low_value != NULL_TREE) "this is the first entry for that value");
}
else if (low_value != NULL_TREE)
{ {
if (success == 3) if (success == 3)
warning ("case value out of range"); warning ("case value out of range");
...@@ -6973,7 +6992,7 @@ do_case (low_value, high_value) ...@@ -6973,7 +6992,7 @@ do_case (low_value, high_value)
} }
/* Language specific handler of tree nodes used when generating RTL /* Language specific handler of tree nodes used when generating RTL
from a tree. */ from a tree. */
tree tree
lang_expand_stmt (t) lang_expand_stmt (t)
...@@ -6983,7 +7002,7 @@ lang_expand_stmt (t) ...@@ -6983,7 +7002,7 @@ lang_expand_stmt (t)
return NULL_TREE; return NULL_TREE;
} }
/* Accessor to set the 'current_function_name_declared' flag. */ /* Accessor to set the 'current_function_name_declared' flag. */
void void
set_current_function_name_declared (i) set_current_function_name_declared (i)
...@@ -6991,4 +7010,3 @@ set_current_function_name_declared (i) ...@@ -6991,4 +7010,3 @@ set_current_function_name_declared (i)
{ {
abort (); abort ();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment