crt: Ignore more -Wattribute-alias warnings Clang 23 added the -Wattribute-alias warning just like GCC has had since GCC 8. When the functions take pointers to different structs (even if they may have identical members), Clang 23 warns about this mismatch under -Wattribute-alias, while GCC doesn't. A different kind of case is __mingw_strtold, which is aliased to __strtod when long double and regular doubles have the same size. This codepath hasn't been regularly built with GCC, but Clang now warns about it. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/gdtoa/strtodnrp.c b/mingw-w64-crt/gdtoa/strtodnrp.c index 9304866..523e36e 100644 --- a/mingw-w64-crt/gdtoa/strtodnrp.c +++ b/mingw-w64-crt/gdtoa/strtodnrp.c
@@ -89,7 +89,12 @@ /* For systems other than x86, where long double == double, provide the * long double functions as aliases to __strtod. */ +#undef Long +#undef Bias +#include "internal.h" +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN long double __cdecl __mingw_strtold (const char * __restrict__ src, char ** __restrict__ endptr) __attribute__((alias("__strtod"))); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/misc/ftime32.c b/mingw-w64-crt/misc/ftime32.c index 2ff79ba..d0df00f 100644 --- a/mingw-w64-crt/misc/ftime32.c +++ b/mingw-w64-crt/misc/ftime32.c
@@ -7,6 +7,7 @@ #include <stdint.h> #include <errno.h> #include <sys/timeb.h> +#include "internal.h" int __cdecl ftime32(struct __timeb32 *tb32); int __cdecl ftime32(struct __timeb32 *tb32) @@ -34,5 +35,7 @@ /* On 32-bit systems is ftime ABI using 32-bit time_t */ #ifndef _WIN64 +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias("ftime32"))) __cdecl ftime(struct timeb *); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/misc/ftime64.c b/mingw-w64-crt/misc/ftime64.c index c30003b..5928e99 100644 --- a/mingw-w64-crt/misc/ftime64.c +++ b/mingw-w64-crt/misc/ftime64.c
@@ -5,6 +5,7 @@ */ #include <sys/timeb.h> +#include "internal.h" int __cdecl ftime64(struct __timeb64 *tb64); int __cdecl ftime64(struct __timeb64 *tb64) @@ -15,5 +16,7 @@ /* On 64-bit systems is ftime ABI using 64-bit time_t */ #ifdef _WIN64 +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias("ftime64"))) __cdecl ftime(struct timeb *); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/misc/ftw32.c b/mingw-w64-crt/misc/ftw32.c index 5eb9e37..cbfbead 100644 --- a/mingw-w64-crt/misc/ftw32.c +++ b/mingw-w64-crt/misc/ftw32.c
@@ -9,11 +9,15 @@ #define STRUCT_STAT struct _stat32 #include "ftw.c" +#include "internal.h" + /* On 32-bit systems is stat ABI compatible with stat32 */ #ifndef _WIN64 #undef nftw #undef ftw struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("nftw32"))) __cdecl nftw(const char *, int (*) (const char *, const struct stat *, int, struct FTW *), int, int); int __attribute__ ((alias ("ftw32"))) __cdecl ftw(const char *, int (*) (const char *, const struct stat *, int), int); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/misc/ftw64i32.c b/mingw-w64-crt/misc/ftw64i32.c index 2ded6ec..7cb8b46 100644 --- a/mingw-w64-crt/misc/ftw64i32.c +++ b/mingw-w64-crt/misc/ftw64i32.c
@@ -9,11 +9,15 @@ #define STRUCT_STAT struct _stat64i32 #include "ftw.c" +#include "internal.h" + /* On 64-bit systems is stat ABI compatible with stat64i32 */ #ifdef _WIN64 #undef nftw #undef ftw struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("nftw64i32"))) __cdecl nftw(const char *, int (*) (const char *, const struct stat *, int, struct FTW *), int, int); int __attribute__ ((alias ("ftw64i32"))) __cdecl ftw(const char *, int (*) (const char *, const struct stat *, int), int); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/_wfindfirst32.c b/mingw-w64-crt/stdio/_wfindfirst32.c index a22a979..e6038eb 100644 --- a/mingw-w64-crt/stdio/_wfindfirst32.c +++ b/mingw-w64-crt/stdio/_wfindfirst32.c
@@ -1,5 +1,6 @@ #include <io.h> #include <string.h> +#include "internal.h" intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename, struct _wfinddata32_t *_FindData) { @@ -20,6 +21,8 @@ #ifndef _WIN64 #undef _wfindfirst +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN intptr_t __attribute__ ((alias ("_wfindfirst32"))) __cdecl _wfindfirst(const char *, struct _wfinddata32_t *); extern intptr_t __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_wfindfirst32))))) (__cdecl *__MINGW_IMP_SYMBOL(_wfindfirst))(const char *, struct _wfinddata32_t *); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110plus_fstat32.c b/mingw-w64-crt/stdio/msvcr110plus_fstat32.c index dfc57b2..ea91395 100644 --- a/mingw-w64-crt/stdio/msvcr110plus_fstat32.c +++ b/mingw-w64-crt/stdio/msvcr110plus_fstat32.c
@@ -7,6 +7,7 @@ #include <sys/stat.h> #include <stdlib.h> #include "__mingw_fix_stat.h" +#include "internal.h" int __cdecl fstat32(int fd, struct _stat32 *stat); int __cdecl fstat32(int fd, struct _stat32 *stat) @@ -19,6 +20,8 @@ #ifndef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("fstat32"))) __cdecl fstat(int fd, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(fstat32))))) (__cdecl *__MINGW_IMP_SYMBOL(fstat))(int fd, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110plus_fstat64i32.c b/mingw-w64-crt/stdio/msvcr110plus_fstat64i32.c index 7b14828..f2290f4 100644 --- a/mingw-w64-crt/stdio/msvcr110plus_fstat64i32.c +++ b/mingw-w64-crt/stdio/msvcr110plus_fstat64i32.c
@@ -7,6 +7,7 @@ #include <sys/stat.h> #include <stdlib.h> #include "__mingw_fix_stat.h" +#include "internal.h" int __cdecl fstat64i32(int fd, struct _stat64i32 *stat); int __cdecl fstat64i32(int fd, struct _stat64i32 *stat) @@ -19,6 +20,8 @@ #ifdef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("fstat64i32"))) __cdecl fstat(int fd, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(fstat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(fstat))(int fd, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110plus_stat32.c b/mingw-w64-crt/stdio/msvcr110plus_stat32.c index 9042cea..803ad5e 100644 --- a/mingw-w64-crt/stdio/msvcr110plus_stat32.c +++ b/mingw-w64-crt/stdio/msvcr110plus_stat32.c
@@ -7,6 +7,7 @@ #include <sys/stat.h> #include <stdlib.h> #include "__mingw_fix_stat.h" +#include "internal.h" int __cdecl fstat32(int fd, struct _stat32 *stat); int __cdecl stat32(const char *_Filename, struct _stat32 *_Stat); @@ -20,6 +21,8 @@ #ifndef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("stat32"))) __cdecl stat(const char *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(stat32))))) (__cdecl *__MINGW_IMP_SYMBOL(stat))(const char *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110plus_stat64i32.c b/mingw-w64-crt/stdio/msvcr110plus_stat64i32.c index 9ccd462..0c6960b 100644 --- a/mingw-w64-crt/stdio/msvcr110plus_stat64i32.c +++ b/mingw-w64-crt/stdio/msvcr110plus_stat64i32.c
@@ -7,6 +7,7 @@ #include <sys/stat.h> #include <stdlib.h> #include "__mingw_fix_stat.h" +#include "internal.h" int __cdecl fstat64i32(int fd, struct _stat64i32 *stat); int __cdecl stat64i32(const char *_Filename, struct _stat64i32 *_Stat); @@ -20,6 +21,8 @@ #ifdef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("stat64i32"))) __cdecl stat(const char *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(stat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(stat))(const char *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110plus_wstat32.c b/mingw-w64-crt/stdio/msvcr110plus_wstat32.c index bbae9c2..113588e 100644 --- a/mingw-w64-crt/stdio/msvcr110plus_wstat32.c +++ b/mingw-w64-crt/stdio/msvcr110plus_wstat32.c
@@ -7,6 +7,7 @@ #include <sys/stat.h> #include <stdlib.h> #include "__mingw_fix_stat.h" +#include "internal.h" int __cdecl fstat32(int fd, struct _stat32 *stat); int __cdecl wstat32(const wchar_t *_Filename, struct _stat32 *_Stat); @@ -21,6 +22,8 @@ #undef stat #undef wstat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("wstat32"))) __cdecl wstat(const wchar_t *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wstat32))))) (__cdecl *__MINGW_IMP_SYMBOL(wstat))(const wchar_t *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110plus_wstat64i32.c b/mingw-w64-crt/stdio/msvcr110plus_wstat64i32.c index e0a37f4..03ab533 100644 --- a/mingw-w64-crt/stdio/msvcr110plus_wstat64i32.c +++ b/mingw-w64-crt/stdio/msvcr110plus_wstat64i32.c
@@ -7,6 +7,7 @@ #include <sys/stat.h> #include <stdlib.h> #include "__mingw_fix_stat.h" +#include "internal.h" int __cdecl fstat64i32(int fd, struct _stat64i32 *stat); int __cdecl wstat64i32(const wchar_t *_Filename, struct _stat64i32 *_Stat); @@ -21,6 +22,8 @@ #undef stat #undef wstat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("wstat64i32"))) __cdecl wstat(const wchar_t *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wstat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(wstat))(const wchar_t *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110pre_fstat32.c b/mingw-w64-crt/stdio/msvcr110pre_fstat32.c index cbc6dbb..9abc36a 100644 --- a/mingw-w64-crt/stdio/msvcr110pre_fstat32.c +++ b/mingw-w64-crt/stdio/msvcr110pre_fstat32.c
@@ -9,6 +9,7 @@ #include <stdint.h> #include <errno.h> #include "__mingw_fix_stat.h" +#include "internal.h" /* For pre-msvcr110 builds, we cannot use _fstat32() as it does * not signal EOVERFLOW when file size does not fit into the st_size field, @@ -45,6 +46,8 @@ #ifndef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("fstat32"))) __cdecl fstat(int fd, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(fstat32))))) (__cdecl *__MINGW_IMP_SYMBOL(fstat))(int fd, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110pre_fstat64i32.c b/mingw-w64-crt/stdio/msvcr110pre_fstat64i32.c index 6ca74be..bdb8c3e 100644 --- a/mingw-w64-crt/stdio/msvcr110pre_fstat64i32.c +++ b/mingw-w64-crt/stdio/msvcr110pre_fstat64i32.c
@@ -9,6 +9,7 @@ #include <stdint.h> #include <errno.h> #include "__mingw_fix_stat.h" +#include "internal.h" /* For pre-msvcr110 builds, we cannot use _fstat64i32() as it does * not signal EOVERFLOW when file size does not fit into the st_size field, @@ -45,6 +46,8 @@ #ifdef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("fstat64i32"))) __cdecl fstat(int fd, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(fstat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(fstat))(int fd, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110pre_stat32.c b/mingw-w64-crt/stdio/msvcr110pre_stat32.c index 296f7c3..924f234 100644 --- a/mingw-w64-crt/stdio/msvcr110pre_stat32.c +++ b/mingw-w64-crt/stdio/msvcr110pre_stat32.c
@@ -9,6 +9,7 @@ #include <stdint.h> #include <errno.h> #include "__mingw_fix_stat.h" +#include "internal.h" /* For pre-msvcr110 builds, we cannot use _stat32() as it does * not signal EOVERFLOW when file size does not fit into the st_size field, @@ -46,6 +47,8 @@ #ifndef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("stat32"))) __cdecl stat(const char *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(stat32))))) (__cdecl *__MINGW_IMP_SYMBOL(stat))(const char *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110pre_stat64i32.c b/mingw-w64-crt/stdio/msvcr110pre_stat64i32.c index 7e2cdf7..4e5680e 100644 --- a/mingw-w64-crt/stdio/msvcr110pre_stat64i32.c +++ b/mingw-w64-crt/stdio/msvcr110pre_stat64i32.c
@@ -9,6 +9,7 @@ #include <stdint.h> #include <errno.h> #include "__mingw_fix_stat.h" +#include "internal.h" /* For pre-msvcr110 builds, we cannot use _stat64i32() as it does * not signal EOVERFLOW when file size does not fit into the st_size field, @@ -45,6 +46,8 @@ #ifdef _WIN64 #undef stat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("stat64i32"))) __cdecl stat(const char *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(stat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(stat))(const char *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110pre_wstat32.c b/mingw-w64-crt/stdio/msvcr110pre_wstat32.c index db5886b..a54e879 100644 --- a/mingw-w64-crt/stdio/msvcr110pre_wstat32.c +++ b/mingw-w64-crt/stdio/msvcr110pre_wstat32.c
@@ -9,6 +9,7 @@ #include <stdint.h> #include <errno.h> #include "__mingw_fix_stat.h" +#include "internal.h" /* For pre-msvcr110 builds, we cannot use _wstat32() as it does * not signal EOVERFLOW when file size does not fit into the st_size field, @@ -47,6 +48,8 @@ #undef stat #undef wstat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("wstat32"))) __cdecl wstat(const wchar_t *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wstat32))))) (__cdecl *__MINGW_IMP_SYMBOL(wstat))(const wchar_t *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif
diff --git a/mingw-w64-crt/stdio/msvcr110pre_wstat64i32.c b/mingw-w64-crt/stdio/msvcr110pre_wstat64i32.c index 4266287..09430be 100644 --- a/mingw-w64-crt/stdio/msvcr110pre_wstat64i32.c +++ b/mingw-w64-crt/stdio/msvcr110pre_wstat64i32.c
@@ -9,6 +9,7 @@ #include <stdint.h> #include <errno.h> #include "__mingw_fix_stat.h" +#include "internal.h" /* For pre-msvcr110 builds, we cannot use _wstat64i32() as it does * not signal EOVERFLOW when file size does not fit into the st_size field, @@ -46,6 +47,8 @@ #undef stat #undef wstat struct stat; +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_BEGIN int __attribute__ ((alias ("wstat64i32"))) __cdecl wstat(const wchar_t *name, struct stat *stat); extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wstat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(wstat))(const wchar_t *name, struct stat *stat); +PRAGMA_DIAGNOSTIC_IGNORED_ATTRIBUTE_ALIAS_END #endif