To keep it in sync with winnt.h.
-- v2: include: Use __has_declspec_attribute in basetsd.h. include: Remove DECLSPEC_ALIGN define from sys/stat.h.
From: Jacek Caban jacek@codeweavers.com
To keep it in sync with winnt.h. --- include/msvcrt/corecrt.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 945d8ac4055..b3d9aa0992c 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -86,6 +86,14 @@ #define __has_attribute(x) 0 #endif
+#ifndef __has_declspec_attribute +# if defined(_MSC_VER) +# define __has_declspec_attribute(x) 1 +# else +# define __has_declspec_attribute(x) 0 +# endif +#endif + #if !defined(_MSC_VER) && !defined(__MINGW32__) # undef __stdcall # ifdef __i386__ @@ -132,7 +140,7 @@ #endif
#ifndef DECLSPEC_NORETURN -# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS) +# if __has_declspec_attribute(noreturn) && !defined(MIDL_PASS) # define DECLSPEC_NORETURN __declspec(noreturn) # elif defined(__GNUC__) # define DECLSPEC_NORETURN __attribute__((noreturn)) @@ -142,7 +150,7 @@ #endif
#ifndef DECLSPEC_ALIGN -# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) +# if __has_declspec_attribute(align) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) # elif defined(__GNUC__) # define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) @@ -154,7 +162,7 @@ #ifndef _ACRTIMP # ifdef _CRTIMP # define _ACRTIMP _CRTIMP -# elif defined(_MSC_VER) +# elif __has_declspec_attribute(dllimport) # define _ACRTIMP __declspec(dllimport) # elif defined(__MINGW32__) || defined(__CYGWIN__) # define _ACRTIMP __attribute__((dllimport))
From: Jacek Caban jacek@codeweavers.com
It's defined in corecrt.h, which is included anyway. --- include/msvcrt/sys/stat.h | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/include/msvcrt/sys/stat.h b/include/msvcrt/sys/stat.h index 29d75feb86b..6e5a400de6c 100644 --- a/include/msvcrt/sys/stat.h +++ b/include/msvcrt/sys/stat.h @@ -32,16 +32,6 @@ typedef int _off_t; #define _OFF_T_DEFINED #endif
-#ifndef DECLSPEC_ALIGN -# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) -# define DECLSPEC_ALIGN(x) __declspec(align(x)) -# elif defined(__GNUC__) -# define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) -# else -# define DECLSPEC_ALIGN(x) -# endif -#endif - #define _S_IEXEC 0x0040 #define _S_IWRITE 0x0080 #define _S_IREAD 0x0100
From: Jacek Caban jacek@codeweavers.com
--- include/basetsd.h | 10 +++++++++- include/winnt.h | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/basetsd.h b/include/basetsd.h index c16d55422bb..eb12478dc71 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -65,9 +65,17 @@ extern "C" { # endif #endif /* !defined(_MSC_VER) */
+#ifndef __has_declspec_attribute +# if defined(_MSC_VER) +# define __has_declspec_attribute(x) 1 +# else +# define __has_declspec_attribute(x) 0 +# endif +#endif + /* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */ #ifndef DECLSPEC_ALIGN -# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) +# if __has_declspec_attribute(align) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) # elif defined(__GNUC__) # define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) diff --git a/include/winnt.h b/include/winnt.h index b03a92a9a7f..f7570433f17 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -42,14 +42,6 @@ extern "C" { #endif
-#ifndef __has_declspec_attribute -# if defined(_MSC_VER) -# define __has_declspec_attribute(x) 1 -# else -# define __has_declspec_attribute(x) 0 -# endif -#endif - #if defined(_NTSYSTEM_) || defined(WINE_UNIX_LIB) #define NTSYSAPI DECLSPEC_EXPORT #else
On Wed Sep 18 13:38:40 2024 +0000, Rémi Bernon wrote:
There's also some in sys/stat.h (which could probably go away as it includes corecrt.h), basestd.h and specstrings.h
I added changes to stat.h and basetsd.h. specstrings.h seems weird, I wonder if we should move those defines out of it, I left if alone for now.