From: SF/projects/mingw n. l. <min...@li...> - 2011-04-21 12:46:03
|
Bugs item #3290578, was opened at 2011-04-20 14:05 Message generated for change (Comment added) made by markpizz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3290578&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: w32api Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mark Pizzolato (markpizz) Assigned to: Nobody/Anonymous (nobody) Summary: PACKED defined in windef.h Initial Comment: The Windows SDK include files do not define a PACKED macro anywhere. The attached file compiles without warning or error with Microsoft Compilers. MINGW produces: H:\MinGW\Bugs>gcc GCCPACKEDBug.c GCCPACKEDBug.c:4:0: warning: "PACKED" redefined h:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:71:0: note: this is the location of the previous definition H:\MinGW\Bugs>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=h:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 -- enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-we rror --build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.5.2 (GCC) H:\MinGW\Bugs>ld -v GNU ld (GNU Binutils) 2.21 #define __MINGW32_VERSION 3.18 #define __W32API_VERSION 3.17 OS: Windows 7 Pro x64 ---------------------------------------------------------------------- Comment By: Mark Pizzolato (markpizz) Date: 2011-04-21 05:46 Message: Hi earnie, I didn't show the contents since I provided the 6 line program. This working program is a subset of a real program which demonstrated this issue. Both the original real program AND the 6 line demo compile cleanly using any of the Microsoft compilers. I wasn't looking for a workaround when using MinGW, I was looking for MinGW to work as a replacement for the Microsoft compiler. If you are declaring that the behavior I'm seeing is "as Documented", please provide a reference to the relevant documentation. There is no documentation on the Microsoft compilers which might declare this issue as reserved since it works just fine in there. Please reopen this issue and actually address what is happening. ---------------------------------------------------------------------- Comment By: Keith Marshall (keithmarshall) Date: 2011-04-21 05:41 Message: Earnie, I'm reopening this, since in this case I believe the OP may have a point. The definition, in MinGW's windef.h is #define PACKED __attribute__((packed)) That's a GCC, (and hence MinGW), specific attribute. As such, it would not be likely that it is defined in any Microsoft header, (and its use almost certainly isn't documented anywhere outside that particular MinGW header itself); it should NOT have been defined thus in a MinGW system header, (in a form which would be a valid macro name in user code). It should be #define __MINGW_PACKED__ or some such, to mark it clearly as a MinGW implementation specific reserved name, and so avoid potential conflict with any user space name. Of course, when making such a change, all clients must be adjusted accordingly; I see two additional (alternative) #defines in windef.h, and only one reference anywhere else, (in wincon.h): typedef struct _KEY_EVENT_RECORD { ... } #ifdef __GNUC__ /* gcc's alignment is not what win32 expects */ PACKED #endif KEY_EVENT_RECORD; which does rather beg the question: is there really any value in defining it at all? Surely typedef struct _KEY_EVENT_RECORD { ... } #ifdef __GNUC__ /* gcc's alignment is not what win32 expects */ __attribute__((packed)) #endif KEY_EVENT_RECORD; is just as good, (and is possibly clearer in intent). ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2011-04-21 04:45 Message: You don't show the contents of GCCPACKEDBug.c but I'm guessing this is your error in your code on line 4 where you've used a reserved word. This is not a bug in gcc or w32api. To correct the issue you will need to not use the reserved word in your code. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3290578&group_id=2435 |