forward/re-declarations cause lots of "warning: type attributes ignored after type is already defined [-Wattributes]"
I'm being spammed with these warnings by g++.exe (Rev9, Built by MSYS2 project) 10.2.0
against mingw-w64-x86_64-glibmm 2.66.0-1
. Here's an excerpt:
In file included from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/widget.h:43,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/container.h:28,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/bin.h:27,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/button.h:27,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Card.hpp:5,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Table.hpp:4,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Table.cpp:1:
C:/msys64/mingw64/include/gdkmm-3.0/gdkmm/window.h:1051:17: warning: type attributes ignored after type is already defined [-Wattributes]
1051 | class GDKMM_API Cursor;
| ^~~~~~
C:/msys64/mingw64/include/gdkmm-3.0/gdkmm/window.h:1052:17: warning: type attributes ignored after type is already defined [-Wattributes]
1052 | class GDKMM_API Pixbuf;
| ^~~~~~
In file included from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/widget.h:52,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/container.h:28,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/bin.h:27,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/button.h:27,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Card.hpp:5,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Table.hpp:4,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Table.cpp:1:
C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/stylecontext.h:61:17: warning: type attributes ignored after type is already defined [-Wattributes]
61 | class GTKMM_API IconSet;
| ^~~~~~~
In file included from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/widget.h:54,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/container.h:28,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/bin.h:27,
from C:/msys64/mingw64/include/gtkmm-3.0/gtkmm/button.h:27,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Card.hpp:5,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Table.hpp:4,
from ../../../home/daniel.boles/src/remote/dboles/concentration/src/gui/Table.cpp:1:
C:/msys64/mingw64/include/giomm-2.4/giomm/actiongroup.h:51:17: warning: type attributes ignored after type is already defined [-Wattributes]
51 | class GIOMM_API VariantBase;
| ^~~~~~~~~~~
C:/msys64/mingw64/include/giomm-2.4/giomm/actiongroup.h:52:17: warning: type attributes ignored after type is already defined [-Wattributes]
52 | class GIOMM_API VariantContainerBase;
It sounds like what the compiler is trying to say is that these are redeclarations, after the full class definition was already included, and hence the attributes are redundant (and, not sure, but might be misleading/dangerous if different).
I haven't yet looked into whether/how these are generated, but posting in case anyone else has a better idea of how they can be quieted. For now I just disabled that warning so that I can see warnings about my own code, but it sounds like we should avoid such attributes if poss.