aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c693
1 files changed, 337 insertions, 356 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index f5c74f3..aad7564 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -477,7 +477,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible, bool nested)
case ERROR_MARK: here = &I_SYMBOL_BINDING (name); break;
default:
- abort ();
+ gcc_unreachable ();
}
/* Locate the appropriate place in the chain of shadowed decls
@@ -731,10 +731,7 @@ pop_scope (void)
/* Labels go in BLOCK_VARS. */
TREE_CHAIN (p) = BLOCK_VARS (block);
BLOCK_VARS (block) = p;
-
-#ifdef ENABLE_CHECKING
- if (I_LABEL_BINDING (b->id) != b) abort ();
-#endif
+ gcc_assert (I_LABEL_BINDING (b->id) == b);
I_LABEL_BINDING (b->id) = b->shadowed;
break;
@@ -747,9 +744,7 @@ pop_scope (void)
appears in the bindings list with b->id NULL. */
if (b->id)
{
-#ifdef ENABLE_CHECKING
- if (I_TAG_BINDING (b->id) != b) abort ();
-#endif
+ gcc_assert (I_TAG_BINDING (b->id) == b);
I_TAG_BINDING (b->id) = b->shadowed;
}
break;
@@ -819,9 +814,7 @@ pop_scope (void)
here with b->id NULL in this case. */
if (b->id)
{
-#ifdef ENABLE_CHECKING
- if (I_SYMBOL_BINDING (b->id) != b) abort ();
-#endif
+ gcc_assert (I_SYMBOL_BINDING (b->id) == b);
I_SYMBOL_BINDING (b->id) = b->shadowed;
if (b->shadowed && b->shadowed->type)
TREE_TYPE (b->shadowed->decl) = b->shadowed->type;
@@ -829,7 +822,7 @@ pop_scope (void)
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
@@ -1527,7 +1520,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
for (here = &current_scope->bindings; *here; here = &(*here)->prev)
if ((*here)->decl == olddecl)
goto found;
- abort ();
+ gcc_unreachable ();
found:
b = *here;
@@ -2124,13 +2117,11 @@ pushdecl_top_level (tree x)
tree name;
bool nested = false;
- if (TREE_CODE (x) != VAR_DECL)
- abort ();
+ gcc_assert (TREE_CODE (x) == VAR_DECL);
name = DECL_NAME (x);
- if (I_SYMBOL_BINDING (name))
- abort ();
+ gcc_assert (!I_SYMBOL_BINDING (name));
if (TREE_PUBLIC (x))
{
@@ -2152,7 +2143,7 @@ implicit_decl_warning (tree id, tree olddecl)
case 0: return;
case 1: diag = warning; break;
case 2: diag = error; break;
- default: abort ();
+ default: gcc_unreachable ();
}
diag (N_("implicit declaration of function '%E'"), id);
@@ -2644,8 +2635,7 @@ builtin_function (const char *name, tree type, int function_code,
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
/* Should never be called on a symbol with a preexisting meaning. */
- if (I_SYMBOL_BINDING (id))
- abort ();
+ gcc_assert (!I_SYMBOL_BINDING (id));
bind (id, decl, external_scope, /*invisible=*/true, /*nested=*/false);
@@ -3439,8 +3429,8 @@ build_compound_literal (tree type, tree init)
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{
int failure = complete_array_type (type, DECL_INITIAL (decl), 1);
- if (failure)
- abort ();
+
+ gcc_assert (!failure);
}
type = TREE_TYPE (decl);
@@ -3529,8 +3519,8 @@ complete_array_type (tree type, tree initial_value, int do_default)
if (maxindex)
{
TYPE_DOMAIN (type) = build_index_type (maxindex);
- if (!TREE_TYPE (maxindex))
- abort ();
+
+ gcc_assert (TREE_TYPE (maxindex));
}
/* Lay out the type now that we can get the real answer. */
@@ -3737,7 +3727,7 @@ grokdeclarator (tree declarator, tree declspecs,
break;
default:
- abort ();
+ gcc_unreachable ();
}
orig_name = name;
if (name == 0)
@@ -4211,333 +4201,341 @@ grokdeclarator (tree declarator, tree declspecs,
array_parm_static = 0;
}
- if (TREE_CODE (declarator) == TREE_LIST)
- {
- /* We encode a declarator with embedded attributes using
- a TREE_LIST. */
- tree attrs = TREE_PURPOSE (declarator);
- tree inner_decl;
- int attr_flags = 0;
- declarator = TREE_VALUE (declarator);
- inner_decl = declarator;
- while (inner_decl != NULL_TREE
- && TREE_CODE (inner_decl) == TREE_LIST)
- inner_decl = TREE_VALUE (inner_decl);
- if (inner_decl == NULL_TREE
- || TREE_CODE (inner_decl) == IDENTIFIER_NODE)
- attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
- else if (TREE_CODE (inner_decl) == CALL_EXPR)
- attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
- else if (TREE_CODE (inner_decl) == ARRAY_REF)
- attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
- returned_attrs = decl_attributes (&type,
- chainon (returned_attrs, attrs),
- attr_flags);
- }
- else if (TREE_CODE (declarator) == ARRAY_REF)
+ switch (TREE_CODE (declarator))
{
- tree itype = NULL_TREE;
- tree size = TREE_OPERAND (declarator, 1);
- /* The index is a signed object `sizetype' bits wide. */
- tree index_type = c_common_signed_type (sizetype);
-
- array_ptr_quals = TREE_TYPE (declarator);
- array_parm_static = TREE_STATIC (declarator);
-
- declarator = TREE_OPERAND (declarator, 0);
-
- /* Check for some types that there cannot be arrays of. */
-
- if (VOID_TYPE_P (type))
- {
- error ("declaration of `%s' as array of voids", name);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("declaration of `%s' as array of functions", name);
+ case TREE_LIST:
+ {
+ /* We encode a declarator with embedded attributes using a
+ TREE_LIST. */
+ tree attrs = TREE_PURPOSE (declarator);
+ tree inner_decl;
+ int attr_flags = 0;
+ declarator = TREE_VALUE (declarator);
+ inner_decl = declarator;
+ while (inner_decl != NULL_TREE
+ && TREE_CODE (inner_decl) == TREE_LIST)
+ inner_decl = TREE_VALUE (inner_decl);
+ if (inner_decl == NULL_TREE
+ || TREE_CODE (inner_decl) == IDENTIFIER_NODE)
+ attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
+ else if (TREE_CODE (inner_decl) == CALL_EXPR)
+ attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
+ else if (TREE_CODE (inner_decl) == ARRAY_REF)
+ attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
+ returned_attrs = decl_attributes (&type,
+ chainon (returned_attrs, attrs),
+ attr_flags);
+ break;
+ }
+ case ARRAY_REF:
+ {
+ tree itype = NULL_TREE;
+ tree size = TREE_OPERAND (declarator, 1);
+ /* The index is a signed object `sizetype' bits wide. */
+ tree index_type = c_common_signed_type (sizetype);
+
+ array_ptr_quals = TREE_TYPE (declarator);
+ array_parm_static = TREE_STATIC (declarator);
+
+ declarator = TREE_OPERAND (declarator, 0);
+
+ /* Check for some types that there cannot be arrays of. */
+
+ if (VOID_TYPE_P (type))
+ {
+ error ("declaration of `%s' as array of voids", name);
+ type = error_mark_node;
+ }
+
+ if (TREE_CODE (type) == FUNCTION_TYPE)
+ {
+ error ("declaration of `%s' as array of functions", name);
+ type = error_mark_node;
+ }
+
+ if (pedantic && !in_system_header && flexible_array_type_p (type))
+ pedwarn ("invalid use of structure with flexible array member");
+
+ if (size == error_mark_node)
type = error_mark_node;
- }
-
- if (pedantic && !in_system_header && flexible_array_type_p (type))
- pedwarn ("invalid use of structure with flexible array member");
-
- if (size == error_mark_node)
- type = error_mark_node;
-
- if (type == error_mark_node)
- continue;
-
- /* If size was specified, set ITYPE to a range-type for that size.
- Otherwise, ITYPE remains null. finish_decl may figure it out
- from an initial value. */
-
- if (size)
- {
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (size);
-
- if (! INTEGRAL_TYPE_P (TREE_TYPE (size)))
- {
- error ("size of array `%s' has non-integer type", name);
- size = integer_one_node;
- }
-
- if (pedantic && integer_zerop (size))
- pedwarn ("ISO C forbids zero-size array `%s'", name);
-
- if (TREE_CODE (size) == INTEGER_CST)
- {
- constant_expression_warning (size);
- if (tree_int_cst_sgn (size) < 0)
- {
- error ("size of array `%s' is negative", name);
- size = integer_one_node;
- }
- }
- else
- {
- /* Make sure the array size remains visibly nonconstant
- even if it is (eg) a const variable with known value. */
- size_varies = 1;
-
- if (!flag_isoc99 && pedantic)
- {
- if (TREE_CONSTANT (size))
- pedwarn ("ISO C90 forbids array `%s' whose size can't be evaluated",
- name);
- else
- pedwarn ("ISO C90 forbids variable-size array `%s'",
- name);
- }
- }
-
- if (integer_zerop (size))
- {
- /* A zero-length array cannot be represented with an
- unsigned index type, which is what we'll get with
- build_index_type. Create an open-ended range instead. */
- itype = build_range_type (sizetype, size, NULL_TREE);
- }
- else
- {
- /* Compute the maximum valid index, that is, size - 1.
- Do the calculation in index_type, so that if it is
- a variable the computations will be done in the
- proper mode. */
- itype = fold (build2 (MINUS_EXPR, index_type,
- convert (index_type, size),
- convert (index_type, size_one_node)));
-
- /* If that overflowed, the array is too big.
- ??? While a size of INT_MAX+1 technically shouldn't
- cause an overflow (because we subtract 1), the overflow
- is recorded during the conversion to index_type, before
- the subtraction. Handling this case seems like an
- unnecessary complication. */
- if (TREE_OVERFLOW (itype))
- {
- error ("size of array `%s' is too large", name);
- type = error_mark_node;
- continue;
- }
+
+ if (type == error_mark_node)
+ continue;
- if (size_varies)
- itype = variable_size (itype);
- itype = build_index_type (itype);
- }
- }
- else if (decl_context == FIELD)
- {
- if (pedantic && !flag_isoc99 && !in_system_header)
- pedwarn ("ISO C90 does not support flexible array members");
+ /* If size was specified, set ITYPE to a range-type for
+ that size. Otherwise, ITYPE remains null. finish_decl
+ may figure it out from an initial value. */
- /* ISO C99 Flexible array members are effectively identical
- to GCC's zero-length array extension. */
- itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
- }
+ if (size)
+ {
+ /* Strip NON_LVALUE_EXPRs since we aren't using as an
+ lvalue. */
+ STRIP_TYPE_NOPS (size);
+
+ if (! INTEGRAL_TYPE_P (TREE_TYPE (size)))
+ {
+ error ("size of array `%s' has non-integer type", name);
+ size = integer_one_node;
+ }
+
+ if (pedantic && integer_zerop (size))
+ pedwarn ("ISO C forbids zero-size array `%s'", name);
+
+ if (TREE_CODE (size) == INTEGER_CST)
+ {
+ constant_expression_warning (size);
+ if (tree_int_cst_sgn (size) < 0)
+ {
+ error ("size of array `%s' is negative", name);
+ size = integer_one_node;
+ }
+ }
+ else
+ {
+ /* Make sure the array size remains visibly
+ nonconstant even if it is (eg) a const variable
+ with known value. */
+ size_varies = 1;
+
+ if (!flag_isoc99 && pedantic)
+ {
+ if (TREE_CONSTANT (size))
+ pedwarn ("ISO C90 forbids array `%s' whose size can't be evaluated",
+ name);
+ else
+ pedwarn ("ISO C90 forbids variable-size array `%s'",
+ name);
+ }
+ }
- /* If pedantic, complain about arrays of incomplete types. */
+ if (integer_zerop (size))
+ {
+ /* A zero-length array cannot be represented with
+ an unsigned index type, which is what we'll
+ get with build_index_type. Create an
+ open-ended range instead. */
+ itype = build_range_type (sizetype, size, NULL_TREE);
+ }
+ else
+ {
+ /* Compute the maximum valid index, that is, size
+ - 1. Do the calculation in index_type, so that
+ if it is a variable the computations will be
+ done in the proper mode. */
+ itype = fold (build2 (MINUS_EXPR, index_type,
+ convert (index_type, size),
+ convert (index_type,
+ size_one_node)));
+
+ /* If that overflowed, the array is too big. ???
+ While a size of INT_MAX+1 technically shouldn't
+ cause an overflow (because we subtract 1), the
+ overflow is recorded during the conversion to
+ index_type, before the subtraction. Handling
+ this case seems like an unnecessary
+ complication. */
+ if (TREE_OVERFLOW (itype))
+ {
+ error ("size of array `%s' is too large", name);
+ type = error_mark_node;
+ continue;
+ }
+
+ if (size_varies)
+ itype = variable_size (itype);
+ itype = build_index_type (itype);
+ }
+ }
+ else if (decl_context == FIELD)
+ {
+ if (pedantic && !flag_isoc99 && !in_system_header)
+ pedwarn ("ISO C90 does not support flexible array members");
- if (pedantic && !COMPLETE_TYPE_P (type))
- pedwarn ("array type has incomplete element type");
+ /* ISO C99 Flexible array members are effectively
+ identical to GCC's zero-length array extension. */
+ itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
+ }
- /* Build the array type itself, then merge any constancy or
- volatility into the target type. We must do it in this order
- to ensure that the TYPE_MAIN_VARIANT field of the array type
- is set correctly. */
+ /* If pedantic, complain about arrays of incomplete types. */
+ if (pedantic && !COMPLETE_TYPE_P (type))
+ pedwarn ("array type has incomplete element type");
- type = build_array_type (type, itype);
- if (type_quals)
- type = c_build_qualified_type (type, type_quals);
+ /* Build the array type itself, then merge any constancy
+ or volatility into the target type. We must do it in
+ this order to ensure that the TYPE_MAIN_VARIANT field
+ of the array type is set correctly. */
+ type = build_array_type (type, itype);
+ if (type_quals)
+ type = c_build_qualified_type (type, type_quals);
- if (size_varies)
- C_TYPE_VARIABLE_SIZE (type) = 1;
+ if (size_varies)
+ C_TYPE_VARIABLE_SIZE (type) = 1;
- /* The GCC extension for zero-length arrays differs from
- ISO flexible array members in that sizeof yields zero. */
- if (size && integer_zerop (size))
- {
+ /* The GCC extension for zero-length arrays differs from
+ ISO flexible array members in that sizeof yields
+ zero. */
+ if (size && integer_zerop (size))
+ {
+ layout_type (type);
+ TYPE_SIZE (type) = bitsize_zero_node;
+ TYPE_SIZE_UNIT (type) = size_zero_node;
+ }
+ else if (declarator && TREE_CODE (declarator) == INDIRECT_REF)
+ /* We can never complete an array type which is the
+ target of a pointer, so go ahead and lay it out. */
layout_type (type);
- TYPE_SIZE (type) = bitsize_zero_node;
- TYPE_SIZE_UNIT (type) = size_zero_node;
- }
- else if (declarator && TREE_CODE (declarator) == INDIRECT_REF)
- /* We can never complete an array type which is the target of a
- pointer, so go ahead and lay it out. */
- layout_type (type);
-
- if (decl_context != PARM
- && (array_ptr_quals != NULL_TREE || array_parm_static))
- {
- error ("static or type qualifiers in non-parameter array declarator");
- array_ptr_quals = NULL_TREE;
- array_parm_static = 0;
- }
- }
- else if (TREE_CODE (declarator) == CALL_EXPR)
- {
- /* Say it's a definition only for the declarator closest to
- the identifier, apart possibly from some attributes. */
- bool really_funcdef = false;
- tree arg_types;
- if (funcdef_flag)
- {
- tree t = TREE_OPERAND (declarator, 0);
- while (TREE_CODE (t) == TREE_LIST)
- t = TREE_VALUE (t);
- really_funcdef = (TREE_CODE (t) == IDENTIFIER_NODE);
- }
- /* Declaring a function type.
- Make sure we have a valid type for the function to return. */
- if (type == error_mark_node)
- continue;
-
- size_varies = 0;
+ if (decl_context != PARM
+ && (array_ptr_quals != NULL_TREE || array_parm_static))
+ {
+ error ("static or type qualifiers in non-parameter array declarator");
+ array_ptr_quals = NULL_TREE;
+ array_parm_static = 0;
+ }
+ break;
+ }
+ case CALL_EXPR:
+ {
+ /* Say it's a definition only for the declarator closest
+ to the identifier, apart possibly from some
+ attributes. */
+ bool really_funcdef = false;
+ tree arg_types;
+ if (funcdef_flag)
+ {
+ tree t = TREE_OPERAND (declarator, 0);
+ while (TREE_CODE (t) == TREE_LIST)
+ t = TREE_VALUE (t);
+ really_funcdef = (TREE_CODE (t) == IDENTIFIER_NODE);
+ }
- /* Warn about some types functions can't return. */
+ /* Declaring a function type. Make sure we have a valid
+ type for the function to return. */
+ if (type == error_mark_node)
+ continue;
+
+ size_varies = 0;
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("`%s' declared as function returning a function", name);
- type = integer_type_node;
- }
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- error ("`%s' declared as function returning an array", name);
- type = integer_type_node;
- }
+ /* Warn about some types functions can't return. */
+ if (TREE_CODE (type) == FUNCTION_TYPE)
+ {
+ error ("`%s' declared as function returning a function", name);
+ type = integer_type_node;
+ }
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ error ("`%s' declared as function returning an array", name);
+ type = integer_type_node;
+ }
- /* Construct the function type and go to the next
- inner layer of declarator. */
- arg_info = TREE_OPERAND (declarator, 1);
- arg_types = grokparms (arg_info, really_funcdef);
+ /* Construct the function type and go to the next
+ inner layer of declarator. */
+ arg_info = TREE_OPERAND (declarator, 1);
+ arg_types = grokparms (arg_info, really_funcdef);
- /* Type qualifiers before the return type of the function
- qualify the return type, not the function type. */
- if (type_quals)
+ /* Type qualifiers before the return type of the function
+ qualify the return type, not the function type. */
+ if (type_quals)
+ {
+ /* Type qualifiers on a function return type are
+ normally permitted by the standard but have no
+ effect, so give a warning at -Wreturn-type.
+ Qualifiers on a void return type are banned on
+ function definitions in ISO C; GCC used to used
+ them for noreturn functions. */
+ if (VOID_TYPE_P (type) && really_funcdef)
+ pedwarn ("function definition has qualified void return type");
+ else if (warn_return_type)
+ warning ("type qualifiers ignored on function return type");
+
+ type = c_build_qualified_type (type, type_quals);
+ }
+ type_quals = TYPE_UNQUALIFIED;
+
+ type = build_function_type (type, arg_types);
+ declarator = TREE_OPERAND (declarator, 0);
+
+ /* Set the TYPE_CONTEXTs for each tagged type which is local to
+ the formal parameter list of this FUNCTION_TYPE to point to
+ the FUNCTION_TYPE node itself. */
{
- /* Type qualifiers on a function return type are
- normally permitted by the standard but have no
- effect, so give a warning at -Wreturn-type.
- Qualifiers on a void return type are banned on
- function definitions in ISO C; GCC used to used them
- for noreturn functions. */
- if (VOID_TYPE_P (type) && really_funcdef)
- pedwarn ("function definition has qualified void return type");
- else if (warn_return_type)
- warning ("type qualifiers ignored on function return type");
-
- type = c_build_qualified_type (type, type_quals);
+ tree link;
+
+ for (link = ARG_INFO_TAGS (arg_info);
+ link;
+ link = TREE_CHAIN (link))
+ TYPE_CONTEXT (TREE_VALUE (link)) = type;
}
- type_quals = TYPE_UNQUALIFIED;
-
- type = build_function_type (type, arg_types);
- declarator = TREE_OPERAND (declarator, 0);
-
- /* Set the TYPE_CONTEXTs for each tagged type which is local to
- the formal parameter list of this FUNCTION_TYPE to point to
- the FUNCTION_TYPE node itself. */
-
+ break;
+ }
+ case INDIRECT_REF:
{
- tree link;
+ /* Merge any constancy or volatility into the target type
+ for the pointer. */
- for (link = ARG_INFO_TAGS (arg_info);
- link;
- link = TREE_CHAIN (link))
- TYPE_CONTEXT (TREE_VALUE (link)) = type;
+ if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
+ && type_quals)
+ pedwarn ("ISO C forbids qualified function types");
+ if (type_quals)
+ type = c_build_qualified_type (type, type_quals);
+ type_quals = TYPE_UNQUALIFIED;
+ size_varies = 0;
+
+ type = build_pointer_type (type);
+
+ /* Process a list of type modifier keywords (such as const
+ or volatile) that were given inside the `*'. */
+ if (TREE_TYPE (declarator))
+ {
+ tree typemodlist;
+ int erred = 0;
+
+ constp = 0;
+ volatilep = 0;
+ restrictp = 0;
+ for (typemodlist = TREE_TYPE (declarator); typemodlist;
+ typemodlist = TREE_CHAIN (typemodlist))
+ {
+ tree qualifier = TREE_VALUE (typemodlist);
+
+ if (C_IS_RESERVED_WORD (qualifier))
+ {
+ if (C_RID_CODE (qualifier) == RID_CONST)
+ constp++;
+ else if (C_RID_CODE (qualifier) == RID_VOLATILE)
+ volatilep++;
+ else if (C_RID_CODE (qualifier) == RID_RESTRICT)
+ restrictp++;
+ else
+ erred++;
+ }
+ else
+ erred++;
+ }
+
+ if (erred)
+ error ("invalid type modifier within pointer declarator");
+ if (pedantic && !flag_isoc99)
+ {
+ if (constp > 1)
+ pedwarn ("duplicate `const'");
+ if (volatilep > 1)
+ pedwarn ("duplicate `volatile'");
+ if (restrictp > 1)
+ pedwarn ("duplicate `restrict'");
+ }
+
+ type_quals = ((constp ? TYPE_QUAL_CONST : 0)
+ | (restrictp ? TYPE_QUAL_RESTRICT : 0)
+ | (volatilep ? TYPE_QUAL_VOLATILE : 0));
+ }
+
+ declarator = TREE_OPERAND (declarator, 0);
+ break;
}
+ default:
+ gcc_unreachable ();
}
- else if (TREE_CODE (declarator) == INDIRECT_REF)
- {
- /* Merge any constancy or volatility into the target type
- for the pointer. */
-
- if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
- && type_quals)
- pedwarn ("ISO C forbids qualified function types");
- if (type_quals)
- type = c_build_qualified_type (type, type_quals);
- type_quals = TYPE_UNQUALIFIED;
- size_varies = 0;
-
- type = build_pointer_type (type);
-
- /* Process a list of type modifier keywords
- (such as const or volatile) that were given inside the `*'. */
-
- if (TREE_TYPE (declarator))
- {
- tree typemodlist;
- int erred = 0;
-
- constp = 0;
- volatilep = 0;
- restrictp = 0;
- for (typemodlist = TREE_TYPE (declarator); typemodlist;
- typemodlist = TREE_CHAIN (typemodlist))
- {
- tree qualifier = TREE_VALUE (typemodlist);
-
- if (C_IS_RESERVED_WORD (qualifier))
- {
- if (C_RID_CODE (qualifier) == RID_CONST)
- constp++;
- else if (C_RID_CODE (qualifier) == RID_VOLATILE)
- volatilep++;
- else if (C_RID_CODE (qualifier) == RID_RESTRICT)
- restrictp++;
- else
- erred++;
- }
- else
- erred++;
- }
-
- if (erred)
- error ("invalid type modifier within pointer declarator");
- if (pedantic && !flag_isoc99)
- {
- if (constp > 1)
- pedwarn ("duplicate `const'");
- if (volatilep > 1)
- pedwarn ("duplicate `volatile'");
- if (restrictp > 1)
- pedwarn ("duplicate `restrict'");
- }
-
- type_quals = ((constp ? TYPE_QUAL_CONST : 0)
- | (restrictp ? TYPE_QUAL_RESTRICT : 0)
- | (volatilep ? TYPE_QUAL_VOLATILE : 0));
- }
-
- declarator = TREE_OPERAND (declarator, 0);
- }
- else
- abort ();
-
}
/* Now TYPE has the actual type. */
@@ -4930,12 +4928,9 @@ grokdeclarator (tree declarator, tree declspecs,
C_DECL_REGISTER (decl) = was_reg;
}
-#ifdef ENABLE_CHECKING
/* This is the earliest point at which we might know the assembler
name of a variable. Thus, if it's known before this, die horribly. */
- if (DECL_ASSEMBLER_NAME_SET_P (decl))
- abort ();
-#endif
+ gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl));
decl_attributes (&decl, returned_attrs, 0);
@@ -5059,10 +5054,7 @@ get_parm_info (bool ellipsis)
/* This function is only called if there was *something* on the
parameter list. */
-#ifdef ENABLE_CHECKING
- if (b == 0)
- abort ();
-#endif
+ gcc_assert (b);
/* A parameter list consisting solely of 'void' indicates that the
function takes no arguments. But if the 'void' is qualified
@@ -5103,9 +5095,7 @@ get_parm_info (bool ellipsis)
case PARM_DECL:
if (b->id)
{
-#ifdef ENABLE_CHECKING
- if (I_SYMBOL_BINDING (b->id) != b) abort ();
-#endif
+ gcc_assert (I_SYMBOL_BINDING (b->id) == b);
I_SYMBOL_BINDING (b->id) = b->shadowed;
}
@@ -5143,9 +5133,7 @@ get_parm_info (bool ellipsis)
appears in the bindings list with b->id NULL. */
if (b->id)
{
-#ifdef ENABLE_CHECKING
- if (I_TAG_BINDING (b->id) != b) abort ();
-#endif
+ gcc_assert (I_TAG_BINDING (b->id) == b);
I_TAG_BINDING (b->id) = b->shadowed;
}
@@ -5192,9 +5180,7 @@ get_parm_info (bool ellipsis)
variable. Just throw it away. */
if (b->id)
{
-#ifdef ENABLE_CHECKING
- if (I_SYMBOL_BINDING (b->id) != b) abort ();
-#endif
+ gcc_assert (I_SYMBOL_BINDING (b->id) == b);
I_SYMBOL_BINDING (b->id) = b->shadowed;
}
break;
@@ -5204,7 +5190,7 @@ get_parm_info (bool ellipsis)
case FUNCTION_DECL:
case VAR_DECL:
default:
- abort ();
+ gcc_unreachable ();
}
b = free_binding_and_advance (b);
@@ -6054,12 +6040,9 @@ start_function (tree declspecs, tree declarator, tree attributes)
if (current_function_decl != 0)
TREE_PUBLIC (decl1) = 0;
-#ifdef ENABLE_CHECKING
/* This is the earliest point at which we might know the assembler
name of the function. Thus, if it's set before this, die horribly. */
- if (DECL_ASSEMBLER_NAME_SET_P (decl1))
- abort ();
-#endif
+ gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl1));
/* If #pragma weak was used, mark the decl weak now. */
if (current_scope == file_scope)
@@ -6229,8 +6212,7 @@ store_parm_decls_oldstyle (tree fndecl, tree arg_info)
seen already, since it is not used on PARM_DECL. */
#ifdef ENABLE_CHECKING
for (b = current_scope->bindings; b; b = b->prev)
- if (TREE_CODE (b->decl) == PARM_DECL && DECL_WEAK (b->decl))
- abort ();
+ gcc_assert (TREE_CODE (b->decl) != PARM_DECL || !DECL_WEAK (b->decl));
#endif
if (warn_old_style_definition && !in_system_header)
@@ -6991,8 +6973,7 @@ c_write_global_declarations (void)
/* Close the external scope. */
ext_block = pop_scope ();
external_scope = 0;
- if (current_scope)
- abort ();
+ gcc_assert (!current_scope);
/* Process all file scopes in this compilation, and the external_scope,
through wrapup_global_declarations and check_global_declarations. */