Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread Liu Hao
On 2017/4/8 1:00, David Grayson wrote: > I did read the top two answers in the link that Norbert posted: > > http://stackoverflow.com/questions/11373203/accessing-inactive-union-member-and-undefined-behavior > > The first answer (from ecatmur) indicates that this kind of conversion with > a union w

Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread Mateusz Mikuła
I tested these _out of box_ cases: No patch: GCC: silent|Clang: 32bit silent, 64bit error Cast to "PUWSTR_C": GCC: silent|Clang: silent Union cast: GCC: silent|Clang: silent If you want to use Union cast You should create fix because I have no idea about MinGW-w64 codin

Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread David Grayson
I did read the top two answers in the link that Norbert posted: http://stackoverflow.com/questions/11373203/accessing-inactive-union-member-and-undefined-behavior The first answer (from ecatmur) indicates that this kind of conversion with a union would be undefined behavior in C++, but not C. I'

Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread Kai Tietz
2017-04-07 17:21 GMT+02:00 David Grayson : >> type1 *foo(const type1 *my_const_ptr) >> { >> union { >> type1 *t1; >> const type1 *ct1; >> } v; >> v.ct1 = my_const_ptr; >> return v.t1; >> } > > Yes, that is sad, and it seems like just a matter of time before a C++ > compiler looks at the code ab

Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread David Grayson
Oh, it would be a warning with -Wcast-qual, ok, got it. --David On Fri, Apr 7, 2017 at 8:21 AM, David Grayson wrote: > > type1 *foo(const type1 *my_const_ptr) > > { > > union { > > type1 *t1; > > const type1 *ct1; > > } v; > > v.ct1 = my_const_ptr; > > return v.t1; > > } > > Yes, that is sa

Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread David Grayson
> type1 *foo(const type1 *my_const_ptr) > { > union { > type1 *t1; > const type1 *ct1; > } v; > v.ct1 = my_const_ptr; > return v.t1; > } Yes, that is sad, and it seems like just a matter of time before a C++ compiler looks at the code above and reasons that the write to ct1 can be optimized aw

Re: [Mingw-w64-public] [PATCH] winnt.h: Added missing entries to WELL_KNOWN_SID_TYPE.

2017-04-07 Thread Kai Tietz
Patch is ok. Please apply. Thanks, Kai 2017-04-07 14:06 GMT+02:00 Jacek Caban : > Please review. > > Signed-off-by: Jacek Caban > --- > mingw-w64-headers/include/winnt.h | 15 ++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > > > -

[Mingw-w64-public] [PATCH] winnt.h: Added missing entries to WELL_KNOWN_SID_TYPE.

2017-04-07 Thread Jacek Caban
Please review. Signed-off-by: Jacek Caban --- mingw-w64-headers/include/winnt.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h index 6ac9f3e..6a5ae9f 100644 --- a/mingw-w64-headers/includ

Re: [Mingw-w64-public] [PATCH] stralign: cast ua_wcschr and ua_wcsrchr returns to wchar_t *

2017-04-07 Thread Norbert Pfeiler
That’s a kinda sad stance for a compiler support project, don’t you think? Best, Norbert. Liu Hao schrieb am Fr., 7. Apr. 2017 um 05:48 Uhr: > On 2017/4/7 8:11, Norbert Pfeiler wrote: > > Wasn’t LH_Mouse’s point that even if the warning is explicitly turned on > it > > wouldn’t be shown to the