c-decl.c: Fix typos in several comments.

* c-decl.c: Fix typos in several comments.  Remove all
	#if 0 blocks; reindent as needed.  Remove unused argument
	to declare_parm_level; all callers changed.
	* c-parse.in: Update calls to declare_parm_level.  Avoid
	issuing a double warning in some circumstances.
	* c-typeck.c: Update calls to declare_parm_level.
	* c-tree.h: Update prototype of declare_parm_level.

	* c-pragma.c (apply_pragma_weak): Don't complain about a
	redundant #pragma weak.

	* objc/objc-act.c (forward_declare_categories,
	build_selector_reference_decl, build_class_reference_decl,
	build_objc_string_decl, synth_forward_declarations,
	build_protocol_reference): Set TREE_PUBLIC on synthetic
	forward decl to 0, consistent with eventual definition.
	Correct comments to match.

cp:
	* pt.c (get_bindings): Make definition consistent with
	forward declaration.

From-SVN: r69519
This commit is contained in:
Zack Weinberg 2003-07-17 20:12:21 +00:00
parent 78ff95dc17
commit eb1dfbb2fb
9 changed files with 85 additions and 148 deletions

View File

@ -1,5 +1,23 @@
2003-07-17 Zack Weinberg <zack@codesourcery.com>
* c-decl.c: Fix typos in several comments. Remove all
#if 0 blocks; reindent as needed. Remove unused argument
to declare_parm_level; all callers changed.
* c-parse.in: Update calls to declare_parm_level. Avoid
issuing a double warning in some circumstances.
* c-typeck.c: Update calls to declare_parm_level.
* c-tree.h: Update prototype of declare_parm_level.
* c-pragma.c (apply_pragma_weak): Don't complain about a
redundant #pragma weak.
* objc/objc-act.c (forward_declare_categories,
build_selector_reference_decl, build_class_reference_decl,
build_objc_string_decl, synth_forward_declarations,
build_protocol_reference): Set TREE_PUBLIC on synthetic
forward decl to 0, consistent with eventual definition.
Correct comments to match.
* fixinc/inclhack.def (solaris_mutex_init_2): Escape braces
in regexp that don't form a range expression.
* fixinc/fixincl.def: Regenerate.

View File

@ -83,26 +83,28 @@ static tree enum_next_value;
static int enum_overflow;
/* Parsing a function declarator leaves a list of parameter names
or a chain or parameter decls here. */
or a chain of parameter decls here. */
static tree last_function_parms;
/* Parsing a function declarator leaves here a chain of structure
and enum types declared in the parmlist. */
/* Parsing a function declarator leaves a chain of structure
and enum types declared in the parmlist here. */
static tree last_function_parm_tags;
/* After parsing the declarator that starts a function definition,
`start_function' puts here the list of parameter names or chain of decls.
`store_parm_decls' finds it here. */
`start_function' puts the list of parameter names or chain of decls here
for `store_parm_decls' to find. */
static tree current_function_parms;
/* Similar, for last_function_parm_tags. */
static tree current_function_parm_tags;
/* Similar, for the file and line that the prototype came from if this is
an old-style definition. */
static location_t current_function_prototype_locus;
/* The current statement tree. */
@ -401,13 +403,10 @@ kept_level_p (void)
|| current_binding_level->tags != 0);
}
/* Identify this binding level as a level of parameters.
DEFINITION_FLAG is 1 for a definition, 0 for a declaration.
But it turns out there is no way to pass the right value for
DEFINITION_FLAG, so we ignore it. */
/* Identify this binding level as a level of parameters. */
void
declare_parm_level (int definition_flag ATTRIBUTE_UNUSED)
declare_parm_level (void)
{
current_binding_level->parm_flag = 1;
}
@ -2659,14 +2658,6 @@ start_decl (tree declarator, tree declspecs, int initialized, tree attributes)
if (initialized)
{
#if 0
/* Seems redundant with grokdeclarator. */
if (current_binding_level != global_binding_level
&& DECL_EXTERNAL (decl)
&& TREE_CODE (decl) != FUNCTION_DECL)
warning ("declaration of `%s' has `extern' and is initialized",
IDENTIFIER_POINTER (DECL_NAME (decl)));
#endif
DECL_EXTERNAL (decl) = 0;
if (current_binding_level == global_binding_level)
TREE_STATIC (decl) = 1;
@ -3020,17 +3011,6 @@ push_parm_decl (tree parm)
TREE_PURPOSE (TREE_PURPOSE (parm)), PARM, 0);
decl_attributes (&decl, TREE_VALUE (parm), 0);
#if 0
if (DECL_NAME (decl))
{
tree olddecl;
olddecl = lookup_name (DECL_NAME (decl));
if (pedantic && olddecl != 0 && TREE_CODE (olddecl) == TYPE_DECL)
pedwarn_with_decl (decl,
"ISO C forbids parameter `%s' shadowing typedef");
}
#endif
decl = pushdecl (decl);
immediate_size_expand = old_immediate_size_expand;
@ -3930,14 +3910,6 @@ grokdeclarator (tree declarator, tree declspecs,
if (pedantic && !COMPLETE_TYPE_P (type))
pedwarn ("array type has incomplete element type");
#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))
pedwarn ("ISO C forbids const or volatile function types");
#endif
/* 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
@ -4303,10 +4275,6 @@ grokdeclarator (tree declarator, tree declspecs,
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. */
type_quals = TYPE_UNQUALIFIED;
#endif
}
decl = build_decl (FIELD_DECL, declarator, type);
DECL_NONADDRESSABLE_P (decl) = bitfield;
@ -4410,9 +4378,6 @@ grokdeclarator (tree declarator, tree declspecs,
type_quals),
TYPE_DOMAIN (type));
TYPE_ALIGN (type) = saved_align;
#if 0 /* Leave the variable const or volatile as well. */
type_quals = TYPE_UNQUALIFIED;
#endif
}
else if (type_quals)
type = c_build_qualified_type (type, type_quals);
@ -4533,62 +4498,36 @@ grokparms (tree parms_info, int funcdef_flag)
{
tree parm;
tree typelt;
/* We no longer test FUNCDEF_FLAG.
If the arg types are incomplete in a declaration,
/* If the arg types are incomplete in a declaration,
they must include undefined tags.
These tags can never be defined in the scope of the declaration,
so the types can never be completed,
and no call can be compiled successfully. */
#if 0
/* In a fcn definition, arg types must be complete. */
if (funcdef_flag)
#endif
for (parm = last_function_parms, typelt = first_parm;
parm;
parm = TREE_CHAIN (parm))
/* Skip over any enumeration constants declared here. */
if (TREE_CODE (parm) == PARM_DECL)
{
/* Barf if the parameter itself has an incomplete type. */
tree type = TREE_VALUE (typelt);
if (type == error_mark_node)
continue;
if (!COMPLETE_TYPE_P (type))
{
if (funcdef_flag && DECL_NAME (parm) != 0)
error ("parameter `%s' has incomplete type",
IDENTIFIER_POINTER (DECL_NAME (parm)));
else
warning ("parameter has incomplete type");
if (funcdef_flag)
{
TREE_VALUE (typelt) = error_mark_node;
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. */
else
{
/* Now warn if is a pointer to an incomplete type. */
while (TREE_CODE (type) == POINTER_TYPE
|| TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
type = TYPE_MAIN_VARIANT (type);
if (!COMPLETE_TYPE_P (type))
{
if (DECL_NAME (parm) != 0)
warning ("parameter `%s' points to incomplete type",
IDENTIFIER_POINTER (DECL_NAME (parm)));
else
warning ("parameter points to incomplete type");
}
}
#endif
typelt = TREE_CHAIN (typelt);
}
for (parm = last_function_parms, typelt = first_parm;
parm;
parm = TREE_CHAIN (parm))
/* Skip over any enumeration constants declared here. */
if (TREE_CODE (parm) == PARM_DECL)
{
/* Barf if the parameter itself has an incomplete type. */
tree type = TREE_VALUE (typelt);
if (type == error_mark_node)
continue;
if (!COMPLETE_TYPE_P (type))
{
if (funcdef_flag && DECL_NAME (parm) != 0)
error ("parameter `%s' has incomplete type",
IDENTIFIER_POINTER (DECL_NAME (parm)));
else
warning ("parameter has incomplete type");
if (funcdef_flag)
{
TREE_VALUE (typelt) = error_mark_node;
TREE_TYPE (parm) = error_mark_node;
}
}
typelt = TREE_CHAIN (typelt);
}
return first_parm;
}
@ -5732,7 +5671,7 @@ start_function (tree declspecs, tree declarator, tree attributes)
current_function_decl = pushdecl (decl1);
pushlevel (0);
declare_parm_level (1);
declare_parm_level ();
make_decl_rtl (current_function_decl, NULL);
@ -5864,22 +5803,6 @@ store_parm_decls (void)
and record in the function. */
DECL_ARGUMENTS (fndecl) = getdecls ();
#if 0
/* If this function takes a variable number of arguments,
add a phony parameter to the end of the parm list,
to represent the position of the first unnamed argument. */
if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl))))
!= void_type_node)
{
tree dummy = build_decl (PARM_DECL, NULL_TREE, void_type_node);
/* Let's hope the address of the unnamed parm
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);
}
#endif
/* Now pushdecl the enum constants. */
for (parm = others; parm; parm = next)
{
@ -6142,12 +6065,6 @@ store_parm_decls (void)
keep_next_if_subblocks = 1;
/* ??? This might be an improvement,
but needs to be thought about some more. */
#if 0
keep_next_level_flag = 1;
#endif
/* Write a record describing this function definition to the prototypes
file (if requested). */
@ -6216,12 +6133,6 @@ finish_function (int nested, int can_defer_p)
poplevel (1, 0, 1);
}
#if 0
/* This caused &foo to be of type ptr-to-const-function which then
got a warning when stored in a ptr-to-function variable. */
TREE_READONLY (fndecl) = 1;
#endif
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
/* Must mark the RESULT_DECL as being in this function. */

View File

@ -1842,7 +1842,7 @@ component_decl:
| declspecs_nosc_nots
{ if (pedantic)
pedwarn ("ISO C forbids member declarations with no members");
shadow_tag($1);
shadow_tag_warned ($1, pedantic);
$$ = NULL_TREE; }
| error
{ $$ = NULL_TREE; }
@ -2482,7 +2482,7 @@ parmlist:
maybe_attribute
{ pushlevel (0);
clear_parm_order ();
declare_parm_level (0); }
declare_parm_level (); }
parmlist_1
{ $$ = $3;
parmlist_tags_warning ();
@ -2604,7 +2604,7 @@ parmlist_or_identifiers:
maybe_attribute
{ pushlevel (0);
clear_parm_order ();
declare_parm_level (1); }
declare_parm_level (); }
parmlist_or_identifiers_1
{ $$ = $3;
parmlist_tags_warning ();

View File

@ -273,6 +273,7 @@ apply_pragma_weak (tree decl, tree value)
}
if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
&& !DECL_WEAK (decl) /* don't complain about a redundant #pragma */
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
warning_with_decl (decl, "applying #pragma weak `%s' after first use results in unspecified behavior");

View File

@ -191,7 +191,7 @@ extern tree build_enumerator (tree, tree);
extern void check_for_loop_decls (void);
extern void clear_parm_order (void);
extern int complete_array_type (tree, tree, int);
extern void declare_parm_level (int);
extern void declare_parm_level (void);
extern tree define_label (location_t, tree);
extern void finish_decl (tree, tree, tree);
extern tree finish_enum (tree, tree, tree);

View File

@ -375,7 +375,7 @@ common_type (tree t1, tree t2)
lists, argument by argument. */
pushlevel (0);
declare_parm_level (1);
declare_parm_level ();
len = list_length (p1);
newargs = 0;

View File

@ -1,3 +1,8 @@
2003-07-17 Zack Weinberg <zack@codesourcery.com>
* pt.c (get_bindings): Make definition consistent with
forward declaration.
2003-07-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7809
@ -6,7 +11,7 @@
2003-07-17 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/10668
* typeck.c (build_class_member_access_expr): Improve diagnostic.
* typeck.c (build_class_member_access_expr): Improve diagnostic.
2003-07-16 Mark Mitchell <mark@codesourcery.com>
@ -43,7 +48,7 @@
(tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P.
* semantics.c (finish_id_expression): Use
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
2003-07-16 Neil Booth <neil@daikokuya.co.uk>
* lang-options.h: Remove.
@ -95,7 +100,7 @@
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* lex.c (unqualified_fn_lookup_error): Use pedwarn. Do not create
LOOKUP_EXPRs
LOOKUP_EXPRs
* mangle.c (write_expression): Remove support for LOOKUP_EXPR.
* parser.c (cp_parser_postfix_expression): Modify Koenig lookup
test.
@ -116,7 +121,7 @@
(finish_fname): Likewise.
(finish_id_expression): Likewise.
* tree.c (is_aggr_type_2): Remove.
2003-07-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/11531
@ -133,8 +138,8 @@
PR c++/11509
* pt.c (dependent_scope_ref_p): New function.
(value_dependent_expression_p): Use it.
(type_dependent_expression_p): Likewise.
(type_dependent_expression_p): Likewise.
* pt.c (tsubst_friend_function): Use reregister_specialization.
PR c++/7019
@ -152,7 +157,7 @@
PR c++/11510
* call.c (op_error): Properly format REALPART_EXPR and
IMAGPART_EXPR.
IMAGPART_EXPR.
* error.c (dump_expr): Likewise.
2003-07-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
@ -185,7 +190,7 @@
* search.c (lookup_base): Use DECL_SELF_REFERENCE_P.
* pt.c (reregister_specialization): Fix thinko in previous change.
* cp-tree.h (cp_id_kind): New type.
(unqualified_name_lookup_error): Change prototype.
(unqualified_fn_lookup_error): New function.
@ -225,7 +230,7 @@
(regenerate_decl_from_template): Use reregister_specialization.
* semantics.c (perform_koenig_lookup): New function.
(finish_id_expression): Likewise.
2003-07-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* pt.c (push_access_scope_real): Remove.
@ -306,7 +311,7 @@
* cp-tree.h (break_out_calls): Remove declaration.
* tree.c (break_out_calls): Remove.
* typeck.c (build_modify_expr): Avoid invalid sharing of trees.
2003-07-09 Nathan Sidwell <nathan@codesourcery.com>
PR c++ 9483

View File

@ -10028,7 +10028,7 @@ get_bindings_real (tree fn,
/* For most uses, we want to check the return type. */
tree
static tree
get_bindings (tree fn, tree decl, tree explicit_args)
{
return get_bindings_real (fn, decl, explicit_args, 1, DEDUCE_EXACT, -1);

View File

@ -1591,6 +1591,7 @@ forward_declare_categories ()
impent->class_decl
= create_builtin_decl (VAR_DECL, objc_category_template,
IDENTIFIER_POINTER (synth_id_with_class_suffix ("_OBJC_CATEGORY", objc_implementation_context)));
TREE_PUBLIC (impent->class_decl) = 0;
}
}
objc_implementation_context = sav;
@ -1975,7 +1976,7 @@ build_selector_reference_decl ()
decl = build_decl (VAR_DECL, ident, selector_type);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
TREE_PUBLIC (decl) = 0;
TREE_USED (decl) = 1;
TREE_READONLY (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
@ -2190,7 +2191,7 @@ build_class_reference_decl ()
decl = build_decl (VAR_DECL, ident, objc_class_type);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
TREE_PUBLIC (decl) = 0;
TREE_USED (decl) = 1;
TREE_READONLY (decl) = 1;
DECL_CONTEXT (decl) = 0;
@ -2327,7 +2328,7 @@ build_objc_string_decl (section)
decl = build_decl (VAR_DECL, ident, build_array_type (char_type_node, 0));
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
TREE_PUBLIC (decl) = 0;
TREE_USED (decl) = 1;
TREE_READONLY (decl) = 1;
TREE_CONSTANT (decl) = 1;
@ -3460,7 +3461,7 @@ synth_forward_declarations ()
{
tree sc_spec, decl_specs, an_id;
/* extern struct objc_class _OBJC_CLASS_<my_name>; */
/* static struct objc_class _OBJC_CLASS_<my_name>; */
an_id = synth_id_with_class_suffix ("_OBJC_CLASS", objc_implementation_context);
@ -3477,7 +3478,8 @@ synth_forward_declarations ()
UOBJC_METACLASS_decl = define_decl (an_id, decl_specs);
TREE_USED (UOBJC_METACLASS_decl) = 1;
DECL_ARTIFICIAL(UOBJC_METACLASS_decl) = 1;
DECL_ARTIFICIAL (UOBJC_METACLASS_decl) = 1;
TREE_PUBLIC (UOBJC_METACLASS_decl) = 0;
/* Pre-build the following entities - for speed/convenience. */
@ -5226,7 +5228,7 @@ build_protocol_reference (p)
{
tree decl, ident, ptype;
/* extern struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
/* static struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
ident = synth_id_with_class_suffix ("_OBJC_PROTOCOL", p);
ptype
@ -5240,7 +5242,7 @@ build_protocol_reference (p)
{
decl = build_decl (VAR_DECL, ident, ptype);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
TREE_PUBLIC (decl) = 0;
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;