This testcase: /gnu $ cat -n vis.cpp 1 int j2 __attribute__ ((visibility ("hidden"))); 2 3 4 5 6 7 8 int __attribute__ ((visibility ("protected"))) foo (int bar) 9 { 10 return bar + 3; 11 } 12 13 14 15 16 17 18 19 int i __attribute__ ((visibility ("hidden"))); 20 21 22 23 24 25 26 27 28 29 30 int j __attribute__ ((visibility ("default"))); 31 32 33 Produces seemingly mis-located warnings, both on recent trunk: /gnu $ g++ -S vis.cpp -o vis.asm vis.cpp: In function 'int foo(int)': vis.cpp:11: warning: visibility attribute not supported in this configuration; ignored vis.cpp: At global scope: vis.cpp:29: warning: visibility attribute not supported in this configuration; ignored vis.cpp:29: warning: visibility attribute not supported in this configuration; ignored /gnu $ g++ -v Using built-in specs. Target: i686-pc-cygwin Configured with: /gnu/gcc/gcc/configure --prefix=/gnu/install -v --enable-languages=c,c++,java Thread model: single gcc version 4.3.0 20070421 (experimental) ... and the 4.2.0 RC3 tarball: /gnu $ g++ -S vis.cpp -o vis.asm vis.cpp: In function 'int foo(int)': vis.cpp:11: warning: visibility attribute not supported in this configuration; ignored vis.cpp: At global scope: vis.cpp:29: warning: visibility attribute not supported in this configuration; ignored vis.cpp:29: warning: visibility attribute not supported in this configuration; ignored /gnu $ g++ -v Using built-in specs. Target: i686-pc-cygwin Configured with: /gnu/gcc/rc2/gcc-4.2.0-20070501/configure --prefix=/gnu/install/bin --with-gmp=/usr --with-mpfr=/usr -v Thread model: single gcc version 4.2.0 20070501 (prerelease) (Wasn't sure which version to file this against)
Created attachment 13516 [details] Testcase as described in summary. Not preprocessed, but this testcase is not affected by preprocessing anyway.
Still present, although the location has slipped slightly for the warnings on the function declarations with no body. $ g++ -S vis.cpp -o vis.asm vis.cpp: In function 'int foo(int)': vis.cpp:11: warning: visibility attribute not supported in this configuration; i gnored vis.cpp: At global scope: vis.cpp:30: warning: visibility attribute not supported in this configuration; i gnored vis.cpp:30: warning: visibility attribute not supported in this configuration; i gnored Confirming, but lowering the severity and priority.
Just reconfirmed with recent pre-4.5.0 HEAD: $ /gnu/gcc/install-pr42811-3/opt/gcc-tools/bin/g++-4.exe -S vis.cpp -o vis.asm vis.cpp:30:47: warning: visibility attribute not supported in this configuration; ignored vis.cpp: In function 'int foo(int)': vis.cpp:11:1: warning: visibility attribute not supported in this configuration; ignored vis.cpp: At global scope: vis.cpp:30:47: warning: visibility attribute not supported in this configuration; ignored Still trivial.