]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
MSVC: #define inline and restrict only when needed.
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 12 Sep 2023 20:34:31 +0000 (23:34 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 22 Sep 2023 17:06:27 +0000 (20:06 +0300)
This also drops the check for _WIN32 as that shouldn't be needed.

src/common/sysdefs.h

index 97be4ee380d04ec84735f83cf3b00c8b4f3578ec..07502dc9cfe534e006af300a60f3c32e90c85c9b 100644 (file)
@@ -151,13 +151,16 @@ typedef unsigned char _Bool;
 
 #include <string.h>
 
-// As of MSVC 2013, inline and restrict are supported with
-// non-standard keywords.
-#if defined(_WIN32) && defined(_MSC_VER)
-#      ifndef inline
+// Visual Studio 2013 update 2 supports only __inline, not inline.
+// MSVC v19.0 / VS 2015 and newer support both.
+//
+// MSVC v19.27 (VS 2019 version 16.7) added support for restrict.
+// Older ones support only __restrict.
+#ifdef _MSC_VER
+#      if _MSC_VER < 1900 && !defined(inline)
 #              define inline __inline
 #      endif
-#      ifndef restrict
+#      if _MSC_VER < 1927 && !defined(restrict)
 #              define restrict __restrict
 #      endif
 #endif