+2004-08-21 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * c-decl.c (build_array_declarator, set_array_declarator_type,
+ start_decl, grokdeclarator, grokparms): Change boolean parameters
+ to type bool.
+ * c-tree.h (build_array_declarator, set_array_declarator_type,
+ start_decl): Update prototypes.
+ * c-decl.c, c-parse.in: All callers changed.
+
2004-08-21 Mike Stump <mrs@apple.com>
* config/rs6000/darwin.h (SUBTARGET_OPTIONS): Move from here, to...
/* Forward declarations. */
static tree lookup_name_in_scope (tree, struct c_scope *);
static tree c_make_fname_decl (tree, int);
-static tree grokdeclarator (tree, tree, enum decl_context, int, tree *);
-static tree grokparms (tree, int);
+static tree grokdeclarator (tree, tree, enum decl_context, bool, tree *);
+static tree grokparms (tree, bool);
static void layout_array_type (tree);
\f
/* States indicating how grokdeclarator() should handle declspecs marked
/* Construct an array declarator. EXPR is the expression inside [], or
NULL_TREE. QUALS are the type qualifiers inside the [] (to be applied
to the pointer to which a parameter array is converted). STATIC_P is
- nonzero if "static" is inside the [], zero otherwise. VLA_UNSPEC_P
- is nonzero is the array is [*], a VLA of unspecified length which is
+ true if "static" is inside the [], false otherwise. VLA_UNSPEC_P
+ is true if the array is [*], a VLA of unspecified length which is
nevertheless a complete type (not currently implemented by GCC),
- zero otherwise. The declarator is constructed as an ARRAY_REF
+ false otherwise. The declarator is constructed as an ARRAY_REF
(to be decoded by grokdeclarator), whose operand 0 is what's on the
left of the [] (filled by in set_array_declarator_type) and operand 1
is the expression inside; whose TREE_TYPE is the type qualifiers and
which has TREE_STATIC set if "static" is used. */
tree
-build_array_declarator (tree expr, tree quals, int static_p, int vla_unspec_p)
+build_array_declarator (tree expr, tree quals, bool static_p,
+ bool vla_unspec_p)
{
tree decl;
decl = build_nt (ARRAY_REF, NULL_TREE, expr, NULL_TREE, NULL_TREE);
/* Set the type of an array declarator. DECL is the declarator, as
constructed by build_array_declarator; TYPE is what appears on the left
- of the [] and goes in operand 0. ABSTRACT_P is nonzero if it is an
- abstract declarator, zero otherwise; this is used to reject static and
+ of the [] and goes in operand 0. ABSTRACT_P is true if it is an
+ abstract declarator, false otherwise; this is used to reject static and
type qualifiers in abstract declarators, where they are not in the
C99 grammar. */
tree
-set_array_declarator_type (tree decl, tree type, int abstract_p)
+set_array_declarator_type (tree decl, tree type, bool abstract_p)
{
TREE_OPERAND (decl, 0) = type;
if (abstract_p && (TREE_TYPE (decl) != NULL_TREE || TREE_STATIC (decl)))
split_specs_attrs (TREE_PURPOSE (type_name), &specs, &attrs);
- type_name = grokdeclarator (TREE_VALUE (type_name), specs, TYPENAME, 0,
+ type_name = grokdeclarator (TREE_VALUE (type_name), specs, TYPENAME, false,
NULL);
/* Apply attributes. */
return type_name;
return grokdeclarator (TREE_VALUE (type_name),
TREE_PURPOSE (type_name),
- PARM, 0, NULL);
+ PARM, false, NULL);
}
/* Decode a declarator in an ordinary declaration or data definition.
grokfield and not through here. */
tree
-start_decl (tree declarator, tree declspecs, int initialized, tree attributes)
+start_decl (tree declarator, tree declspecs, bool initialized, tree attributes)
{
tree decl;
tree tem;
decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)),
TREE_PURPOSE (TREE_PURPOSE (parm)),
- PARM, 0, NULL);
+ PARM, false, NULL);
decl_attributes (&decl, TREE_VALUE (parm), 0);
decl = pushdecl (decl);
TYPENAME if for a typename (in a cast or sizeof).
Don't make a DECL node; just return the ..._TYPE node.
FIELD for a struct or union field; make a FIELD_DECL.
- INITIALIZED is 1 if the decl has an initializer.
+ INITIALIZED is true if the decl has an initializer.
WIDTH is non-NULL for bit-fields, and is a pointer to an INTEGER_CST node
representing the width of the bit-field.
static tree
grokdeclarator (tree declarator, tree declspecs,
- enum decl_context decl_context, int initialized, tree *width)
+ enum decl_context decl_context, bool initialized, tree *width)
{
int specbits = 0;
tree spec;
Return a list of arg types to use in the FUNCTION_TYPE for this function.
- FUNCDEF_FLAG is nonzero for a function definition, 0 for
+ FUNCDEF_FLAG is true for a function definition, false for
a mere declaration. A nonempty identifier-list gets an error message
- when FUNCDEF_FLAG is zero. */
+ when FUNCDEF_FLAG is false. */
static tree
-grokparms (tree arg_info, int funcdef_flag)
+grokparms (tree arg_info, bool funcdef_flag)
{
tree arg_types = ARG_INFO_TYPES (arg_info);
}
}
- value = grokdeclarator (declarator, declspecs, FIELD, 0,
+ value = grokdeclarator (declarator, declspecs, FIELD, false,
width ? &width : NULL);
finish_decl (value, NULL_TREE, NULL_TREE);
error message in c_finish_bc_stmt. */
c_break_label = c_cont_label = size_zero_node;
- decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL);
+ decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, true, NULL);
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
initdcl:
declarator maybeasm maybe_attribute '='
- { $<ttype>$ = start_decl ($1, current_declspecs, 1,
+ { $<ttype>$ = start_decl ($1, current_declspecs, true,
chainon ($3, all_prefix_attributes));
start_init ($<ttype>$, $2, global_bindings_p ()); }
init
maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6);
finish_decl ($<ttype>5, $6.value, $2); }
| declarator maybeasm maybe_attribute
- { tree d = start_decl ($1, current_declspecs, 0,
+ { tree d = start_decl ($1, current_declspecs, false,
chainon ($3, all_prefix_attributes));
finish_decl (d, NULL_TREE, $2);
}
notype_initdcl:
notype_declarator maybeasm maybe_attribute '='
- { $<ttype>$ = start_decl ($1, current_declspecs, 1,
+ { $<ttype>$ = start_decl ($1, current_declspecs, true,
chainon ($3, all_prefix_attributes));
start_init ($<ttype>$, $2, global_bindings_p ()); }
init
maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6);
finish_decl ($<ttype>5, $6.value, $2); }
| notype_declarator maybeasm maybe_attribute
- { tree d = start_decl ($1, current_declspecs, 0,
+ { tree d = start_decl ($1, current_declspecs, false,
chainon ($3, all_prefix_attributes));
finish_decl (d, NULL_TREE, $2); }
;
| after_type_declarator '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| after_type_declarator array_declarator %prec '.'
- { $$ = set_array_declarator_type ($2, $1, 0); }
+ { $$ = set_array_declarator_type ($2, $1, false); }
| '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); }
| TYPENAME
parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| parm_declarator_starttypename array_declarator %prec '.'
- { $$ = set_array_declarator_type ($2, $1, 0); }
+ { $$ = set_array_declarator_type ($2, $1, false); }
| TYPENAME
@@ifobjc
| OBJECTNAME
parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| parm_declarator_nostarttypename array_declarator %prec '.'
- { $$ = set_array_declarator_type ($2, $1, 0); }
+ { $$ = set_array_declarator_type ($2, $1, false); }
| '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); }
| '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY
| '*' maybe_type_quals_attrs notype_declarator %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); }
| notype_declarator array_declarator %prec '.'
- { $$ = set_array_declarator_type ($2, $1, 0); }
+ { $$ = set_array_declarator_type ($2, $1, false); }
| IDENTIFIER
;
| direct_absdcl1 '(' parmlist
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| direct_absdcl1 array_declarator
- { $$ = set_array_declarator_type ($2, $1, 1); }
+ { $$ = set_array_declarator_type ($2, $1, true); }
| '(' parmlist
{ $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
| array_declarator
- { $$ = set_array_declarator_type ($1, NULL_TREE, 1); }
+ { $$ = set_array_declarator_type ($1, NULL_TREE, true); }
;
/* The [...] part of a declarator for an array type. */
array_declarator:
'[' maybe_type_quals_attrs expr_no_commas ']'
- { $$ = build_array_declarator ($3.value, $2, 0, 0); }
+ { $$ = build_array_declarator ($3.value, $2, false, false); }
| '[' maybe_type_quals_attrs ']'
- { $$ = build_array_declarator (NULL_TREE, $2, 0, 0); }
+ { $$ = build_array_declarator (NULL_TREE, $2, false, false); }
| '[' maybe_type_quals_attrs '*' ']'
- { $$ = build_array_declarator (NULL_TREE, $2, 0, 1); }
+ { $$ = build_array_declarator (NULL_TREE, $2, false, true); }
| '[' STATIC maybe_type_quals_attrs expr_no_commas ']'
- { $$ = build_array_declarator ($4.value, $3, 1, 0); }
+ { $$ = build_array_declarator ($4.value, $3, true, false); }
/* declspecs_nosc_nots is a synonym for type_quals_attrs. */
| '[' declspecs_nosc_nots STATIC expr_no_commas ']'
- { $$ = build_array_declarator ($4.value, $2, 1, 0); }
+ { $$ = build_array_declarator ($4.value, $2, true, false); }
;
/* A nonempty series of declarations and statements (possibly followed by
extern void c_init_decl_processing (void);
extern void c_dup_lang_specific_decl (tree);
extern void c_print_identifier (FILE *, tree, int);
-extern tree build_array_declarator (tree, tree, int, int);
+extern tree build_array_declarator (tree, tree, bool, bool);
extern tree build_enumerator (tree, tree);
extern void check_for_loop_decls (void);
extern void mark_forward_parm_decls (void);
extern void c_pop_function_context (struct function *);
extern void push_parm_decl (tree);
extern tree pushdecl_top_level (tree);
-extern tree set_array_declarator_type (tree, tree, int);
+extern tree set_array_declarator_type (tree, tree, bool);
extern tree builtin_function (const char *, tree, int, enum built_in_class,
const char *, tree);
extern void shadow_tag (tree);
extern void shadow_tag_warned (tree, int);
extern tree start_enum (tree);
extern int start_function (tree, tree, tree);
-extern tree start_decl (tree, tree, int, tree);
+extern tree start_decl (tree, tree, bool, tree);
extern tree start_struct (enum tree_code, tree);
extern void store_parm_decls (void);
extern tree xref_tag (enum tree_code, tree);