re PR c++/17042 (Duplicated symbol in assembly output)

PR c++/17042
	* decl.c (declare_global_var): Use the return value from pushdecl.

	PR c++/14667
	* parser.c (cp_parser_simple_declaration): Do not diagnose invalid
	type names if we have already found a valid type.
	(cp_parser_member_declaration): Likewise.

	PR c++/17852
	* parser.c (cp_parser_member_specification_opt): Handle
	CPP_PRAGMA.

	PR c++/17042
	* g++.dg/init/dso_handle1.C: New test.

	PR c++/17852
	* g++.dg/parse/pragma1.C: New test.

	PR c++/14667
	* g++.dg/parse/typedef6.C: New test.

From-SVN: r89118
This commit is contained in:
Mark Mitchell 2004-10-15 21:11:50 +00:00 committed by Mark Mitchell
parent 7832e66155
commit de3fe73c4f
7 changed files with 65 additions and 3 deletions

View File

@ -1,3 +1,17 @@
2004-10-15 Mark Mitchell <mark@codesourcery.com>
PR c++/17042
* decl.c (declare_global_var): Use the return value from pushdecl.
PR c++/14667
* parser.c (cp_parser_simple_declaration): Do not diagnose invalid
type names if we have already found a valid type.
(cp_parser_member_declaration): Likewise.
PR c++/17852
* parser.c (cp_parser_member_specification_opt): Handle
CPP_PRAGMA.
2004-10-15 Kazu Hirata <kazu@cs.umass.edu>
* dump.c, g++spec.c, repo.c: Update copyright.

View File

@ -5029,7 +5029,11 @@ declare_global_var (tree name, tree type)
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
pushdecl (decl);
/* If the user has explicitly declared this variable (perhaps
because the code we are compiling is part of a low-level runtime
library), then it is possible that our declaration will be merged
with theirs by pushdecl. */
decl = pushdecl (decl);
cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0);
pop_from_top_level ();

View File

@ -6953,7 +6953,8 @@ cp_parser_simple_declaration (cp_parser* parser,
T t;
where "T" should name a type -- but does not. */
if (cp_parser_parse_and_diagnose_invalid_type_name (parser))
if (!decl_specifiers.type
&& cp_parser_parse_and_diagnose_invalid_type_name (parser))
{
/* If parsing tentatively, we should commit; we really are
looking at a declaration. */
@ -12880,6 +12881,13 @@ cp_parser_member_specification_opt (cp_parser* parser)
break;
default:
/* Accept #pragmas at class scope. */
if (token->type == CPP_PRAGMA)
{
cp_lexer_handle_pragma (parser->lexer);
break;
}
/* Otherwise, the next construction must be a
member-declaration. */
cp_parser_member_declaration (parser);
@ -12963,7 +12971,8 @@ cp_parser_member_declaration (cp_parser* parser)
prefix_attributes = decl_specifiers.attributes;
decl_specifiers.attributes = NULL_TREE;
/* Check for an invalid type-name. */
if (cp_parser_parse_and_diagnose_invalid_type_name (parser))
if (!decl_specifiers.type
&& cp_parser_parse_and_diagnose_invalid_type_name (parser))
return;
/* If there is no declarator, then the decl-specifier-seq should
specify a type. */

View File

@ -1,3 +1,14 @@
2004-10-15 Mark Mitchell <mark@codesourcery.com>
PR c++/17042
* g++.dg/init/dso_handle1.C: New test.
PR c++/17852
* g++.dg/parse/pragma1.C: New test.
PR c++/14667
* g++.dg/parse/typedef6.C: New test.
2004-10-15 Aldy Hernandez <aldyh@redhat.com>
* gcc.c-torture/execute/ieee/ieee.exp: Disable on powerpc-*-*spe.

View File

@ -0,0 +1,10 @@
// PR c++/17042
// { dg-do assemble }
// { dg-options "-fuse-cxa-atexit" }
struct A
{ A(); ~A(); };
A a;
extern "C" { void* __dso_handle __attribute__ ((__weak__)); }
void f()
{ __dso_handle = 0; }

View File

@ -0,0 +1,8 @@
// PR c++/17852
class T {
#pragma X
struct S {
};
#pragma Y
};

View File

@ -0,0 +1,6 @@
// PR c++/14667
template<class T>
class Class1;
class Class2 {} typedef Class1<Class2> Type1; // { dg-error "" }