Commit 60919bce by Joseph Myers Committed by Joseph Myers

c-decl.c (build_array_declarator, [...]): Change boolean parameters to type bool.

	* 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.

From-SVN: r86366
parent bdfd0ed4
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> 2004-08-21 Mike Stump <mrs@apple.com>
* config/rs6000/darwin.h (SUBTARGET_OPTIONS): Move from here, to... * config/rs6000/darwin.h (SUBTARGET_OPTIONS): Move from here, to...
......
...@@ -383,8 +383,8 @@ static GTY(()) tree static_dtors; ...@@ -383,8 +383,8 @@ static GTY(()) tree static_dtors;
/* Forward declarations. */ /* Forward declarations. */
static tree lookup_name_in_scope (tree, struct c_scope *); static tree lookup_name_in_scope (tree, struct c_scope *);
static tree c_make_fname_decl (tree, int); static tree c_make_fname_decl (tree, int);
static tree grokdeclarator (tree, tree, enum decl_context, int, tree *); static tree grokdeclarator (tree, tree, enum decl_context, bool, tree *);
static tree grokparms (tree, int); static tree grokparms (tree, bool);
static void layout_array_type (tree); static void layout_array_type (tree);
/* States indicating how grokdeclarator() should handle declspecs marked /* States indicating how grokdeclarator() should handle declspecs marked
...@@ -2624,17 +2624,18 @@ shadow_tag_warned (tree declspecs, int warned) ...@@ -2624,17 +2624,18 @@ shadow_tag_warned (tree declspecs, int warned)
/* Construct an array declarator. EXPR is the expression inside [], or /* Construct an array declarator. EXPR is the expression inside [], or
NULL_TREE. QUALS are the type qualifiers inside the [] (to be applied 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 to the pointer to which a parameter array is converted). STATIC_P is
nonzero if "static" is inside the [], zero otherwise. VLA_UNSPEC_P true if "static" is inside the [], false otherwise. VLA_UNSPEC_P
is nonzero is the array is [*], a VLA of unspecified length which is is true if the array is [*], a VLA of unspecified length which is
nevertheless a complete type (not currently implemented by GCC), 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 (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 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 is the expression inside; whose TREE_TYPE is the type qualifiers and
which has TREE_STATIC set if "static" is used. */ which has TREE_STATIC set if "static" is used. */
tree 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; tree decl;
decl = build_nt (ARRAY_REF, NULL_TREE, expr, NULL_TREE, NULL_TREE); decl = build_nt (ARRAY_REF, NULL_TREE, expr, NULL_TREE, NULL_TREE);
...@@ -2654,13 +2655,13 @@ build_array_declarator (tree expr, tree quals, int static_p, int vla_unspec_p) ...@@ -2654,13 +2655,13 @@ build_array_declarator (tree expr, tree quals, int static_p, int vla_unspec_p)
/* Set the type of an array declarator. DECL is the declarator, as /* Set the type of an array declarator. DECL is the declarator, as
constructed by build_array_declarator; TYPE is what appears on the left 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 of the [] and goes in operand 0. ABSTRACT_P is true if it is an
abstract declarator, zero otherwise; this is used to reject static and abstract declarator, false otherwise; this is used to reject static and
type qualifiers in abstract declarators, where they are not in the type qualifiers in abstract declarators, where they are not in the
C99 grammar. */ C99 grammar. */
tree 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; TREE_OPERAND (decl, 0) = type;
if (abstract_p && (TREE_TYPE (decl) != NULL_TREE || TREE_STATIC (decl))) if (abstract_p && (TREE_TYPE (decl) != NULL_TREE || TREE_STATIC (decl)))
...@@ -2680,7 +2681,7 @@ groktypename (tree type_name) ...@@ -2680,7 +2681,7 @@ groktypename (tree type_name)
split_specs_attrs (TREE_PURPOSE (type_name), &specs, &attrs); 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); NULL);
/* Apply attributes. */ /* Apply attributes. */
...@@ -2698,7 +2699,7 @@ groktypename_in_parm_context (tree type_name) ...@@ -2698,7 +2699,7 @@ groktypename_in_parm_context (tree type_name)
return type_name; return type_name;
return grokdeclarator (TREE_VALUE (type_name), return grokdeclarator (TREE_VALUE (type_name),
TREE_PURPOSE (type_name), TREE_PURPOSE (type_name),
PARM, 0, NULL); PARM, false, NULL);
} }
/* Decode a declarator in an ordinary declaration or data definition. /* Decode a declarator in an ordinary declaration or data definition.
...@@ -2717,7 +2718,7 @@ groktypename_in_parm_context (tree type_name) ...@@ -2717,7 +2718,7 @@ groktypename_in_parm_context (tree type_name)
grokfield and not through here. */ grokfield and not through here. */
tree tree
start_decl (tree declarator, tree declspecs, int initialized, tree attributes) start_decl (tree declarator, tree declspecs, bool initialized, tree attributes)
{ {
tree decl; tree decl;
tree tem; tree tem;
...@@ -3162,7 +3163,7 @@ push_parm_decl (tree parm) ...@@ -3162,7 +3163,7 @@ push_parm_decl (tree parm)
decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)), decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)),
TREE_PURPOSE (TREE_PURPOSE (parm)), TREE_PURPOSE (TREE_PURPOSE (parm)),
PARM, 0, NULL); PARM, false, NULL);
decl_attributes (&decl, TREE_VALUE (parm), 0); decl_attributes (&decl, TREE_VALUE (parm), 0);
decl = pushdecl (decl); decl = pushdecl (decl);
...@@ -3445,7 +3446,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) ...@@ -3445,7 +3446,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
TYPENAME if for a typename (in a cast or sizeof). TYPENAME if for a typename (in a cast or sizeof).
Don't make a DECL node; just return the ..._TYPE node. Don't make a DECL node; just return the ..._TYPE node.
FIELD for a struct or union field; make a FIELD_DECL. 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 WIDTH is non-NULL for bit-fields, and is a pointer to an INTEGER_CST node
representing the width of the bit-field. representing the width of the bit-field.
...@@ -3458,7 +3459,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) ...@@ -3458,7 +3459,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
static tree static tree
grokdeclarator (tree declarator, tree declspecs, 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; int specbits = 0;
tree spec; tree spec;
...@@ -4729,12 +4730,12 @@ grokdeclarator (tree declarator, tree declspecs, ...@@ -4729,12 +4730,12 @@ grokdeclarator (tree declarator, tree declspecs,
Return a list of arg types to use in the FUNCTION_TYPE for this function. 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 a mere declaration. A nonempty identifier-list gets an error message
when FUNCDEF_FLAG is zero. */ when FUNCDEF_FLAG is false. */
static tree static tree
grokparms (tree arg_info, int funcdef_flag) grokparms (tree arg_info, bool funcdef_flag)
{ {
tree arg_types = ARG_INFO_TYPES (arg_info); tree arg_types = ARG_INFO_TYPES (arg_info);
...@@ -5135,7 +5136,7 @@ grokfield (tree declarator, tree declspecs, tree width) ...@@ -5135,7 +5136,7 @@ grokfield (tree declarator, tree declspecs, tree width)
} }
} }
value = grokdeclarator (declarator, declspecs, FIELD, 0, value = grokdeclarator (declarator, declspecs, FIELD, false,
width ? &width : NULL); width ? &width : NULL);
finish_decl (value, NULL_TREE, NULL_TREE); finish_decl (value, NULL_TREE, NULL_TREE);
...@@ -5726,7 +5727,7 @@ start_function (tree declspecs, tree declarator, tree attributes) ...@@ -5726,7 +5727,7 @@ start_function (tree declspecs, tree declarator, tree attributes)
error message in c_finish_bc_stmt. */ error message in c_finish_bc_stmt. */
c_break_label = c_cont_label = size_zero_node; 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, /* If the declarator is not suitable for a function definition,
cause a syntax error. */ cause a syntax error. */
......
...@@ -1389,7 +1389,7 @@ notype_initdecls: ...@@ -1389,7 +1389,7 @@ notype_initdecls:
initdcl: initdcl:
declarator maybeasm maybe_attribute '=' declarator maybeasm maybe_attribute '='
{ $<ttype>$ = start_decl ($1, current_declspecs, 1, { $<ttype>$ = start_decl ($1, current_declspecs, true,
chainon ($3, all_prefix_attributes)); chainon ($3, all_prefix_attributes));
start_init ($<ttype>$, $2, global_bindings_p ()); } start_init ($<ttype>$, $2, global_bindings_p ()); }
init init
...@@ -1398,7 +1398,7 @@ initdcl: ...@@ -1398,7 +1398,7 @@ initdcl:
maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6);
finish_decl ($<ttype>5, $6.value, $2); } finish_decl ($<ttype>5, $6.value, $2); }
| declarator maybeasm maybe_attribute | 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)); chainon ($3, all_prefix_attributes));
finish_decl (d, NULL_TREE, $2); finish_decl (d, NULL_TREE, $2);
} }
...@@ -1406,7 +1406,7 @@ initdcl: ...@@ -1406,7 +1406,7 @@ initdcl:
notype_initdcl: notype_initdcl:
notype_declarator maybeasm maybe_attribute '=' notype_declarator maybeasm maybe_attribute '='
{ $<ttype>$ = start_decl ($1, current_declspecs, 1, { $<ttype>$ = start_decl ($1, current_declspecs, true,
chainon ($3, all_prefix_attributes)); chainon ($3, all_prefix_attributes));
start_init ($<ttype>$, $2, global_bindings_p ()); } start_init ($<ttype>$, $2, global_bindings_p ()); }
init init
...@@ -1415,7 +1415,7 @@ notype_initdcl: ...@@ -1415,7 +1415,7 @@ notype_initdcl:
maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6);
finish_decl ($<ttype>5, $6.value, $2); } finish_decl ($<ttype>5, $6.value, $2); }
| notype_declarator maybeasm maybe_attribute | 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)); chainon ($3, all_prefix_attributes));
finish_decl (d, NULL_TREE, $2); } finish_decl (d, NULL_TREE, $2); }
; ;
...@@ -1624,7 +1624,7 @@ after_type_declarator: ...@@ -1624,7 +1624,7 @@ after_type_declarator:
| after_type_declarator '(' parmlist_or_identifiers %prec '.' | after_type_declarator '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| after_type_declarator array_declarator %prec '.' | 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 | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); } { $$ = make_pointer_declarator ($2, $3); }
| TYPENAME | TYPENAME
...@@ -1646,7 +1646,7 @@ parm_declarator_starttypename: ...@@ -1646,7 +1646,7 @@ parm_declarator_starttypename:
parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.' parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| parm_declarator_starttypename array_declarator %prec '.' | parm_declarator_starttypename array_declarator %prec '.'
{ $$ = set_array_declarator_type ($2, $1, 0); } { $$ = set_array_declarator_type ($2, $1, false); }
| TYPENAME | TYPENAME
@@ifobjc @@ifobjc
| OBJECTNAME | OBJECTNAME
...@@ -1657,7 +1657,7 @@ parm_declarator_nostarttypename: ...@@ -1657,7 +1657,7 @@ parm_declarator_nostarttypename:
parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.' parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| parm_declarator_nostarttypename array_declarator %prec '.' | 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 | '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); } { $$ = make_pointer_declarator ($2, $3); }
| '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY | '*' maybe_type_quals_attrs parm_declarator_nostarttypename %prec UNARY
...@@ -1677,7 +1677,7 @@ notype_declarator: ...@@ -1677,7 +1677,7 @@ notype_declarator:
| '*' maybe_type_quals_attrs notype_declarator %prec UNARY | '*' maybe_type_quals_attrs notype_declarator %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); } { $$ = make_pointer_declarator ($2, $3); }
| notype_declarator array_declarator %prec '.' | notype_declarator array_declarator %prec '.'
{ $$ = set_array_declarator_type ($2, $1, 0); } { $$ = set_array_declarator_type ($2, $1, false); }
| IDENTIFIER | IDENTIFIER
; ;
...@@ -1946,27 +1946,27 @@ direct_absdcl1: ...@@ -1946,27 +1946,27 @@ direct_absdcl1:
| direct_absdcl1 '(' parmlist | direct_absdcl1 '(' parmlist
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
| direct_absdcl1 array_declarator | direct_absdcl1 array_declarator
{ $$ = set_array_declarator_type ($2, $1, 1); } { $$ = set_array_declarator_type ($2, $1, true); }
| '(' parmlist | '(' parmlist
{ $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); } { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
| array_declarator | 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. */ /* The [...] part of a declarator for an array type. */
array_declarator: array_declarator:
'[' maybe_type_quals_attrs expr_no_commas ']' '[' 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 ']' | '[' maybe_type_quals_attrs ']'
{ $$ = build_array_declarator (NULL_TREE, $2, 0, 0); } { $$ = build_array_declarator (NULL_TREE, $2, false, false); }
| '[' maybe_type_quals_attrs '*' ']' | '[' 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 ']' | '[' 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 is a synonym for type_quals_attrs. */
| '[' declspecs_nosc_nots STATIC expr_no_commas ']' | '[' 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 /* A nonempty series of declarations and statements (possibly followed by
......
...@@ -163,7 +163,7 @@ extern void c_expand_body (tree); ...@@ -163,7 +163,7 @@ extern void c_expand_body (tree);
extern void c_init_decl_processing (void); extern void c_init_decl_processing (void);
extern void c_dup_lang_specific_decl (tree); extern void c_dup_lang_specific_decl (tree);
extern void c_print_identifier (FILE *, tree, int); 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 tree build_enumerator (tree, tree);
extern void check_for_loop_decls (void); extern void check_for_loop_decls (void);
extern void mark_forward_parm_decls (void); extern void mark_forward_parm_decls (void);
...@@ -188,14 +188,14 @@ extern void c_push_function_context (struct function *); ...@@ -188,14 +188,14 @@ extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *); extern void c_pop_function_context (struct function *);
extern void push_parm_decl (tree); extern void push_parm_decl (tree);
extern tree pushdecl_top_level (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, extern tree builtin_function (const char *, tree, int, enum built_in_class,
const char *, tree); const char *, tree);
extern void shadow_tag (tree); extern void shadow_tag (tree);
extern void shadow_tag_warned (tree, int); extern void shadow_tag_warned (tree, int);
extern tree start_enum (tree); extern tree start_enum (tree);
extern int start_function (tree, tree, 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 tree start_struct (enum tree_code, tree);
extern void store_parm_decls (void); extern void store_parm_decls (void);
extern tree xref_tag (enum tree_code, tree); extern tree xref_tag (enum tree_code, tree);
......
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