-- Best regards, Liu Hao
From 1c8801fc3ffe0723c2203d87d5d5c42dc25d64d1 Mon Sep 17 00:00:00 2001 From: Liu Hao <[email protected]> Date: Sun, 18 Apr 2021 21:29:31 +0800 Subject: [PATCH] crt/{stdio,conio,wchar}: Move attributes before function declarators
The preferred order of declaring a function is: attributes linkage-specifiers return-type identifier parameters For example: __attribute__((__pure__, __nothrow__)) extern size_t strlen(const char* __Str); __attribute__((__noreturn__, __nothrow__)) extern void exit(int _Status); Attributes can be specified last if the declaration is not a definition (i.e. it is followed by a semicolon instead of function body), which will otherwise not compile. Signed-off-by: Liu Hao <[email protected]> --- mingw-w64-headers/crt/conio.h | 12 ++++++++---- mingw-w64-headers/crt/stdio.h | 36 +++++++++++++++++------------------ mingw-w64-headers/crt/wchar.h | 20 +++++++++---------- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/mingw-w64-headers/crt/conio.h b/mingw-w64-headers/crt/conio.h index f7e80b1a..97b4e342 100644 --- a/mingw-w64-headers/crt/conio.h +++ b/mingw-w64-headers/crt/conio.h @@ -39,7 +39,8 @@ extern "C" { __builtin_va_end(_ArgList); return _Ret; } - __mingw_ovr int __cdecl _cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _cscanf(const char * __restrict__ _Format,...) { __builtin_va_list _ArgList; int _Ret; @@ -48,7 +49,8 @@ extern "C" { __builtin_va_end(_ArgList); return _Ret; } - __mingw_ovr int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) { __builtin_va_list _ArgList; int _Ret; @@ -161,7 +163,8 @@ extern "C" { __builtin_va_end(_ArgList); return _Ret; } - __mingw_ovr int __cdecl _cwscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _cwscanf(const wchar_t * __restrict__ _Format,...) { __builtin_va_list _ArgList; int _Ret; @@ -170,7 +173,8 @@ extern "C" { __builtin_va_end(_ArgList); return _Ret; } - __mingw_ovr int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) { __builtin_va_list _ArgList; int _Ret; diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index fe15add0..846487a0 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -497,9 +497,9 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2) int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; - __mingw_ovr + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) - int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -508,9 +508,9 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li __builtin_va_end(__ap); return __ret; } - __mingw_ovr + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN __attribute__((__format__ (__MINGW_SCANF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1) - int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl scanf(const char * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -519,9 +519,9 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li __builtin_va_end(__ap); return __ret; } - __mingw_ovr + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) - int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -756,8 +756,8 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li __builtin_va_end(__ap); return __ret; } - __mingw_ovr - int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -777,9 +777,9 @@ int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_li #ifdef _UCRT __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; - __mingw_ovr + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) - int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -1159,8 +1159,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti #else /* !__USE_MINGW_ANSI_STDIO */ #ifdef _UCRT - __mingw_ovr - int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -1169,8 +1169,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_ovr - int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -1179,8 +1179,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_ovr - int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -1313,8 +1313,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_static_ovr - int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_static_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index 1dd912f2..ddafe773 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -654,8 +654,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti #else /* !__USE_MINGW_ANSI_STDIO */ #ifdef _UCRT - __mingw_ovr - int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -664,8 +664,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_ovr - int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -674,8 +674,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_ovr - int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -809,8 +809,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_static_ovr - int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_static_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) { __builtin_va_list __ap; int __ret; @@ -819,8 +819,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __builtin_va_end(__ap); return __ret; } - __mingw_ovr - int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN + __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN + int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) { return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args); } -- 2.31.1
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
