[Bug c++/60551] New: __attribute__((used)) is ignored for 'static' function declarations
slyfox at inbox dot ru
gcc-bugzilla@gcc.gnu.org
Mon Mar 17 10:21:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60551
Bug ID: 60551
Summary: __attribute__((used)) is ignored for 'static' function
declarations
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at inbox dot ru
// a.cc:
// I plan to implement it in only one .cc module
// and not this one, thus I don't need external visibility.
static void friendly_accessor (void) __attribute__((used));
struct Something
{
friend void friendly_accessor (void);
void f (void);
};
// somewhere in b.cc 'friendly_accessor (void);' is implemented
// and used in 'Something::f()'
When compiling 'a.cc' I haven't managed to silence gcc on -Wall:
> a.cc:7:17: warning: 'void friendly_accessor()' declared 'static' but never defined [-Wunused-function]
> friend void friendly_accessor (void);
^
If i'll add a definition right after declaration the warning will go away:
> static void friendly_accessor (void) {}
Looks like a declaration tracking bug. It's a gcc-4.8.2 on amd64.
More information about the Gcc-bugs
mailing list