This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__))
- From: "sam at ravnborg dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jan 2008 19:28:56 -0000
- Subject: [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__))
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Exact gcc version (Fedora 8): gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)
Following small code snippet:
static void remove_one(void);
static void __attribute__((__used__)) remove_one(void)
{
}
build with:
gcc -c -Wall test.c
produces following warning:
test.c:4: warning: ?remove_one? defined but not used
Removing the forward declaration (prototye) or
adding the attribute to the forward declaration make
the warning disappear.
I had expected the attribution on the function to take
precedence over the forward declaration.
Browsing the gcc manual did not reveal an answer and searching
the web / the bug database did not bring up an answer
so I decided to report it as a bug.
/Sam
--
Summary: Warning "defined but not used" despite
__attribute__((__used__))
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sam at ravnborg dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985