headers: Replace extern "C" and drop #pragma pack This commit replaces extern "C" with _CRT_BEGIN_C_HEADER and _CRT_END_C_HEADER in the crt headers. #pragma pack(push, _CRT_PACKING) is dropped in all headers because GCC, Clang, and MSVC all have different understanding of it, and dropping it makes GCC and Clang to be both compatible with UCRT and each other. Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/include/internal.h b/mingw-w64-crt/include/internal.h index f1561a6..a01f704 100644 --- a/mingw-w64-crt/include/internal.h +++ b/mingw-w64-crt/include/internal.h
@@ -17,8 +17,6 @@ #include <fenv.h> #include <windows.h> -#pragma pack(push,_CRT_PACKING) - #define __IOINFO_TM_ANSI 0 #define __IOINFO_TM_UTF8 1 #define __IOINFO_TM_UTF16LE 2 @@ -311,5 +309,4 @@ } #endif -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/_mingw_locale.h b/mingw-w64-headers/crt/_mingw_locale.h index 7dadb94..b1ffc23 100644 --- a/mingw-w64-headers/crt/_mingw_locale.h +++ b/mingw-w64-headers/crt/_mingw_locale.h
@@ -17,9 +17,7 @@ * but since there is no corecrt_wlocale.h, we name it _mingw_locale.h instead. */ -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #if __MSVCRT_VERSION__ >= 0x200 _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); @@ -29,8 +27,6 @@ _CRTIMP _locale_t __cdecl _wcreate_locale(int _Category, const wchar_t *_Locale); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* _INC_MINGW_LOCALE */
diff --git a/mingw-w64-headers/crt/assert.h b/mingw-w64-headers/crt/assert.h index 51a223a..5dd20e2 100644 --- a/mingw-w64-headers/crt/assert.h +++ b/mingw-w64-headers/crt/assert.h
@@ -17,16 +17,12 @@ #include <stdlib.h> #endif -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _CRTIMP void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); void __cdecl _assert (const char *_Message, const char *_File, unsigned _Line); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* !defined (__ASSERT_H_) */
diff --git a/mingw-w64-headers/crt/complex.h b/mingw-w64-headers/crt/complex.h index 5d99a29..1fce927 100644 --- a/mingw-w64-headers/crt/complex.h +++ b/mingw-w64-headers/crt/complex.h
@@ -42,9 +42,7 @@ #define I _Complex_I -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef RC_INVOKED @@ -211,8 +209,6 @@ #endif /* RC_INVOKED */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* _COMPLEX_H */
diff --git a/mingw-w64-headers/crt/conio.h b/mingw-w64-headers/crt/conio.h index 5b9cdf0..44c3e0c 100644 --- a/mingw-w64-headers/crt/conio.h +++ b/mingw-w64-headers/crt/conio.h
@@ -11,9 +11,7 @@ #include <corecrt_wconio.h> #include <stddef.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER /** * Functions to read/write strings from/to console. @@ -193,9 +191,7 @@ #endif /* NO_OLDNAMES */ #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #include <sec_api/conio_s.h>
diff --git a/mingw-w64-headers/crt/corecrt.h b/mingw-w64-headers/crt/corecrt.h index 9a24fa7..fd9aecb 100644 --- a/mingw-w64-headers/crt/corecrt.h +++ b/mingw-w64-headers/crt/corecrt.h
@@ -9,14 +9,12 @@ #include <_mingw.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef __WIDL__ +/* Obsolete because of buggy behaviour */ #undef _CRT_PACKING #define _CRT_PACKING 8 -#pragma pack(push,_CRT_PACKING) #endif #ifdef __ERRCODE_DEFINED_MS @@ -493,12 +491,6 @@ #endif /* !WINAPI_FAMILY */ #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ -#ifndef __WIDL__ -#pragma pack(pop) -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif +_CRT_END_C_HEADER #endif /* _INC_CORECRT */
diff --git a/mingw-w64-headers/crt/corecrt_memory.h b/mingw-w64-headers/crt/corecrt_memory.h index 42d299e..7eb4573 100644 --- a/mingw-w64-headers/crt/corecrt_memory.h +++ b/mingw-w64-headers/crt/corecrt_memory.h
@@ -8,9 +8,7 @@ #include <crtdefs.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); #if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L || _XOPEN_SOURCE + 0 >= 600 @@ -33,9 +31,7 @@ int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005; #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #ifdef __cplusplus extern "C++" inline void* memchr(void* __s, int __c, size_t __n)
diff --git a/mingw-w64-headers/crt/corecrt_startup.h b/mingw-w64-headers/crt/corecrt_startup.h index 37391aa..6afa761 100644 --- a/mingw-w64-headers/crt/corecrt_startup.h +++ b/mingw-w64-headers/crt/corecrt_startup.h
@@ -9,9 +9,7 @@ #include <corecrt.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER typedef enum _crt_app_type { _crt_unknown_app, @@ -67,7 +65,6 @@ _CRTIMP int __cdecl _crt_atexit(_PVFV func); _CRTIMP int __cdecl _crt_at_quick_exit(_PVFV func); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/corecrt_stdio_config.h b/mingw-w64-headers/crt/corecrt_stdio_config.h index 366d90a..20c5d8f 100644 --- a/mingw-w64-headers/crt/corecrt_stdio_config.h +++ b/mingw-w64-headers/crt/corecrt_stdio_config.h
@@ -9,9 +9,7 @@ #include <corecrt.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER unsigned __int64* __cdecl __local_stdio_printf_options(void); unsigned __int64* __cdecl __local_stdio_scanf_options(void); @@ -35,7 +33,6 @@ #define _CRT_INTERNAL_LOCAL_SCANF_OPTIONS (*__local_stdio_scanf_options()) #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif /* _STDIO_CONFIG_DEFINED */
diff --git a/mingw-w64-headers/crt/corecrt_wconio.h b/mingw-w64-headers/crt/corecrt_wconio.h index 7b741a2..12bd7ef 100644 --- a/mingw-w64-headers/crt/corecrt_wconio.h +++ b/mingw-w64-headers/crt/corecrt_wconio.h
@@ -11,9 +11,7 @@ #include <corecrt_stdio_config.h> #include <stddef.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef WEOF #define WEOF (wint_t)(0xFFFF) @@ -137,9 +135,7 @@ _CRTIMP int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; #endif /* _UCRT */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #include <sec_api/wconio_s.h>
diff --git a/mingw-w64-headers/crt/corecrt_wctype.h b/mingw-w64-headers/crt/corecrt_wctype.h index bed41be..0716ff8 100644 --- a/mingw-w64-headers/crt/corecrt_wctype.h +++ b/mingw-w64-headers/crt/corecrt_wctype.h
@@ -8,9 +8,7 @@ #include <corecrt.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef WEOF #define WEOF (wint_t)(0xFFFF) @@ -176,8 +174,6 @@ #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/corecrt_wstdlib.h b/mingw-w64-headers/crt/corecrt_wstdlib.h index d525397..aa31693 100644 --- a/mingw-w64-headers/crt/corecrt_wstdlib.h +++ b/mingw-w64-headers/crt/corecrt_wstdlib.h
@@ -8,9 +8,7 @@ #include <corecrt.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) #pragma push_macro("_wdupenv_s") @@ -47,8 +45,7 @@ _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); __DEFINE_CPP_OVERLOAD_SECURE_FUNC_SPLITPATH(errno_t,_wsplitpath_s,wchar_t,_Dest) -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif /* _INC_CORECRT_WSTDLIB */
diff --git a/mingw-w64-headers/crt/corecrt_wstring.h b/mingw-w64-headers/crt/corecrt_wstring.h index 4d7c5ae..22227a7 100644 --- a/mingw-w64-headers/crt/corecrt_wstring.h +++ b/mingw-w64-headers/crt/corecrt_wstring.h
@@ -8,9 +8,7 @@ #include <corecrt.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifdef __cplusplus /* Tell libstdc++ and libc++ we have provided the correct ISO C++ overloads */ @@ -94,9 +92,7 @@ int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2) __MINGW_ATTRIB_DEPRECATED_MSVC2005; #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER /** * ISO C++ requires both const and non-const versions of these functions.
diff --git a/mingw-w64-headers/crt/crtdbg.h b/mingw-w64-headers/crt/crtdbg.h index 9f2818c..900dcf3 100644 --- a/mingw-w64-headers/crt/crtdbg.h +++ b/mingw-w64-headers/crt/crtdbg.h
@@ -9,7 +9,7 @@ #include <crtdefs.h> #include <sal.h> -#pragma pack(push,_CRT_PACKING) +_CRT_BEGIN_C_HEADER #ifndef NULL #ifdef __cplusplus @@ -23,10 +23,6 @@ #endif #endif -#ifdef __cplusplus -extern "C" { -#endif - typedef void *_HFILE; #define _CRT_WARN 0 @@ -436,8 +432,8 @@ #endif /* _DEBUG */ -#ifdef __cplusplus -} +_CRT_END_C_HEADER + /* void *__cdecl operator new[](size_t _Size); inline void *__cdecl operator new(size_t _Size,int,const char *,int) { return ::operator new(_Size); } @@ -446,9 +442,6 @@ inline void __cdecl operator delete(void *_P,int,const char *,int) { ::operator delete(_P); } inline void __cdecl operator delete[](void *_P,int,const char *,int) { ::operator delete[](_P); } */ -#endif - -#pragma pack(pop) #include <sec_api/crtdbg_s.h>
diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index 700a930..3d9f84c 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h
@@ -8,9 +8,7 @@ #include <corecrt_wctype.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER /** * Standard C functions. @@ -138,7 +136,6 @@ _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/direct.h b/mingw-w64-headers/crt/direct.h index df53e95..f1a3983 100644 --- a/mingw-w64-headers/crt/direct.h +++ b/mingw-w64-headers/crt/direct.h
@@ -9,11 +9,7 @@ #include <crtdefs.h> #include <io.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _DISKFREE_T_DEFINED #define _DISKFREE_T_DEFINED @@ -99,9 +95,6 @@ int __cdecl rmdir(const char *_Path) __MINGW_ATTRIB_DEPRECATED_MSVC2005; #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/dirent.h b/mingw-w64-headers/crt/dirent.h index e9a4d1b..fcc499c 100644 --- a/mingw-w64-headers/crt/dirent.h +++ b/mingw-w64-headers/crt/dirent.h
@@ -16,11 +16,7 @@ #ifndef RC_INVOKED -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER struct dirent { @@ -123,11 +119,7 @@ void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long); -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #endif /* Not RC_INVOKED */
diff --git a/mingw-w64-headers/crt/dos.h b/mingw-w64-headers/crt/dos.h index 8cf61f1..b1b3bcc 100644 --- a/mingw-w64-headers/crt/dos.h +++ b/mingw-w64-headers/crt/dos.h
@@ -9,11 +9,7 @@ #include <crtdefs.h> #include <io.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP #ifndef _DISKFREE_T_DEFINED @@ -50,9 +46,6 @@ #define diskfree_t _diskfree_t #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/dvec.h b/mingw-w64-headers/crt/dvec.h index cda0674..077e4aa 100644 --- a/mingw-w64-headers/crt/dvec.h +++ b/mingw-w64-headers/crt/dvec.h
@@ -16,8 +16,6 @@ #include <fvec.h> #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - #if defined(_ENABLE_VEC_DEBUG) #include <iostream> #endif @@ -843,6 +841,5 @@ #endif /* ifdef __SSE__ */ -#pragma pack(pop) #endif #endif
diff --git a/mingw-w64-headers/crt/eh.h b/mingw-w64-headers/crt/eh.h index 5d1c0cf..851ccae 100644 --- a/mingw-w64-headers/crt/eh.h +++ b/mingw-w64-headers/crt/eh.h
@@ -15,8 +15,6 @@ #ifndef RC_INVOKED -#pragma pack(push,_CRT_PACKING) - typedef void (__cdecl *terminate_function)(); typedef void (__cdecl *terminate_handler)(); typedef void (__cdecl *unexpected_function)(); @@ -35,7 +33,6 @@ _CRTIMP _se_translator_function __cdecl _set_se_translator(_se_translator_function _NewPtFunc); _CRTIMP bool __cdecl __uncaught_exception(); -#pragma pack(pop) #endif #endif /* End _EH_H_ */
diff --git a/mingw-w64-headers/crt/errno.h b/mingw-w64-headers/crt/errno.h index 9838a62..156652c 100644 --- a/mingw-w64-headers/crt/errno.h +++ b/mingw-w64-headers/crt/errno.h
@@ -8,9 +8,7 @@ #include <crtdefs.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRT_ERRNO_DEFINED #define _CRT_ERRNO_DEFINED @@ -235,7 +233,6 @@ #define EOVERFLOW 132 #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/excpt.h b/mingw-w64-headers/crt/excpt.h index 3c03f4f..dec9dec 100644 --- a/mingw-w64-headers/crt/excpt.h +++ b/mingw-w64-headers/crt/excpt.h
@@ -8,11 +8,7 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER struct _EXCEPTION_POINTERS; @@ -122,9 +118,6 @@ #define __except1 #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/fenv.h b/mingw-w64-headers/crt/fenv.h index 2fccf40..be7550e 100644 --- a/mingw-w64-headers/crt/fenv.h +++ b/mingw-w64-headers/crt/fenv.h
@@ -55,9 +55,7 @@ /* Type representing exception flags. */ typedef unsigned long fexcept_t; -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER /* The FE_DFL_ENV macro is required by standard. fesetenv will use the environment set at app startup.*/ @@ -105,9 +103,8 @@ extern int __cdecl fegetexcept(void); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif /* Not RC_INVOKED */ #endif /* ndef _FENV_H */
diff --git a/mingw-w64-headers/crt/float.h b/mingw-w64-headers/crt/float.h index af21463..f4bd39b 100644 --- a/mingw-w64-headers/crt/float.h +++ b/mingw-w64-headers/crt/float.h
@@ -264,9 +264,7 @@ #ifndef RC_INVOKED -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER /* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask), * i.e. change the bits in unMask to have the values they have in unNew, @@ -324,9 +322,7 @@ extern long double __cdecl _chgsignl (long double); #endif /* _SIGN_DEFINED */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* Not RC_INVOKED */
diff --git a/mingw-w64-headers/crt/fpieee.h b/mingw-w64-headers/crt/fpieee.h index 62086c0..28cd312 100644 --- a/mingw-w64-headers/crt/fpieee.h +++ b/mingw-w64-headers/crt/fpieee.h
@@ -8,11 +8,7 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER typedef enum { _FpCompareEqual,_FpCompareGreater,_FpCompareLess,_FpCompareUnordered @@ -153,9 +149,6 @@ _CRTIMP int __cdecl _fpieee_flt(unsigned long _ExceptionCode,struct _EXCEPTION_POINTERS *_PtExceptionPtr,int (__cdecl *_Handler)(_FPIEEE_RECORD *)); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/ftw.h b/mingw-w64-headers/crt/ftw.h index 8dca99b..a1b64bf 100644 --- a/mingw-w64-headers/crt/ftw.h +++ b/mingw-w64-headers/crt/ftw.h
@@ -9,9 +9,7 @@ #include <sys/types.h> #include <sys/stat.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER struct FTW { int base; @@ -83,8 +81,6 @@ int ftw64 (const char *, int (*) (const char *, const struct stat64 *, int), int); int nftw64 (const char *, int (*) (const char *, const struct stat64 *, int , struct FTW *), int, int); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/fvec.h b/mingw-w64-headers/crt/fvec.h index 48a343c..95071e1 100644 --- a/mingw-w64-headers/crt/fvec.h +++ b/mingw-w64-headers/crt/fvec.h
@@ -19,8 +19,6 @@ #include <iostream> #endif -#pragma pack(push,_CRT_PACKING) - #ifdef __SSE__ #pragma pack(push,16) @@ -247,7 +245,6 @@ #pragma pack(pop) #endif /* #ifdef __SSE__ */ -#pragma pack(pop) #include <ivec.h>
diff --git a/mingw-w64-headers/crt/getopt.h b/mingw-w64-headers/crt/getopt.h index 35c9c7f..63845ed 100644 --- a/mingw-w64-headers/crt/getopt.h +++ b/mingw-w64-headers/crt/getopt.h
@@ -15,9 +15,7 @@ /* All the headers include this file. */ #include <crtdefs.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER extern int optind; /* index of first non-option in argv */ extern int optopt; /* single option character, as parsed */ @@ -28,9 +26,8 @@ extern int getopt(int nargc, char * const *nargv, const char *options); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + /* * POSIX requires the `getopt' API to be specified in `unistd.h'; * thus, `unistd.h' includes this header. However, we do not want @@ -57,9 +54,7 @@ #if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) #define __GETOPT_LONG_H__ -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER struct option /* specification for a long form option... */ { @@ -90,8 +85,6 @@ # define HAVE_DECL_GETOPT 1 #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */
diff --git a/mingw-w64-headers/crt/intrin.h b/mingw-w64-headers/crt/intrin.h index 2b48a72..87ad933 100644 --- a/mingw-w64-headers/crt/intrin.h +++ b/mingw-w64-headers/crt/intrin.h
@@ -62,9 +62,8 @@ /* Make sure _mm_malloc and _mm_free are defined. */ #include <malloc.h> #endif -#if defined(__cplusplus) -extern "C" { -#endif + +_CRT_BEGIN_C_HEADER #include <x86intrin.h> #include <cpuid.h> @@ -76,9 +75,7 @@ #undef _lrotl #undef _lrotr -#if defined(__cplusplus) -} -#endif +_CRT_END_C_HEADER #endif @@ -106,46 +103,30 @@ #if (defined(_X86_) || (defined(__x86_64) && !defined(__arm64ec__))) #if defined(__MMX__) || defined(__MINGW_FORCE_SYS_INTRINS) -#if defined(__cplusplus) -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #include <mmintrin.h> -#if defined(__cplusplus) -} -#endif +_CRT_END_C_HEADER #endif /* Note: mm3dnow.h intentionally not included; 3DNow! is deprecated. */ /* NOTE: it's not included by MS version, but we do it to try work around C++/C linkage differences */ #if defined(__SSE__) || defined(__MINGW_FORCE_SYS_INTRINS) -#if defined(__cplusplus) -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #include <xmmintrin.h> -#if defined(__cplusplus) -} -#endif +_CRT_END_C_HEADER #endif #if defined(__SSE2__) || defined(__MINGW_FORCE_SYS_INTRINS) -#if defined(__cplusplus) -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #include <emmintrin.h> -#if defined(__cplusplus) -} -#endif +_CRT_END_C_HEADER #endif #if defined(__SSE3__) || defined(__MINGW_FORCE_SYS_INTRINS) -#if defined(__cplusplus) -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #include <pmmintrin.h> -#if defined(__cplusplus) -} -#endif +_CRT_END_C_HEADER #endif #endif @@ -248,9 +229,7 @@ #define __MACHINECE __MACHINEZ #endif -#if defined(__cplusplus) -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef __CYGWIN__ /* Put all declarations potentially colliding with POSIX headers here. @@ -1701,9 +1680,8 @@ #endif #endif -#if defined(__cplusplus) -} -#endif +_CRT_END_C_HEADER + #endif #endif /* end __INTRIN_H_ */
diff --git a/mingw-w64-headers/crt/inttypes.h b/mingw-w64-headers/crt/inttypes.h index bb96d77..b853870 100644 --- a/mingw-w64-headers/crt/inttypes.h +++ b/mingw-w64-headers/crt/inttypes.h
@@ -13,9 +13,7 @@ #define __need_wchar_t #include <stddef.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER typedef struct { intmax_t quot; @@ -343,8 +341,6 @@ uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr, int base); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* ndef _INTTYPES_H */
diff --git a/mingw-w64-headers/crt/io.h b/mingw-w64-headers/crt/io.h index be65629..fd3982b 100644 --- a/mingw-w64-headers/crt/io.h +++ b/mingw-w64-headers/crt/io.h
@@ -9,11 +9,7 @@ #include <crtdefs.h> #include <string.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) #pragma push_macro("_getcwd") @@ -457,12 +453,7 @@ #endif /* __MINGW_FORTIFY_VA_ARG */ #endif /* __MINGW_FORTIFY_LEVEL > 0 */ -#ifdef __cplusplus -} -#endif - - -#pragma pack(pop) +_CRT_END_C_HEADER #endif /* End _IO_H_ */
diff --git a/mingw-w64-headers/crt/ivec.h b/mingw-w64-headers/crt/ivec.h index 70e8c5f..e3053a9 100644 --- a/mingw-w64-headers/crt/ivec.h +++ b/mingw-w64-headers/crt/ivec.h
@@ -15,14 +15,10 @@ #include <assert.h> #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - #if defined(_ENABLE_VEC_DEBUG) #include <iostream> #endif -#pragma pack(pop) - #ifdef __SSE__ #define _MM_QW (*((__int64*)&vec))
diff --git a/mingw-w64-headers/crt/libgen.h b/mingw-w64-headers/crt/libgen.h index 86c541f..79ff1f5 100644 --- a/mingw-w64-headers/crt/libgen.h +++ b/mingw-w64-headers/crt/libgen.h
@@ -9,16 +9,12 @@ #include <crtdefs.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER char * __cdecl __MINGW_NOTHROW basename (char *); char * __cdecl __MINGW_NOTHROW dirname (char *); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index f0abe70..e767e28 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h
@@ -12,11 +12,7 @@ #include <stdio.h> #endif -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef NULL #ifdef __cplusplus @@ -151,9 +147,6 @@ /* Variant of _isleadbyte_l() function which takes codepage (instead of _locale_t). */ int __cdecl __mingw_isleadbyte_cp(int c, unsigned int cp); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/malloc.h b/mingw-w64-headers/crt/malloc.h index e1f683f..c26036b 100644 --- a/mingw-w64-headers/crt/malloc.h +++ b/mingw-w64-headers/crt/malloc.h
@@ -8,11 +8,7 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifdef _WIN64 #define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0 @@ -251,10 +247,6 @@ #define _HEAP_EXPAND 6 #endif -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #endif /* _MALLOC_H_ */
diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 94b5f30..cb4d134 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h
@@ -14,8 +14,6 @@ struct _exception; -#pragma pack(push,_CRT_PACKING) - #define _DOMAIN 1 /* domain error in argument */ #define _SING 2 /* singularity */ #define _OVERFLOW 3 /* range overflow */ @@ -105,9 +103,7 @@ #endif -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef __MINGW_SOFTMATH #define __MINGW_SOFTMATH @@ -1444,13 +1440,9 @@ #endif /* __STDC_WANT_DEC_FP__ */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* Not RC_INVOKED */ -#pragma pack(pop) - #endif /* End _MATH_H_ */
diff --git a/mingw-w64-headers/crt/mbctype.h b/mingw-w64-headers/crt/mbctype.h index 29df8eb..7d9d538 100644 --- a/mingw-w64-headers/crt/mbctype.h +++ b/mingw-w64-headers/crt/mbctype.h
@@ -9,9 +9,7 @@ #include <crtdefs.h> #include <ctype.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _mbctype _CRTIMP unsigned char * __cdecl __p__mbctype(void); @@ -89,7 +87,6 @@ _CRTIMP void __cdecl _mbccpy (unsigned char *dest, const unsigned char *src) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; _CRTIMP void __cdecl _mbccpy_l(unsigned char *dest,const unsigned char *src,_locale_t locale) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/mbstring.h b/mingw-w64-headers/crt/mbstring.h index 4e423d1..57a2a54 100644 --- a/mingw-w64-headers/crt/mbstring.h +++ b/mingw-w64-headers/crt/mbstring.h
@@ -8,11 +8,7 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _FILE_DEFINED struct _iobuf { @@ -232,11 +228,7 @@ _CRTIMP unsigned int __cdecl _mbctokata(unsigned int _Ch); _CRTIMP unsigned int __cdecl _mbctokata_l(unsigned int _Ch,_locale_t _Locale); -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #include <sec_api/mbstring_s.h>
diff --git a/mingw-w64-headers/crt/new.h b/mingw-w64-headers/crt/new.h index a690fcc..7869747 100644 --- a/mingw-w64-headers/crt/new.h +++ b/mingw-w64-headers/crt/new.h
@@ -13,9 +13,10 @@ #include <crtdefs.h> #pragma push_macro("new") #undef new -extern "C" { #endif +_CRT_BEGIN_C_HEADER + #ifndef __PLACEMENT_NEW_INLINE #define __PLACEMENT_NEW_INLINE #endif @@ -31,8 +32,9 @@ #define _NO_ANSI_NEW_HANDLER ((new_handler)-1) #define _NO_ANSI_NEW_HANDLER_M ((_new_handler_m)-1) +_CRT_END_C_HEADER + #ifdef __cplusplus -} #pragma pop_macro("new") #endif
diff --git a/mingw-w64-headers/crt/process.h b/mingw-w64-headers/crt/process.h index 1ac39a0..ca4a729 100644 --- a/mingw-w64-headers/crt/process.h +++ b/mingw-w64-headers/crt/process.h
@@ -13,9 +13,8 @@ #include <sys/types.h> #ifndef _POSIX_ -#ifdef __cplusplus -extern "C" { -#endif + +_CRT_BEGIN_C_HEADER #ifndef _P_WAIT #define _P_WAIT 0 @@ -200,8 +199,7 @@ #endif #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif #endif
diff --git a/mingw-w64-headers/crt/search.h b/mingw-w64-headers/crt/search.h index 90af348..1aa6a61 100644 --- a/mingw-w64-headers/crt/search.h +++ b/mingw-w64-headers/crt/search.h
@@ -9,9 +9,7 @@ #include <crtdefs.h> #include <stddef.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRT_ALGO_DEFINED #define _CRT_ALGO_DEFINED @@ -66,9 +64,7 @@ void __cdecl tdestroy(void *, void (*)(void *)) __MINGW_ATTRIB_NONNULL (2); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #include <sec_api/search_s.h>
diff --git a/mingw-w64-headers/crt/sec_api/conio_s.h b/mingw-w64-headers/crt/sec_api/conio_s.h index c788e41..49168e8 100644 --- a/mingw-w64-headers/crt/sec_api/conio_s.h +++ b/mingw-w64-headers/crt/sec_api/conio_s.h
@@ -9,9 +9,7 @@ #include <conio.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER /** * Functions to read/write strings from/to console. @@ -31,8 +29,6 @@ _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/sec_api/mbstring_s.h b/mingw-w64-headers/crt/sec_api/mbstring_s.h index 78f3b66..937723d 100644 --- a/mingw-w64-headers/crt/sec_api/mbstring_s.h +++ b/mingw-w64-headers/crt/sec_api/mbstring_s.h
@@ -8,9 +8,7 @@ #include <mbstring.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst, size_t _SizeInBytes, const unsigned char *_Src); __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _mbscat_s, unsigned char, _Dst, const unsigned char *, _DstSizeInBytes) @@ -42,8 +40,6 @@ _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/sec_api/search_s.h b/mingw-w64-headers/crt/sec_api/search_s.h index 4f0dbdf..d56b9d1 100644 --- a/mingw-w64-headers/crt/sec_api/search_s.h +++ b/mingw-w64-headers/crt/sec_api/search_s.h
@@ -8,9 +8,7 @@ #include <search.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); @@ -20,8 +18,6 @@ _CRTIMP void __cdecl qsort_s(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/sec_api/stdio_s.h b/mingw-w64-headers/crt/sec_api/stdio_s.h index ec943c1..6918a65 100644 --- a/mingw-w64-headers/crt/sec_api/stdio_s.h +++ b/mingw-w64-headers/crt/sec_api/stdio_s.h
@@ -8,9 +8,7 @@ #include <stdio.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _STDIO_S_DEFINED #define _STDIO_S_DEFINED @@ -903,7 +901,6 @@ _CRTIMP size_t __cdecl _fread_nolock_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/sec_api/stdlib_s.h b/mingw-w64-headers/crt/sec_api/stdlib_s.h index 32f4767..2bd58f3 100644 --- a/mingw-w64-headers/crt/sec_api/stdlib_s.h +++ b/mingw-w64-headers/crt/sec_api/stdlib_s.h
@@ -8,9 +8,7 @@ #include <stdlib.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) #pragma push_macro("_dupenv_s") @@ -62,8 +60,6 @@ #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/sec_api/stralign_s.h b/mingw-w64-headers/crt/sec_api/stralign_s.h index 8c69eef..4d29dba 100644 --- a/mingw-w64-headers/crt/sec_api/stralign_s.h +++ b/mingw-w64-headers/crt/sec_api/stralign_s.h
@@ -8,9 +8,7 @@ #include <stralign.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #if !defined(_X86_) && defined(_WSTRING_S_DEFINED) #if defined(__cplusplus) && defined(_WConst_Return) @@ -21,7 +19,6 @@ #endif #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/sec_api/string_s.h b/mingw-w64-headers/crt/sec_api/string_s.h index 9e9cce2..492d726 100644 --- a/mingw-w64-headers/crt/sec_api/string_s.h +++ b/mingw-w64-headers/crt/sec_api/string_s.h
@@ -8,9 +8,7 @@ #include <string.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _strset_s, char, _Dst, int, _Value) @@ -90,7 +88,6 @@ } #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/sec_api/sys/timeb_s.h b/mingw-w64-headers/crt/sec_api/sys/timeb_s.h index c564960..b878488 100644 --- a/mingw-w64-headers/crt/sec_api/sys/timeb_s.h +++ b/mingw-w64-headers/crt/sec_api/sys/timeb_s.h
@@ -9,9 +9,7 @@ #include <sys/timeb.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); @@ -22,8 +20,6 @@ #define _ftime_s _ftime32_s #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/sec_api/tchar_s.h b/mingw-w64-headers/crt/sec_api/tchar_s.h index 405583d..507e498 100644 --- a/mingw-w64-headers/crt/sec_api/tchar_s.h +++ b/mingw-w64-headers/crt/sec_api/tchar_s.h
@@ -8,9 +8,7 @@ #include <tchar.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifdef _UNICODE @@ -271,7 +269,6 @@ #endif #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/sec_api/wchar_s.h b/mingw-w64-headers/crt/sec_api/wchar_s.h index d5d3eac..23fa2e0 100644 --- a/mingw-w64-headers/crt/sec_api/wchar_s.h +++ b/mingw-w64-headers/crt/sec_api/wchar_s.h
@@ -8,9 +8,7 @@ #include <wchar.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER _SECIMP errno_t __cdecl _waccess_s (const wchar_t *_Filename,int _AccessMode); _SECIMP errno_t __cdecl _wmktemp_s (wchar_t *_TemplateName,size_t _SizeInWords); @@ -359,8 +357,6 @@ _SECIMP errno_t __cdecl wmemmove_s(wchar_t *_dest,size_t _numberOfElements,const wchar_t *_src,size_t _count); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/sec_api/wconio_s.h b/mingw-w64-headers/crt/sec_api/wconio_s.h index 7e8eac8..998ca35 100644 --- a/mingw-w64-headers/crt/sec_api/wconio_s.h +++ b/mingw-w64-headers/crt/sec_api/wconio_s.h
@@ -9,9 +9,7 @@ #include <corecrt_wconio.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER /** * Functions to read/write strings from/to console. @@ -31,8 +29,6 @@ _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* _INC_WCONIO_S */
diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h index 0d85d0e..a725572 100644 --- a/mingw-w64-headers/crt/setjmp.h +++ b/mingw-w64-headers/crt/setjmp.h
@@ -8,7 +8,7 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) +_CRT_BEGIN_C_HEADER #ifndef NULL #ifdef __cplusplus @@ -22,10 +22,6 @@ #endif #endif -#ifdef __cplusplus -extern "C" { -#endif - #if defined(__i386__) #define _JBLEN 16 @@ -225,11 +221,8 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif /* _INC_SETJMP */ /*
diff --git a/mingw-w64-headers/crt/signal.h b/mingw-w64-headers/crt/signal.h index 5b47afa..f6273fb 100644 --- a/mingw-w64-headers/crt/signal.h +++ b/mingw-w64-headers/crt/signal.h
@@ -9,9 +9,7 @@ #include <crtdefs.h> #include <pthread_signal.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER typedef int sig_atomic_t; @@ -57,7 +55,6 @@ __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); int __cdecl raise(int _SigNum); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif
diff --git a/mingw-w64-headers/crt/stddef.h b/mingw-w64-headers/crt/stddef.h index 614329f..aefbeb6 100644 --- a/mingw-w64-headers/crt/stddef.h +++ b/mingw-w64-headers/crt/stddef.h
@@ -9,9 +9,7 @@ #ifndef _INC_STDDEF #define _INC_STDDEF -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRT_ERRNO_DEFINED #define _CRT_ERRNO_DEFINED @@ -25,9 +23,7 @@ #define _threadid (__threadid()) _CRTIMP extern uintptr_t __cdecl __threadhandle(void); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* _INC_STDDEF */
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 0428e44..6622b54 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h
@@ -8,7 +8,7 @@ #include <corecrt_stdio_config.h> -#pragma pack(push,_CRT_PACKING) +_CRT_BEGIN_C_HEADER #pragma push_macro("snprintf") #undef snprintf @@ -19,10 +19,6 @@ #pragma push_macro("vsnwprintf") #undef vsnwprintf -#ifdef __cplusplus -extern "C" { -#endif - #define BUFSIZ 512 #define _NFILE _NSTREAM_ #define _NSTREAM_ 512 @@ -1324,16 +1320,12 @@ #endif #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ -#ifdef __cplusplus -} -#endif - #pragma pop_macro("snprintf") #pragma pop_macro("vsnprintf") #pragma pop_macro("snwprintf") #pragma pop_macro("vsnwprintf") -#pragma pack(pop) +_CRT_END_C_HEADER #include <sec_api/stdio_s.h>
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h index 0e3663d..0955d42 100644 --- a/mingw-w64-headers/crt/stdlib.h +++ b/mingw-w64-headers/crt/stdlib.h
@@ -14,11 +14,7 @@ #define __USE_MINGW_STRTOX 1 #endif -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef NULL #ifdef __cplusplus @@ -701,11 +697,7 @@ #endif /* !__NO_ISOCEXT */ -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #include <sec_api/stdlib_s.h> #include <malloc.h>
diff --git a/mingw-w64-headers/crt/string.h b/mingw-w64-headers/crt/string.h index 83b1f84..01859e9 100644 --- a/mingw-w64-headers/crt/string.h +++ b/mingw-w64-headers/crt/string.h
@@ -10,9 +10,7 @@ #include <corecrt_memory.h> #include <corecrt_wstring.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifdef __cplusplus /* Tell libstdc++ and libc++ we have provided the correct ISO C++ overloads */ @@ -122,9 +120,7 @@ char *__cdecl strupr(char *_Str) __MINGW_ATTRIB_DEPRECATED_MSVC2005; #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO extern "C++" { @@ -145,9 +141,8 @@ #include <sec_api/string_s.h> #if __MINGW_FORTIFY_LEVEL > 0 -#ifdef __cplusplus -extern "C" { -#endif + +_CRT_BEGIN_C_HEADER __mingw_bos_declare; @@ -232,9 +227,8 @@ return __mingw_call_wcscat(__dst, __src); } -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER + #endif /* __MINGW_FORTIFY_LEVEL > 0 */ #endif
diff --git a/mingw-w64-headers/crt/sys/stat.h b/mingw-w64-headers/crt/sys/stat.h index 347f66e..f2e243e 100644 --- a/mingw-w64-headers/crt/sys/stat.h +++ b/mingw-w64-headers/crt/sys/stat.h
@@ -13,11 +13,7 @@ #include <crtdefs.h> #include <io.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRTIMP #define _CRTIMP __declspec(dllimport) @@ -189,11 +185,7 @@ #endif -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #endif /* _INC_STAT */
diff --git a/mingw-w64-headers/crt/sys/time.h b/mingw-w64-headers/crt/sys/time.h index 63c8c49..9ef3fd3 100644 --- a/mingw-w64-headers/crt/sys/time.h +++ b/mingw-w64-headers/crt/sys/time.h
@@ -9,9 +9,7 @@ #include <time.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #include <_timeval.h> @@ -43,9 +41,7 @@ void *__restrict__ /* tzp (unused) */); #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER /* Adding timespec definition. */ #include <sys/timeb.h>
diff --git a/mingw-w64-headers/crt/sys/timeb.h b/mingw-w64-headers/crt/sys/timeb.h index d52fd9c..174f2eb 100644 --- a/mingw-w64-headers/crt/sys/timeb.h +++ b/mingw-w64-headers/crt/sys/timeb.h
@@ -12,11 +12,7 @@ #error Only Win32 target is supported! #endif -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRTIMP #define _CRTIMP __declspec(dllimport) @@ -129,11 +125,7 @@ #endif #endif /* _CRTBLD */ -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #include <sec_api/sys/timeb_s.h> #endif
diff --git a/mingw-w64-headers/crt/sys/utime.h b/mingw-w64-headers/crt/sys/utime.h index 4f389f3..4a7dd5d 100644 --- a/mingw-w64-headers/crt/sys/utime.h +++ b/mingw-w64-headers/crt/sys/utime.h
@@ -12,11 +12,7 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRTIMP #define _CRTIMP __declspec(dllimport) @@ -117,9 +113,6 @@ #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h index 2f6c67c..059cc83 100644 --- a/mingw-w64-headers/crt/tchar.h +++ b/mingw-w64-headers/crt/tchar.h
@@ -12,9 +12,7 @@ #error Need to include strsafe.h after tchar.h #endif -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef __CYGWIN__ @@ -74,15 +72,11 @@ #ifdef _UNICODE -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #include <wchar.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef __CYGWIN__ @@ -501,15 +495,11 @@ #else /* _UNICODE */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #include <string.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #define _TEOF EOF @@ -793,17 +783,13 @@ #ifdef _MBCS -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #ifndef __CYGWIN__ #include <mbstring.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef __TCHAR_DEFINED typedef char _TCHAR; @@ -1173,9 +1159,7 @@ #define _T(x) __T(x) #define _TEXT(x) __T(x) -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #ifndef __CYGWIN__ #include <sec_api/tchar_s.h>
diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h index 2caec04..5bcbab7 100644 --- a/mingw-w64-headers/crt/time.h +++ b/mingw-w64-headers/crt/time.h
@@ -15,11 +15,7 @@ /* Adding timespec definition. */ #include <sys/timeb.h> -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef _CRTIMP #define _CRTIMP __declspec(dllimport) @@ -286,8 +282,6 @@ extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); #endif /* _TIMEZONE_DEFINED */ -#pragma pack(pop) - #if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS) #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L #endif @@ -307,9 +301,7 @@ } #endif -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER /* POSIX 2008 says clock_gettime and timespec are defined in time.h header, but other systems - like Linux, Solaris, etc - tend to declare such
diff --git a/mingw-w64-headers/crt/uchar.h b/mingw-w64-headers/crt/uchar.h index b1dabc6..df008fe 100644 --- a/mingw-w64-headers/crt/uchar.h +++ b/mingw-w64-headers/crt/uchar.h
@@ -43,9 +43,7 @@ #define __STDC_UTF_32__ 1 #endif -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifdef _UCRT _CRTIMP size_t mbrtoc16 (char16_t *__restrict__ _Pc16, const char *__restrict__ _S, size_t _N, mbstate_t *__restrict__ _Ps); @@ -54,9 +52,7 @@ _CRTIMP size_t c32rtomb (char *__restrict__ _S, char32_t _C32, mbstate_t *__restrict__ _Ps); #endif /* _UCRT */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif /* __UCHAR_H */
diff --git a/mingw-w64-headers/crt/unistd.h b/mingw-w64-headers/crt/unistd.h index b9f1a78..8c50cd3 100644 --- a/mingw-w64-headers/crt/unistd.h +++ b/mingw-w64-headers/crt/unistd.h
@@ -37,9 +37,7 @@ #endif -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #pragma push_macro("sleep") #undef sleep @@ -82,9 +80,7 @@ #endif #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP || WINSTORECOMPAT */ -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #include <pthread_unistd.h>
diff --git a/mingw-w64-headers/crt/vadefs.h b/mingw-w64-headers/crt/vadefs.h index cbc1ef8..ba3b5be 100644 --- a/mingw-w64-headers/crt/vadefs.h +++ b/mingw-w64-headers/crt/vadefs.h
@@ -8,15 +8,7 @@ #include <_mingw.h> -#ifndef __WIDL__ -#undef _CRT_PACKING -#define _CRT_PACKING 8 -#pragma pack(push,_CRT_PACKING) -#endif - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #if defined (__GNUC__) #ifndef __GNUC_VA_LIST @@ -95,13 +87,7 @@ #endif /* compiler ifdefs */ -#ifdef __cplusplus -} -#endif - -#ifndef __WIDL__ -#pragma pack(pop) -#endif +_CRT_END_C_HEADER #endif /* _INC_VADEFS */
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index e73894f..d7e40a3 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h
@@ -18,11 +18,7 @@ #define __USE_MINGW_STRTOX 1 #endif -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER #ifndef WCHAR_MIN /* also in stdint.h */ #define WCHAR_MIN 0U @@ -1102,11 +1098,7 @@ #endif /* __MINGW_MBWC_CONVERT_DEFINED */ -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) +_CRT_END_C_HEADER #include <sec_api/wchar_s.h>
diff --git a/mingw-w64-headers/crt/wctype.h b/mingw-w64-headers/crt/wctype.h index 96dc2b4..ee8b313 100644 --- a/mingw-w64-headers/crt/wctype.h +++ b/mingw-w64-headers/crt/wctype.h
@@ -8,17 +8,13 @@ #include <corecrt_wctype.h> -#ifdef __cplusplus -extern "C" { -#endif +_CRT_BEGIN_C_HEADER typedef wchar_t wctrans_t; _CRTIMP wint_t __cdecl towctrans(wint_t,wctrans_t); _CRTIMP wctrans_t __cdecl wctrans(const char *); _CRTIMP wctype_t __cdecl wctype(const char *); -#ifdef __cplusplus -} -#endif +_CRT_END_C_HEADER #endif
diff --git a/mingw-w64-headers/crt/xlocinfo.h b/mingw-w64-headers/crt/xlocinfo.h index 6e08efa..6103956 100644 --- a/mingw-w64-headers/crt/xlocinfo.h +++ b/mingw-w64-headers/crt/xlocinfo.h
@@ -10,10 +10,8 @@ #include <wchar.h> #include <yvals.h> -#pragma pack(push,_CRT_PACKING) - _C_STD_BEGIN -_C_LIB_DECL +_CRT_BEGIN_C_HEADER #define _XA 0x100 #define _XS 0x000 @@ -81,19 +79,18 @@ _CRTIMP const wchar_t *__cdecl _Getwctypes(const wchar_t *,const wchar_t *,short*,const _Ctypevec*); _CRTIMP wchar_t __cdecl _Towlower(wchar_t,const _Ctypevec *); _CRTIMP wchar_t __cdecl _Towupper(wchar_t,const _Ctypevec *); -_END_C_LIB_DECL +_CRT_END_C_HEADER _C_STD_END -_C_LIB_DECL +_CRT_BEGIN_C_HEADER _CRTIMP void *__cdecl _Gettnames(); _CRTIMP char *__cdecl _Getdays(); _CRTIMP char *__cdecl _Getmonths(); _CRTIMP size_t __cdecl _Strftime(char *,size_t _Maxsize,const char *,const struct tm *,void *); -_END_C_LIB_DECL +_CRT_END_C_HEADER -_C_LIB_DECL +_CRT_BEGIN_C_HEADER _locale_t __cdecl _GetLocaleForCP(unsigned int); -_END_C_LIB_DECL +_CRT_END_C_HEADER -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/xmath.h b/mingw-w64-headers/crt/xmath.h index 1e8d513..e7c2489 100644 --- a/mingw-w64-headers/crt/xmath.h +++ b/mingw-w64-headers/crt/xmath.h
@@ -73,7 +73,7 @@ #define FL_NAN 4 #define FL_NEG 8 -_C_LIB_DECL +_CRT_BEGIN_C_HEADER _CRTIMP int __cdecl _Stopfx(const char **,char **); _CRTIMP int __cdecl _Stoflt(const char *,const char *,char **,long[],int); @@ -103,6 +103,6 @@ extern __declspec(dllimport) _Dconst _LEps,_LRteps; extern __declspec(dllimport) long double _LXbig; -_END_C_LIB_DECL +_CRT_END_C_HEADER _C_STD_END #endif
diff --git a/mingw-w64-headers/crt/ymath.h b/mingw-w64-headers/crt/ymath.h index bd1dab6..42ff85f 100644 --- a/mingw-w64-headers/crt/ymath.h +++ b/mingw-w64-headers/crt/ymath.h
@@ -7,9 +7,8 @@ #define _YMATH #include <yvals.h> _C_STD_BEGIN -_C_LIB_DECL -#pragma pack(push,_CRT_PACKING) +_CRT_BEGIN_C_HEADER #define _DENORM (-2) #define _FINITE (-1) @@ -45,8 +44,7 @@ _CRTIMP short __cdecl _LExp(long double *,long double,short); _CRTIMP long double __cdecl _LSinh(long double,long double); extern _CRTIMP _Dconst _LDenorm,_LInf,_LNan,_LSnan; -_END_C_LIB_DECL +_CRT_END_C_HEADER _C_STD_END -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/crt/yvals.h b/mingw-w64-headers/crt/yvals.h index ec929c7..4ce9d09 100644 --- a/mingw-w64-headers/crt/yvals.h +++ b/mingw-w64-headers/crt/yvals.h
@@ -8,8 +8,6 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - #define _CPPLIB_VER 405 #define __PURE_APPDOMAIN_GLOBAL @@ -141,8 +139,6 @@ #define _CSTD :: #endif -#define _C_LIB_DECL extern "C" { -#define _END_C_LIB_DECL } #define _EXTERN_C extern "C" { #define _END_EXTERN_C } #else @@ -154,8 +150,6 @@ #define _C_STD_END #define _CSTD -#define _C_LIB_DECL -#define _END_C_LIB_DECL #define _EXTERN_C #define _END_EXTERN_C #endif @@ -272,5 +266,4 @@ #define _EXTERN_TEMPLATE template #define _THROW_BAD_ALLOC _THROW1(...) -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/include/rtcapi.h b/mingw-w64-headers/include/rtcapi.h index 7b11e14..aec6db6 100644 --- a/mingw-w64-headers/include/rtcapi.h +++ b/mingw-w64-headers/include/rtcapi.h
@@ -8,8 +8,6 @@ #include <crtdefs.h> -#pragma pack(push,_CRT_PACKING) - #define _RTCINTERNAL_DEPRECATED #ifdef __cplusplus @@ -89,5 +87,4 @@ } #endif -#pragma pack(pop) #endif
diff --git a/mingw-w64-headers/include/typeinfo.h b/mingw-w64-headers/include/typeinfo.h index 21a4d21..906ba29 100644 --- a/mingw-w64-headers/include/typeinfo.h +++ b/mingw-w64-headers/include/typeinfo.h
@@ -8,8 +8,6 @@ #ifndef _INC_TYPEINFO #define _INC_TYPEINFO -#pragma pack(push,_CRT_PACKING) - #ifndef RC_INVOKED #ifndef __cplusplus @@ -28,5 +26,4 @@ #endif #endif -#pragma pack(pop) #endif