On Sun, 15 Sep 2024, Pali Rohár wrote:

gcc 8+ throws warning during imaxdiv.c compilation:

 misc/imaxdiv.c:34:1: warning: ‘lldiv’ alias between functions of incompatible types 
‘lldiv_t(long long int,  long long int)’ {aka ‘struct <anonymous>(long long int,  
long long int)’} and ‘imaxdiv_t(intmax_t,  intmax_t)’ {aka ‘struct <anonymous>(long 
long int,  long long int)’} [-Wattribute-alias]
   lldiv (long long, long long);
   ^~~~~
 misc/imaxdiv.c:23:1: note: aliased declaration here
   imaxdiv(intmax_t numer, intmax_t denom)

lldiv_t and imaxdiv_t structures are compatible, they have same members,
just defined for each function separately. This is how they are defined
also in MS VC++ header files.

Warning could be avoided by using typedef between structures, but this may
cause problems for C++ applications which overloaded functions which have
lldiv_t or imaxdiv_t parameters.

So rather locally disable this warning for gcc. Current code should be OK.
---
mingw-w64-crt/misc/imaxdiv.c | 11 +++++++++++
1 file changed, 11 insertions(+)

This seems ok, so I pushed it.

I wasn't able to trigger any warning for this with Clang, even if using -Weverything -pedantic.

// Martin

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

Reply via email to