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>
* 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
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Process declarations and symbol lookup for C front end.
Also constructs types; the standard scalar types at initialization,
and structure, union, array and enum types when they are declared. */
......@@ -865,8 +864,7 @@ finish_incomplete_decl (decl)
/* Create a new `struct binding_level'. */
static
struct binding_level *
static struct binding_level *
make_binding_level ()
{
/* NOSTRICT */
......@@ -1207,8 +1205,7 @@ poplevel (keep, reverse, functionbody)
cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set
in `grokdeclarator' as soon as we have created the FUNCTION_TYPE
node which will represent the "scope" for these "parameter list local"
tagged types.
*/
tagged types. */
if (functionbody)
for (link = tags; link; link = TREE_CHAIN (link))
......@@ -1705,7 +1702,8 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == 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");
errmsg = 1;
break;
......@@ -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,
then any file-scope declaration should not
have been static. */
......@@ -2508,9 +2507,11 @@ implicitly_declare (functionid)
/* We used to reuse an old implicit decl here,
but this loses with inline functions because it can clobber
the saved decl chains. */
/* if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0)
#if 0
if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0)
decl = IDENTIFIER_IMPLICIT_DECL (functionid);
else */
else
#endif
decl = build_decl (FUNCTION_DECL, functionid, default_function_type);
/* Warn of implicit decl following explicit local extern decl.
......@@ -2955,7 +2956,9 @@ init_decl_processing ()
named_labels = NULL;
current_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;
build_common_tree_nodes (flag_signed_char);
......@@ -3050,7 +3053,8 @@ 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)));
wint_type_node =
TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WINT_TYPE)));
boolean_type_node = integer_type_node;
boolean_true_node = integer_one_node;
......@@ -3070,8 +3074,7 @@ init_decl_processing ()
/* 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);
char_array_type_node = build_array_type (char_type_node, array_domain_type);
/* Likewise for arrays of ints. */
int_array_type_node
......@@ -3083,8 +3086,7 @@ 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);
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);
......@@ -3483,7 +3485,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
if (initialized)
{
#if 0 /* Seems redundant with grokdeclarator. */
#if 0
/* Seems redundant with grokdeclarator. */
if (current_binding_level != global_binding_level
&& DECL_EXTERNAL (decl)
&& TREE_CODE (decl) != FUNCTION_DECL)
......@@ -3765,7 +3768,8 @@ push_parm_decl (parm)
tree olddecl;
olddecl = lookup_name (DECL_NAME (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
......@@ -3997,7 +4001,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
{
if (ridpointers[i] == id)
{
if (i == (int) RID_LONG && specbits & (1<<i))
if (i == (int) RID_LONG && specbits & (1 << i))
{
if (longlong)
error ("`long long long' is too long for GCC");
......@@ -4042,7 +4046,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
else if (TREE_CODE (id) != ERROR_MARK)
type = id;
found: {}
found:
;
}
typedef_type = type;
......@@ -4067,7 +4072,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if ((warn_implicit_int || warn_return_type) && funcdef_flag)
warn_about_return_type = 1;
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;
......@@ -4082,7 +4088,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if ((specbits & 1 << (int) RID_LONG) && ! longlong
&& TYPE_MAIN_VARIANT (type) == double_type_node)
{
specbits &= ~ (1 << (int) RID_LONG);
specbits &= ~(1 << (int) RID_LONG);
type = long_double_type_node;
}
......@@ -4143,7 +4149,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
&& TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE)
{
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.
......@@ -4259,7 +4265,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
error ("function definition declared `register'");
if (specbits & 1 << (int) RID_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));
}
else if (decl_context != NORMAL && nclasses > 0)
......@@ -4271,7 +4277,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
switch (decl_context)
{
case FIELD:
error ("storage class specified for structure field `%s'", name);
error ("storage class specified for structure field `%s'",
name);
break;
case PARM:
error ("storage class specified for parameter `%s'", name);
......@@ -4280,7 +4287,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
error ("storage class specified for typename");
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_EXTERN));
}
......@@ -4405,9 +4412,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if (pedantic)
{
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
pedwarn ("ISO C89 forbids variable-size array `%s'", name);
pedwarn ("ISO C89 forbids variable-size array `%s'",
name);
}
}
......@@ -4434,7 +4443,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
itype = build_index_type (itype);
}
#if 0 /* This had bad results for pointers to arrays, as in
#if 0
/* This had bad results for pointers to arrays, as in
union incomplete (*foo)[4]; */
/* Complain about arrays of incomplete types, except in typedefs. */
......@@ -4446,7 +4456,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
warning ("array type has incomplete element type");
#endif
#if 0 /* We shouldn't have a function type here at all!
#if 0
/* We shouldn't have a function type here at all!
Functions aren't allowed as array elements. */
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
&& (constp || volatilep))
......@@ -4462,7 +4473,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if (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
/* Don't clear these; leave them set so that the array type
or the variable is itself const or volatile. */
type_quals = TYPE_UNQUALIFIED;
#endif
......@@ -4745,7 +4757,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
type = build_array_type (c_build_qualified_type (TREE_TYPE (type),
type_quals),
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;
#endif
}
......@@ -4957,8 +4970,10 @@ grokparms (parms_info, funcdef_flag)
TREE_TYPE (parm) = error_mark_node;
}
}
#if 0 /* This has been replaced by parm_tags_warning
which uses a more accurate criterion for what to warn about. */
#if 0
/* This has been replaced by parm_tags_warning, which
uses a more accurate criterion for what to warn
about. */
else
{
/* Now warn if is a pointer to an incomplete type. */
......@@ -4983,7 +4998,6 @@ grokparms (parms_info, funcdef_flag)
}
}
/* 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_VALUE is a list of structure, union and enum tags defined.
......@@ -5009,8 +5023,7 @@ get_parm_info (void_at_end)
But if the `void' is qualified (by `const' or `volatile') or has a
storage class specifier (`register'), then the behavior is undefined;
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
&& TREE_CHAIN (parms) == 0
&& VOID_TYPE_P (TREE_TYPE (parms))
......@@ -5027,7 +5040,7 @@ get_parm_info (void_at_end)
/* Extract enumerator values and other non-parms declared with the parms.
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);
......@@ -5038,7 +5051,8 @@ get_parm_info (void_at_end)
}
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;
new_parms = decl;
}
......@@ -5440,7 +5454,8 @@ finish_struct (t, fieldlist, attributes)
error_with_decl (TREE_CHAIN (x), "duplicate member `%s'");
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,
......@@ -6124,8 +6139,7 @@ store_parm_decls ()
won't depend on its type. */
TREE_TYPE (dummy) = integer_type_node;
DECL_ARG_TYPE (dummy) = integer_type_node;
DECL_ARGUMENTS (fndecl)
= chainon (DECL_ARGUMENTS (fndecl), dummy);
DECL_ARGUMENTS (fndecl) = chainon (DECL_ARGUMENTS (fndecl), dummy);
}
#endif
......@@ -6227,7 +6241,7 @@ store_parm_decls ()
TREE_PURPOSE (parm) = found;
/* Mark this decl as "already found" */
/* Mark this decl as "already found". */
DECL_WEAK (found) = 1;
}
......@@ -6238,7 +6252,7 @@ store_parm_decls ()
any actual PARM_DECLs not matched with any names. */
nonparms = 0;
for (parm = parmdecls; parm; )
for (parm = parmdecls; parm;)
{
tree next = TREE_CHAIN (parm);
TREE_CHAIN (parm) = 0;
......@@ -6270,8 +6284,9 @@ store_parm_decls ()
parm = next;
}
/* Chain the declarations together in the order of the list of names. */
/* Store that chain in the function decl, replacing the list of names. */
/* Chain the declarations together in the order of the list of
names. Store that chain in the function decl, replacing the
list of names. */
parm = specparms;
DECL_ARGUMENTS (fndecl) = 0;
{
......@@ -6530,7 +6545,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
/* 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_CHAIN (parm) = 0;
......@@ -6819,6 +6834,7 @@ pop_c_function_context (f)
}
/* Mark the language specific parts of F for GC. */
void
mark_c_function_context (f)
struct function *f;
......@@ -6843,16 +6859,18 @@ copy_lang_decl (node)
}
/* Mark ARG for GC. */
void
lang_mark_false_label_stack (arg)
struct label_node *arg;
{
/* C doesn't use false_label_stack. It better be NULL. */
if (arg != NULL)
abort();
abort ();
}
/* Mark the language specific bits in T for GC. */
void
lang_mark_tree (t)
tree t;
......@@ -6938,8 +6956,7 @@ do_case (low_value, high_value)
if (low_value == NULL_TREE)
success = pushcase (NULL_TREE, 0, label, &duplicate);
else if (high_value == NULL_TREE)
success = pushcase (value1, convert_and_check, label,
&duplicate);
success = pushcase (value1, convert_and_check, label, &duplicate);
else
success = pushcase_range (value1, value2, convert_and_check,
label, &duplicate);
......@@ -6951,7 +6968,8 @@ do_case (low_value, high_value)
else
error ("case label not within a switch statement");
}
else if (success == 2) {
else if (success == 2)
{
if (low_value == NULL_TREE)
{
error ("multiple default labels in one switch");
......@@ -6960,7 +6978,8 @@ do_case (low_value, high_value)
else
error ("dupicate case value");
if (high_value != NULL_TREE)
error_with_decl (duplicate, "this is the first entry for that value");
error_with_decl (duplicate,
"this is the first entry for that value");
}
else if (low_value != NULL_TREE)
{
......@@ -6991,4 +7010,3 @@ set_current_function_name_declared (i)
{
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