* decl.c (have_extern_spec): Remove.
(start_decl): Do not check have_extern_spec.
(start_function): Likewise.
* cp-tree.h (have_extern_spec): Remove.
* parser.c (cp_parser_linkage_specification): Don't set
have_extern_spec.
(cp_parser_init_declarator): Likewise.
(cp_parser_parameter_declaration): Do not treat parameters as
within the scope of an unbraced linkage specification.
PR c++/27884
* g++.dg/parse/linkage2.C: New test
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114727
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-06-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27884
+ * decl.c (have_extern_spec): Remove.
+ (start_decl): Do not check have_extern_spec.
+ (start_function): Likewise.
+ * cp-tree.h (have_extern_spec): Remove.
+ * parser.c (cp_parser_linkage_specification): Don't set
+ have_extern_spec.
+ (cp_parser_init_declarator): Likewise.
+ (cp_parser_parameter_declaration): Do not treat parameters as
+ within the scope of an unbraced linkage specification.
+
2006-06-15 Mark Mitchell <mark@codesourcery.com>
PR c++/27689
extern tree check_var_type (tree, tree);
extern tree reshape_init (tree, tree);
-extern bool have_extern_spec;
-
/* in decl2.c */
extern bool check_java_method (tree);
extern tree build_memfn_type (tree, tree, cp_cv_quals);
static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
-/* True if a declaration with an `extern' linkage specifier is being
- processed. */
-bool have_extern_spec;
-
\f
/* A TREE_LIST of VAR_DECLs. The TREE_PURPOSE is a RECORD_TYPE or
UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the
*pushed_scope_p = NULL_TREE;
- /* This should only be done once on the top most decl. */
- if (have_extern_spec)
- {
- declspecs->storage_class = sc_extern;
- have_extern_spec = false;
- }
-
/* An object declared as __attribute__((deprecated)) suppresses
warnings of uses of other deprecated items. */
if (lookup_attribute ("deprecated", attributes))
{
tree decl1;
- if (have_extern_spec)
- {
- declspecs->storage_class = sc_extern;
- /* This should only be done once on the outermost decl. */
- have_extern_spec = false;
- }
-
decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, &attrs);
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
saved_in_unbraced_linkage_specification_p
= parser->in_unbraced_linkage_specification_p;
parser->in_unbraced_linkage_specification_p = true;
- have_extern_spec = true;
cp_parser_declaration (parser);
- have_extern_spec = false;
parser->in_unbraced_linkage_specification_p
= saved_in_unbraced_linkage_specification_p;
}
if (!member_p)
{
if (parser->in_unbraced_linkage_specification_p)
- {
- decl_specifiers->storage_class = sc_extern;
- have_extern_spec = false;
- }
+ decl_specifiers->storage_class = sc_extern;
decl = start_decl (declarator, decl_specifiers,
is_initialized, attributes, prefix_attributes,
&pushed_scope);
{
cp_parameter_declarator *parameters = NULL;
cp_parameter_declarator **tail = ¶meters;
+ bool saved_in_unbraced_linkage_specification_p;
/* Assume all will go well. */
*is_error = false;
+ /* The special considerations that apply to a function within an
+ unbraced linkage specifications do not apply to the parameters
+ to the function. */
+ saved_in_unbraced_linkage_specification_p
+ = parser->in_unbraced_linkage_specification_p;
+ parser->in_unbraced_linkage_specification_p = false;
/* Look for more parameters. */
while (true)
}
}
+ parser->in_unbraced_linkage_specification_p
+ = saved_in_unbraced_linkage_specification_p;
+
return parameters;
}
+2006-06-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27884
+ * g++.dg/parse/linkage2.C: New test
+
2006-06-16 Richard Guenther <rguenther@suse.de>
PR middle-end/27116
--- /dev/null
+// PR c++/27884
+
+extern "C" void foo(register int *my_perl);