On Wednesday 29 May 2024 15:38:19 Martin Storsjö wrote:
> On Mon, 27 May 2024, Pali Rohár wrote:
> 
> > On Monday 27 May 2024 13:04:56 LIU Hao wrote:
> > > 在 2024-05-26 20:39, Pali Rohár 写道:
> > > > ---
> > > >   mingw-w64-crt/misc/mbrtowc.c | 3 +++
> > > >   mingw-w64-crt/misc/wcrtomb.c | 5 ++++-
> > > >   2 files changed, 7 insertions(+), 1 deletion(-)
> > > > 
> > > 
> > > This patch seems harmless. However I am curious, would anyone attempt to
> > > build the CRT with `-mrtd` (__stdcall by default), or the CRT for 
> > > something
> > > else such as a driver?
> > 
> > I'm playing with CRT compiled with -Os -flto -ffat-lto-objects flags and
> > for some unknown reasons I'm getting following warning when compiling
> > trivial wprintf hello world application with msvcrt.dll and with mingw
> > wprintf function (-D__USE_MINGW_ANSI_STDIO=1).
> > 
> > mingw-w64-headers/crt/wchar.h:1426:18: warning: type of ‘mbrtowc’ does not 
> > match original declaration [-Wlto-type-mismatch]
> >   size_t __cdecl mbrtowc(wchar_t * __restrict__ _DstCh,const char * 
> > __restrict__ _SrcCh,size_t _SizeInBytes,mbstate_t * __restrict__ _State);
> >                  ^
> > misc/mbrtowc.c:96:1: note: ‘mbrtowc’ was previously declared here
> > misc/mbrtowc.c:96:1: note: code may be misoptimized unless 
> > -fno-strict-aliasing is used
> > 
> > I thought that adding missing __cdecl would fix it, but no. Warning is
> > still there. So I sent at least the patch to align declaration.
> > 
> > Do do you have any idea, why GCC is throwing that warning? Why the
> > declaration for LTO does not match?
> 
> Sorry, no idea about that - but the patch does indeed seem reasonable to use
> this attribute consistently, so we should probably apply it.
> 
> // Martin

I agree that consistency is a good argument here.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to