Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-03 Thread David Grayson
Hello, Mateusz, LH_Mouse. Another point against my patch and Mateusz's patch is that applying __declspec(selectany) to a declaration is "incorrect" according to MSDN: https://msdn.microsoft.com/en-us/library/5tkz6s71.aspx The clang people have some handy notes in their test suite about how

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-03 Thread Mateusz
We could consider define DECLSPEC_SELECTANY to __attribute__((weak)) for old GCC. Patch for this attached. W dniu 2017-05-03 o 17:19, David Grayson pisze: > By the way, it's really not clear to me what specific solution you are > proposing when you say "ensure each GUID is defined only once"

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-03 Thread Liu Hao
On 2017/5/3 23:12, David Grayson wrote: > When you say "optimal", what are you optimizing for? > For decreasing object file sizes and link time, apparently. > The UsbView code uses that header file in several different translation > units, so you end up having a bunch of duplicate GUID

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-03 Thread David Grayson
By the way, it's really not clear to me what specific solution you are proposing when you say "ensure each GUID is defined only once" but I'm imagining it will introduce new incompatibilities/quirks that people have to worry about when switching between Visual Studio and mingw-w64, because you

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-03 Thread David Grayson
> > > It sounds like guiddef.h should probably check the GCC major version. > > Based on the tests people have reported in this thread, I would guess > that > > for GCC 6 and above the selectany attribute on the declaration is > required, > > while on GCC 5 and below the selectany attribute on the

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread David Grayson
I won't be offended if you revert it. I'm not sure what your shell commands do, but as long as there is one GUID defined in one header file, and the selectany attribute is not used properly, you can get multiple definition errors, because that header file could be used in multiple translation

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread Liu Hao
On 2017/5/3 9:33, Liu Hao wrote: > Kai, should we revert it? We have to deal with the multiple definition > error thereafter. > A number of UUIDs/GUIDs are suffering from such multiple definitions, which can be discovered using the following commands: ```bash grep -EhrI '^DEFINE_(GUID|OLEGUID)'

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread Liu Hao
On 2017/5/3 6:23, Mateusz wrote: > W dniu 2017-05-02 o 13:08, Liu Hao pisze: >> On 2017/5/2 18:38, Kai Tietz wrote: >>> I think, it is worth a try. In general it looks sensible. >> As you wish. > > For GCC 7.1 and 6.3 the patch is OK. > > For GCC 5.4 is not -- error compiling ffmpeg: > CC

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread Mateusz
W dniu 2017-05-02 o 13:08, Liu Hao pisze: > On 2017/5/2 18:38, Kai Tietz wrote: >> I think, it is worth a try. In general it looks sensible. > As you wish. For GCC 7.1 and 6.3 the patch is OK. For GCC 5.4 is not -- error compiling ffmpeg: CC libavdevice/dshow.o In file included from

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread Liu Hao
On 2017/5/2 18:38, Kai Tietz wrote: > I think, it is worth a try. In general it looks sensible. As you wish. -- Best regards, LH_Mouse -- Check out the vibrant tech community on one of the world's most engaging tech

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread Kai Tietz
I think, it is worth a try. In general it looks sensible. Kai 2017-05-02 11:56 GMT+02:00 Liu Hao : > Kai, did you mean this patch was ok for master? > > -- > Best regards, > LH_Mouse > > > -- > Check

Re: [Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-05-02 Thread Liu Hao
Kai, did you mean this patch was ok for master? -- Best regards, LH_Mouse -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[Mingw-w64-public] [PATCH] guiddef.h: Use __declspec(selectany) on GUID declarations.

2017-04-25 Thread David Grayson
If __declspec(selectany) is not used on the prototype but later used on a definition, GCC seems to ignore it, and you can get multiple-definition errors at link time. That situation can arise in code like Microsoft's usbview utility that has multiple translation units including the following