Commit 302a2cc5 by Joseph Myers Committed by Joseph Myers

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
parent 08272b85
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.
......
......@@ -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);
......
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
......
......@@ -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)
......
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.
......
/* 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" } */
}
/* 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" } */
}
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