Link Copied
I investigated this & icc duplicates the warningsof differentgcc versions. If you are using gcc 4.0 & higher, icc will not issue a warning, but if you are using ealier versions of gcc both compilers issue a warning.
I'm having problems seeing the what difference __attribute__((visibility("hidden"))) Foo makes. If I add this to your example:
#ifdef WORKAROUND
class Foo
#else
class __attribute__((visibility("hidden"))) Foo
#endif
and compile with gcc 4.1.1 & don't see a difference:
$ g++ -c class-attribute-hidden2.cpp; nm -C class-attribute-hidden2.o
0000000000000000 T useFoo()
0000000000000000 W Foo::dummy()
0000000000000000 W Foo::Foo()
0000000000000000 W Foo::~Foo()
U __gxx_personality_v0
$ g++ -DWORKAROUND -c class-attribute-hidden2.cpp; nm -C class-attribute-hidden2.o
0000000000000000 T useFoo()
0000000000000000 W Foo::dummy()
0000000000000000 W Foo::Foo()
0000000000000000 W Foo::~Foo()
U __gxx_personality_v0
There is an intersting discussion of Visibility here http://gcc.gnu.org/wiki/Visibilitybut I haven't figured this out what marking the class as hidden does or if icc has different behavior than gcc. Thanks for the feedback,
_|ohnO
I have a similar problem. I compile with ICC 13.2 on a machine with GCC 4.3.2 and I get warning #1286: invalid attribute for "Foo". If I add -gcc-version=400 I don't get the warning. Up to GCC version 4.2.1 it is fine but with newer version of GCC the problem persists.
I want to have my compilation compatible with GCC 4.3.2 but at the same time I want to eliminate the problem. Any idea of how I can work arround it?
For more complete information about compiler optimizations, see our Optimization Notice.