re PR c/34985 (Warning "defined but not used" despite __attribute__((__used__)))
2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 34985 * c-decl.c (merge_decls): Merge USED flags. cp/ * decl.c (duplicate_decls): Merge USED flags. testsuite/ * gcc.dg/pr34985.c: New. * g++.dg/warn/pr34985.C: New. From-SVN: r138235
This commit is contained in:
parent
1fbfb0e27a
commit
e27fb29c0d
7 changed files with 46 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR 34985
|
||||
* c-decl.c (merge_decls): Merge USED flags.
|
||||
|
||||
2008-07-29 Kaz Kojima <kkojima@gcc.gnu.org>
|
||||
|
||||
* config/sh/sh.c (sh_gimplify_va_arg_expr): Unshare the addr,
|
||||
|
|
|
@ -1862,6 +1862,12 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|
|||
|
||||
extern_changed = DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl);
|
||||
|
||||
/* Merge the USED information. */
|
||||
if (TREE_USED (olddecl))
|
||||
TREE_USED (newdecl) = 1;
|
||||
else if (TREE_USED (newdecl))
|
||||
TREE_USED (olddecl) = 1;
|
||||
|
||||
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
|
||||
But preserve OLDDECL's DECL_UID and DECL_CONTEXT. */
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR 34985
|
||||
* decl.c (duplicate_decls): Merge USED flags.
|
||||
|
||||
2008-07-27 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/36943
|
||||
|
|
|
@ -2056,6 +2056,12 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
|
|||
ggc_free (DECL_LANG_SPECIFIC (olddecl));
|
||||
}
|
||||
|
||||
/* Merge the USED information. */
|
||||
if (TREE_USED (olddecl))
|
||||
TREE_USED (newdecl) = 1;
|
||||
else if (TREE_USED (newdecl))
|
||||
TREE_USED (olddecl) = 1;
|
||||
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
int function_size;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2008-07-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR 34985
|
||||
* gcc.dg/pr34985.c: New.
|
||||
* g++.dg/warn/pr34985.C: New.
|
||||
|
||||
2008-07-29 Daniel Kraft <d@domob.eu>
|
||||
|
||||
PR fortran/36403
|
||||
|
|
9
gcc/testsuite/g++.dg/warn/pr34985.C
Normal file
9
gcc/testsuite/g++.dg/warn/pr34985.C
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* PR34985: Warning "defined but not used" despite __attribute__((__used__)) */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wall -Wextra -O2" } */
|
||||
static void xxyyzz (void);
|
||||
static void __attribute__((__used__)) xxyyzz(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "xxyyzz" } } */
|
9
gcc/testsuite/gcc.dg/pr34985.c
Normal file
9
gcc/testsuite/gcc.dg/pr34985.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* PR34985: Warning "defined but not used" despite __attribute__((__used__)) */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wall -Wextra -O2" } */
|
||||
static void xxyyzz (void);
|
||||
static void __attribute__((__used__)) xxyyzz(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "xxyyzz" } } */
|
Loading…
Add table
Reference in a new issue