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) -- Summary: Incorrect source locations and number of warnings for unsupported visibility attribute Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: davek at gcc dot gnu dot org GCC build triplet: i686-pc-cygwin GCC host triplet: i686-pc-cygwin GCC target triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31844