From: SourceForge.net <no...@so...> - 2006-07-25 02:03:43
|
Bugs item #1205393, was opened at 2005-05-20 13:51 Message generated for change (Comment added) made by dannysmith You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1205393&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: gcc Group: Known bugs >Status: Closed >Resolution: Later Priority: 5 Submitted By: ofv (ofv) Assigned to: Danny Smith (dannysmith) Summary: type attributes are honored only at type definition Initial Comment: This is a look-ahead bug report, just in case you are not aware of the issue. With a gcc 4.0 binary downloaded from http://www.thisiscool.com/gcc_mingw.htm (I was unable to build it from sources) t:/tkidb # g++ -v Using built-in specs. Target: i686-pc-mingw32 Configured with: /datal/gcc/gcc/configure --prefix=/datal/gcc/build/wingcc --build=i686-pc-linux-gnu --host=i686-pc-mingw32 --target=i686-pc-mingw32 --enable-languages=c,c++,java --with-gcc --with-gnu-as --with-gnu-ld --enable-threads=win32 --disable-nls --disable-win32-registry --disable-shared --disable-debug --without-newlib --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-sjlj-exceptions --enable-libgcj-multifile --enable-libgcj-mingw-osapi=ansi Thread model: win32 gcc version 4.0.0 20050324 (prerelease) t:/tkidb # g++ -c f.cpp f.cpp:1: warning: type attributes are honored only at type definition f.cpp: class __declspec(dllexport) Foo; class Foo { Foo(); }; As the warning hints, __declspec(dllexport) is ignored and no symbol is exported. This differs from previous gcc versions and all other Windows compilers. ---------------------------------------------------------------------- >Comment By: Danny Smith (dannysmith) Date: 2006-07-25 14:03 Message: Logged In: YES user_id=11494 This is fixed on gcc trunk (4.2). ---------------------------------------------------------------------- Comment By: Danny Smith (dannysmith) Date: 2005-05-20 20:24 Message: Logged In: YES user_id=11494 Sorry, I referred to wrong patch. This is the one that caused the change. 2004-01-14 Danny Smith <dannysmith@users,sourceforge.net> PR c++/9021 PR c++/11005 * parser.c (cp_parser_elaborated_type_specifier): Warn about attributes and discard. * decl.c (xref_tag): Don't overwite existing attributes with NULL_TREE. This message talks about what you want: http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01004.html The thread was broken over Christmas, but sometime in that period Gabriel dos Reis suggested that attributes should apply to classes at definition time only. That suggestion made everything else a lot simpler to maintain -- dllimport of classes is a recurring source of new bug reports. Any way, IIRC, one of the patches that I submitted actually did preserve compatibility with MS compiler -- attributes on forward decls being propagated to definition, but I can't find it now. It just checked that no new attributes were added __after__ class definition, ie:"If !COMPLETE_TYPE_P, merge attributes, else ignore the new attributes" Danny ---------------------------------------------------------------------- Comment By: ofv (ofv) Date: 2005-05-20 15:26 Message: Logged In: YES user_id=1281994 Hi Danny. I'm confused. The gcc-patches thread you mention seems to indicate that your patch was accepted without further discussion: Your report plus patch: http://gcc.gnu.org/ml/gcc-bugs/2003-12/msg00556.html Mark Mitchell's fix notice: http://gcc.gnu.org/ml/gcc-bugs/2003-12/msg00739.html Then, the docs about the new visibility feature for 4.0 explicitly mentions putting __attribute__ on the declaration: http://gcc.gnu.org/wiki/Visibility http://gcc.gnu.org/onlinedocs/gcc-4.0. 0/gcc/Code-Gen-Options.html#Code-Gen-Options http://www.nedprod.com/programs/gccvisibility.html which seems to contradict the gcc documentation you quoted, but I confirmed that gcc 4.0 emits the same warning on Linux when using ((visibility("default")) on declarations. I'll file a bug report on this. Now, the question: is there any real (read technical) reason for gcc doing this and breaking lots of Windows libraries? Regards, Oscar ---------------------------------------------------------------------- Comment By: Danny Smith (dannysmith) Date: 2005-05-20 14:50 Message: Logged In: YES user_id=11494 This is what gcc.info says (and has said for awhile): 5.32 Specifying Attributes of Types =================================== The keyword `__attribute__' allows you to specify special attributes of `struct' and `union' types when you define such types. If you are asking that dllimport/dllexport be treated as an exception, please submit a patch (including a patch to the documentation) to gcc. You may be want to search for the discussion on gcc-ptches that led to this change. 2003-12-05 Danny Smith <dan...@gc...> Mark Mitchell <ma...@co...> PR c++/13305 * parser.c (cp_parser_elaborated_type_specifier): Accept attributes. Danny ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1205393&group_id=2435 |