re PR c/7425 (deprecated attribute doesn't merge with multiple declarations)

PR c/7425
	* c-decl.c (merge_decls): Merge TREE_DEPRECATED.

cp:
	* decl.c (duplicate_decls): Merge TREE_DEPRECATED.

testsuite:
	* gcc.dg/deprecated-3.c, g++.dg/warn/deprecated-2.C: New tests.

From-SVN: r88303
This commit is contained in:
Joseph Myers 2004-09-29 21:27:26 +01:00 committed by Joseph Myers
parent 08272b8528
commit 302a2cc5c6
7 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2004-09-29 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/7425
* c-decl.c (merge_decls): Merge TREE_DEPRECATED.
2004-09-29 Eric Christopher <echristo@redhat.com>
* fold-const.c (tree_swap_operands_p): Remove duplicated code.

View File

@ -1586,6 +1586,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
make_var_volatile (newdecl);
}
/* Merge deprecatedness. */
if (TREE_DEPRECATED (newdecl))
TREE_DEPRECATED (olddecl) = 1;
/* Keep source location of definition rather than declaration. */
if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);

View File

@ -1,3 +1,7 @@
2004-09-29 Joseph S. Myers <jsm@polyomino.org.uk>
* decl.c (duplicate_decls): Merge TREE_DEPRECATED.
2004-09-29 Jason Merrill <jason@redhat.com>
PR tree-optimization/17697

View File

@ -1722,6 +1722,10 @@ duplicate_decls (tree newdecl, tree olddecl)
if (TREE_NOTHROW (newdecl))
TREE_NOTHROW (olddecl) = 1;
/* Merge deprecatedness. */
if (TREE_DEPRECATED (newdecl))
TREE_DEPRECATED (olddecl) = 1;
/* Merge the initialization information. */
if (DECL_INITIAL (newdecl) == NULL_TREE
&& DECL_INITIAL (olddecl) != NULL_TREE)

View File

@ -1,3 +1,8 @@
2004-09-29 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/7425
* gcc.dg/deprecated-3.c, g++.dg/warn/deprecated-2.C: New tests.
2004-09-29 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/stdarg-1.c: New test.

View File

@ -0,0 +1,11 @@
/* Test __attribute__((deprecated)). Test merging with multiple
declarations. Bug 7425 (C++ version). */
/* { dg-do compile } */
/* { dg-options "" } */
void func(void);
void func(void) __attribute__((deprecated));
void f(void) {
func(); /* { dg-warning "'func' is deprecated" } */
}

View File

@ -0,0 +1,11 @@
/* Test __attribute__((deprecated)). Test merging with multiple
declarations. Bug 7425. */
/* { dg-do compile } */
/* { dg-options "" } */
void func(void);
void func(void) __attribute__((deprecated));
void f(void) {
func(); /* { dg-warning "'func' is deprecated" } */
}