I am working on ACE/TAO (www.cs.wustl.edu/~schmidt). With the upgrade to cygwin GCC 3.3.1 we get a lot of warnings that we use inline with dllimport and that attribute is ignored. Can an option be added to disable just this warning. I know I can disable all, but I want to keep the others. We have one codebase in which inlining can be disable by setting inline=0 in gnu make and I don't think we get all warnings gone because of the large number of combinations. D:/ACE/Cygwin/ACE_wrappers/ace/Bound_Ptr.i: In member function ` ACE_Bound_Ptr_Counter<ACE_LOCK>::~ACE_Bound_Ptr_Counter() [with ACE_LOCK = ACE_Null_Mutex]': D:/ACE/Cygwin/ACE_wrappers/ace/Bound_Ptr.i:121: instantiated from `static void ACE_Bound_Ptr_Counter<ACE_LOCK>::detach_weak(ACE_Bound_Ptr_Counter<ACE_LOCK>*) [with ACE_LOCK = ACE_Null_Mutex]' D:/ACE/Cygwin/ACE_wrappers/ace/Bound_Ptr.i:337: instantiated from `ACE_Weak_Bound_Ptr<X, ACE_LOCK>::~ACE_Weak_Bound_Ptr() [with X = Parent, ACE_LOCK = ACE_Null_Mutex]' Bound_Ptr_Test.cpp:86: instantiated from here D:/ACE/Cygwin/ACE_wrappers/ace/Null_Mutex.h:41: warning: inline function ' ACE_Null_Mutex::~ACE_Null_Mutex()' is declared as dllimport: attribute ignored.
Would you mind posting a small piece of code that shows this, and which flags are needed to trigger the problem? Thanks Wolfgang
I will have a try. Things are reproducable with ACE/TAO but I can imagine that this is large. Can be obtained for free from www.cs.wustl.edu/~schmidt. The Cygwin GCC 3.3.1 build results with GCC 3.3.1 cygwin can be found at http://www.cs.wustl.edu/~bugzilla/auto_compile_logs/remedy.nl_WinNT4_CygwinGCC3 2/
Sorry, link is http://www.cs.wustl.edu/~bugzilla/auto_compile_logs/remedy.nl_Win2K_Cygwin/
Created attachment 4871 [details] header file
Created attachment 4872 [details] inline file
Created attachment 4873 [details] main
The warnings C:\ACElatest\ACE_wrappers>g++ -Wall -W test.cpp In file included from T.h:10, from test.cpp:1: T.i: In member function `void T::b()': T.i:2: warning: inline function 'void T::a()' is declared as dllimport: attribute ignored. test.cpp: In function `int main()': T.i:6: warning: inline function 'void T::b()' is declared as dllimport: attribute ignored.
In ACE it is then possible to just set inline=0 to include the inline file in the cpp file and then the macro ACE_INLINE is used instead of inline and this expands then to nothing. I can imagine that more people use these kinds of tricks to disable inlining by hand or to handle different compilers and one of them has problems with inlining code.
with the attachments it can be reproduced
set to new because I delivered the example code.
On today's trunk, your example no longer gives warnings. Instead it compiles, then fails with: C:\tmp>G++ -Wall -W test.cpp c:\tmp/ccOGb2M9.o:test.cpp:(.text+0x1e): undefined reference to _imp___ZN1TC1Ev' c:\tmp/ccOGb2M9.o:test.cpp:(.text+0x3b): undefined reference to `_imp___ZN1TD1Ev' collect2: ld returned 1 exit status OK to close? Is that what you want
This happens with Qt4 Win32 as well - lot of warnings - "warning: inline function... attribute ignored". All that's needed is a -Wno-inline-dllimport type of flag to mingw to suppress these warnings. Specifying dllimport to inline functions seems reasonable though - If the compiler won't inline the function (that's just a hint) people will want to specify dllimport to avoid linker errors, or no?
Confirmed with qt4 on win32
(In reply to comment #12) > This happens with Qt4 Win32 as well - lot of warnings - "warning: inline > function... attribute ignored". All that's needed is a -Wno-inline-dllimport > type of flag to mingw to suppress these warnings. This is current (gcc-4.2) behaviour. What exactly is wrong with using -Wno-attributes to suppress the warnings. Danny ======================================================================== // warn-inline-dllimport.c __declspec (dllimport) void f1(); // inline definition (silently) overides earlier dllimport declaration inline void f1() {} // inline && dllimport in definition emits warning // both can't be true. inline __declspec (dllimport) void f2 () {} void b() { f1(); f2(); } ======================================================================== compiling as: gcc -Wall -c warn-inline-dllimport.c produces: warn-inline-dllimport.c:8: warning: inline function 'f2' declared as dllimport: attribute ignored compiling as: gcc -Wall -Wno-attributes -c warn-inline-dllimport.c gets rid of the attribute warning
No feedback in 3 months about the -Wno-attributes option and the current behavior of GCC so closing.