[PATCH] include: Include x86intrin.h in msvcrt/intrin.h.

Rémi Bernon rbernon at codeweavers.com
Mon Mar 15 10:07:38 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Supersedes: 201370

AFAIU x86intrin.h is a GCC/Clang specific header, but I think __i386__
and __x86_64__ are too so we don't need _MSC_VER guard here? But the
same seems to be true for __arm__ so I'm not sure why there's such guard
around __dmb intrinsics below.

I'm not resending the previous patches (201367-201369,201372) because
they should be quite independent, and would also make Marvin do a full
build again. I'm interested to know if there's anything to fix on them.

Patch 201371 has some rounding errors that I will fix.

 include/msvcrt/intrin.h | 4 ++++
 include/msvcrt/stdlib.h | 8 ++++++++
 tools/makedep.c         | 1 +
 3 files changed, 13 insertions(+)

diff --git a/include/msvcrt/intrin.h b/include/msvcrt/intrin.h
index 781c6fac823..8b84929bc02 100644
--- a/include/msvcrt/intrin.h
+++ b/include/msvcrt/intrin.h
@@ -7,6 +7,10 @@
 #ifndef _INC_INTRIN
 #define _INC_INTRIN
 
+#if defined(__i386__) || defined(__x86_64__)
+# include <x86intrin.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h
index ed6560bc318..287e4030669 100644
--- a/include/msvcrt/stdlib.h
+++ b/include/msvcrt/stdlib.h
@@ -164,15 +164,23 @@ _ACRTIMP char*         __cdecl _itoa(int,char*,int);
 _ACRTIMP errno_t       __cdecl _itoa_s(int,char*,size_t,int);
 _ACRTIMP char*         __cdecl _ltoa(__msvcrt_long,char*,int);
 _ACRTIMP errno_t       __cdecl _ltoa_s(__msvcrt_long, char*, size_t, int);
+#ifndef _lrotl
 _ACRTIMP __msvcrt_ulong __cdecl _lrotl(__msvcrt_ulong,int);
+#endif
+#ifndef _lrotr
 _ACRTIMP __msvcrt_ulong __cdecl _lrotr(__msvcrt_ulong,int);
+#endif
 _ACRTIMP void          __cdecl _makepath(char*,const char*,const char*,const char*,const char*);
 _ACRTIMP int           __cdecl _makepath_s(char*,size_t,const char*,const char*,const char*,const char*);
 _ACRTIMP size_t        __cdecl _mbstrlen(const char*);
 _ACRTIMP _onexit_t     __cdecl _onexit(_onexit_t);
 _ACRTIMP int           __cdecl _putenv(const char*);
+#ifndef _rotl
 _ACRTIMP unsigned int  __cdecl _rotl(unsigned int,int);
+#endif
+#ifndef _rotr
 _ACRTIMP unsigned int  __cdecl _rotr(unsigned int,int);
+#endif
 _ACRTIMP void          __cdecl _searchenv(const char*,const char*,char*);
 _ACRTIMP int           __cdecl _set_error_mode(int);
 _ACRTIMP void          __cdecl _seterrormode(int);
diff --git a/tools/makedep.c b/tools/makedep.c
index 913854c7f05..8245a324279 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -1570,6 +1570,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_
     if (pFile->type == INCL_SYSTEM && pFile->use_msvcrt)
     {
         if (!strcmp( pFile->name, "stdarg.h" )) return NULL;
+        if (!strcmp( pFile->name, "x86intrin.h" )) return NULL;
         fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n",
                  pFile->included_by->file->name, pFile->included_line, pFile->name );
         exit(1);
-- 
2.30.2




More information about the wine-devel mailing list