From: Kelvin Lee Date: Fri, 17 Jan 2025 13:26:21 +0000 (+1100) Subject: byteorder.h: Fix MSVC compiler error C2371 X-Git-Tag: openssl-3.5.0-alpha1~705 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b589fcdab19ab0019140a7f34c96440658ffc10;p=thirdparty%2Fopenssl.git byteorder.h: Fix MSVC compiler error C2371 Compiling byteorder_test.c with VS2022 produces the following warnings and errors: E:\build\kiyolee\openssl\include\openssl\byteorder.h(24,21): warning C4164: '_byteswap_ushort': intrinsic function not declared (compiling source file '../../../test/byteorder_test.c') E:\build\kiyolee\openssl\include\openssl\byteorder.h(25,21): warning C4164: '_byteswap_ulong': intrinsic function not declared (compiling source file '../../../test/byteorder_test.c') E:\build\kiyolee\openssl\include\openssl\byteorder.h(26,21): warning C4164: '_byteswap_uint64': intrinsic function not declared (compiling source file '../../../test/byteorder_test.c') E:\build\kiyolee\openssl\include\openssl\byteorder.h(112,18): warning C4013: '_byteswap_ushort' undefined; assuming extern returning int (compiling source file '../../../test/byteorder_test.c') E:\build\kiyolee\openssl\include\openssl\byteorder.h(144,18): warning C4013: '_byteswap_ulong' undefined; assuming extern returning int (compiling source file '../../../test/byteorder_test.c') E:\build\kiyolee\openssl\include\openssl\byteorder.h(182,18): warning C4013: '_byteswap_uint64' undefined; assuming extern returning int (compiling source file '../../../test/byteorder_test.c') C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\stdlib.h(298,41): error C2371: '_byteswap_ushort': redefinition; different basic types (compiling source file '../../../test/byteorder_test.c') C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\stdlib.h(299,41): warning C4142: '_byteswap_ulong': benign redefinition of type (compiling source file '../../../test/byteorder_test.c') C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\stdlib.h(300,41): error C2371: '_byteswap_uint64': redefinition; different basic types (compiling source file '../../../test/byteorder_test.c') CLA: trivial Reviewed-by: Kurt Roeckx Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26448) --- diff --git a/include/openssl/byteorder.h b/include/openssl/byteorder.h index cce67beb54a..3c8f34b2918 100644 --- a/include/openssl/byteorder.h +++ b/include/openssl/byteorder.h @@ -21,6 +21,7 @@ */ # if defined(_MSC_VER) && _MSC_VER>=1300 +# include # pragma intrinsic(_byteswap_ushort) # pragma intrinsic(_byteswap_ulong) # pragma intrinsic(_byteswap_uint64)