Hi all,
I'm getting a lot of warnings of type:
warning: type attributes are honored only at type definition
when building a library which uses the
__attribute__((visibility("default"))) also on forward declarations.
While I greatly appreciate the new C++ visibility support in GCC, I
think the above warning is a big malus for cross-platform projects which
need the M$'s __declspec() attribute also on forward declarations....
in fact reading
http://gcc.gnu.org/wiki/Visibility
I see that this feature was designed with win32's declspec()
attribute-compatibility in mind. This has definitively been a Good Thing
but that warning does not make GCC fully compatible with __declspec.
To remove all those warnings from the sources of my apps I'd need to use
a DLLEXPORT_FORWARD macro when forward-declaring stuff (which would be
defined as __declspec(dllexport) for win32 compilers like MSVC or
Borland and which would expand to nothing for GCC).
And that would require me to change thousands of lines by hand :(
Looking around for a solution (e.g. suppress that specific warning) I've
found:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20345
and I wonder if the patch referenced there
(http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01511.html) does fix my
problem, too. Does anyone know that?
In that case, which is the first GCC version which will include that patch?
Last, if that patch does not fix the warning, would it be possible to
add a -Wno-type-attribute-declaration (or something like that) switch to
suppress it?
Thanks a lot and keep up the good work!
Francesco Montorsi
PS: I'm using the following GCC version:
frm@ubuntu:~$ gcc --version
gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)