mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Build SDL with the static C runtime on Visual Studio
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/msvc.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/msvc.yml
									
									
									
									
										vendored
									
									
								
							| @@ -17,8 +17,6 @@ jobs: | |||||||
|         platform: |         platform: | ||||||
|         - { name: Windows (x64),          flags: -A x64,   project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' } |         - { name: Windows (x64),          flags: -A x64,   project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' } | ||||||
|         - { name: Windows (x86),          flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' } |         - { name: Windows (x86),          flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' } | ||||||
|         - { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x64' } |  | ||||||
|         - { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x86' } |  | ||||||
|         - { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' } |         - { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' } | ||||||
|         - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' } |         - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' } | ||||||
|         - { name: Windows (ARM),          flags: -A ARM, artifact: 'SDL-VC-arm32', notests: true } |         - { name: Windows (ARM),          flags: -A ARM, artifact: 'SDL-VC-arm32', notests: true } | ||||||
|   | |||||||
| @@ -154,13 +154,12 @@ endif() | |||||||
| set(SDL_LIBC_DEFAULT ON) | set(SDL_LIBC_DEFAULT ON) | ||||||
| set(SDL_SYSTEM_ICONV_DEFAULT ON) | set(SDL_SYSTEM_ICONV_DEFAULT ON) | ||||||
| if(WINDOWS) | if(WINDOWS) | ||||||
|   set(SDL_LIBC_DEFAULT OFF) |  | ||||||
|   set(SDL_SYSTEM_ICONV_DEFAULT OFF) |   set(SDL_SYSTEM_ICONV_DEFAULT OFF) | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(MSVC) | if(MSVC) | ||||||
|   option(SDL_FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) |   dep_option(SDL_STATIC_VCRT "Use /MT for static VC runtimes" ON "NOT WINDOWS_STORE" OFF) | ||||||
|   if(SDL_FORCE_STATIC_VCRT) |   if(SDL_STATIC_VCRT) | ||||||
|     if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) |     if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) | ||||||
|       set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") |       set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||||||
|     endif() |     endif() | ||||||
|   | |||||||
| @@ -119,18 +119,17 @@ | |||||||
|       <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> |       <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> | ||||||
|       <WarningLevel>Level3</WarningLevel> |       <WarningLevel>Level3</WarningLevel> | ||||||
|       <DebugInformationFormat>OldStyle</DebugInformationFormat> |       <DebugInformationFormat>OldStyle</DebugInformationFormat> | ||||||
|       <OmitDefaultLibName>true</OmitDefaultLibName> |  | ||||||
|       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> |       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |       <PrecompiledHeader>Use</PrecompiledHeader> | ||||||
|       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> |       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |       <MultiProcessorCompilation>true</MultiProcessorCompilation> | ||||||
|  |       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ResourceCompile> |     <ResourceCompile> | ||||||
|       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||||
|     </ResourceCompile> |     </ResourceCompile> | ||||||
|     <Link> |     <Link> | ||||||
|       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> |       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||||
|       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||||
|       <SubSystem>Windows</SubSystem> |       <SubSystem>Windows</SubSystem> | ||||||
|     </Link> |     </Link> | ||||||
| @@ -151,18 +150,17 @@ | |||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||||
|       <WarningLevel>Level3</WarningLevel> |       <WarningLevel>Level3</WarningLevel> | ||||||
|       <DebugInformationFormat>OldStyle</DebugInformationFormat> |       <DebugInformationFormat>OldStyle</DebugInformationFormat> | ||||||
|       <OmitDefaultLibName>true</OmitDefaultLibName> |  | ||||||
|       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> |       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |       <PrecompiledHeader>Use</PrecompiledHeader> | ||||||
|       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> |       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |       <MultiProcessorCompilation>true</MultiProcessorCompilation> | ||||||
|  |       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ResourceCompile> |     <ResourceCompile> | ||||||
|       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||||
|     </ResourceCompile> |     </ResourceCompile> | ||||||
|     <Link> |     <Link> | ||||||
|       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> |       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||||
|       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||||
|       <SubSystem>Windows</SubSystem> |       <SubSystem>Windows</SubSystem> | ||||||
|     </Link> |     </Link> | ||||||
| @@ -187,18 +185,17 @@ | |||||||
|       <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> |       <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet> | ||||||
|       <WarningLevel>Level3</WarningLevel> |       <WarningLevel>Level3</WarningLevel> | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||||
|       <OmitDefaultLibName>true</OmitDefaultLibName> |  | ||||||
|       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> |       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |       <PrecompiledHeader>Use</PrecompiledHeader> | ||||||
|       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> |       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |       <MultiProcessorCompilation>true</MultiProcessorCompilation> | ||||||
|  |       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ResourceCompile> |     <ResourceCompile> | ||||||
|       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||||
|     </ResourceCompile> |     </ResourceCompile> | ||||||
|     <Link> |     <Link> | ||||||
|       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> |       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||||
|       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||||
|       <SubSystem>Windows</SubSystem> |       <SubSystem>Windows</SubSystem> | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |       <OptimizeReferences>true</OptimizeReferences> | ||||||
| @@ -220,18 +217,17 @@ | |||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||||
|       <WarningLevel>Level3</WarningLevel> |       <WarningLevel>Level3</WarningLevel> | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||||
|       <OmitDefaultLibName>true</OmitDefaultLibName> |  | ||||||
|       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> |       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> | ||||||
|       <PrecompiledHeader>Use</PrecompiledHeader> |       <PrecompiledHeader>Use</PrecompiledHeader> | ||||||
|       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> |       <PrecompiledHeaderFile>SDL_internal.h</PrecompiledHeaderFile> | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |       <MultiProcessorCompilation>true</MultiProcessorCompilation> | ||||||
|  |       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ResourceCompile> |     <ResourceCompile> | ||||||
|       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||||
|     </ResourceCompile> |     </ResourceCompile> | ||||||
|     <Link> |     <Link> | ||||||
|       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> |       <AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||||
|       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||||
|       <SubSystem>Windows</SubSystem> |       <SubSystem>Windows</SubSystem> | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |       <OptimizeReferences>true</OptimizeReferences> | ||||||
|   | |||||||
| @@ -111,7 +111,8 @@ typedef unsigned int uintptr_t; | |||||||
| # define SDL_DISABLE_AVX 1 | # define SDL_DISABLE_AVX 1 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ | /* This can be disabled to avoid C runtime dependencies and manifest requirements */ | ||||||
|  | #define HAVE_LIBC | ||||||
| #ifdef HAVE_LIBC | #ifdef HAVE_LIBC | ||||||
| /* Useful headers */ | /* Useful headers */ | ||||||
| #define HAVE_CTYPE_H 1 | #define HAVE_CTYPE_H 1 | ||||||
| @@ -162,6 +163,9 @@ typedef unsigned int uintptr_t; | |||||||
| #define HAVE__WCSICMP 1 | #define HAVE__WCSICMP 1 | ||||||
| #define HAVE__WCSNICMP 1 | #define HAVE__WCSNICMP 1 | ||||||
| #define HAVE__WCSDUP 1 | #define HAVE__WCSDUP 1 | ||||||
|  | #define HAVE_SSCANF 1 | ||||||
|  | #define HAVE_VSSCANF 1 | ||||||
|  | #define HAVE_VSNPRINTF 1 | ||||||
| #define HAVE_ACOS   1 | #define HAVE_ACOS   1 | ||||||
| #define HAVE_ASIN   1 | #define HAVE_ASIN   1 | ||||||
| #define HAVE_ATAN   1 | #define HAVE_ATAN   1 | ||||||
|   | |||||||
| @@ -80,8 +80,8 @@ void *SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void | |||||||
| } | } | ||||||
|  |  | ||||||
| /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. | /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. | ||||||
|    Always provide it for the SDL3 DLL, but skip it when building static lib w/ static runtime. */ |    We will provide our own implementation if we're not building with a C runtime. */ | ||||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) | #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(_MT) | ||||||
| /* NOLINTNEXTLINE(readability-redundant-declaration) */ | /* NOLINTNEXTLINE(readability-redundant-declaration) */ | ||||||
| extern void *memcpy(void *dst, const void *src, size_t len); | extern void *memcpy(void *dst, const void *src, size_t len); | ||||||
| #ifndef __INTEL_LLVM_COMPILER | #ifndef __INTEL_LLVM_COMPILER | ||||||
| @@ -96,4 +96,4 @@ void *memcpy(void *dst, const void *src, size_t len) | |||||||
| { | { | ||||||
|     return SDL_memcpy(dst, src, len); |     return SDL_memcpy(dst, src, len); | ||||||
| } | } | ||||||
| #endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */ | #endif /* (_MSC_VER >= 1400) && !defined(_MT) */ | ||||||
|   | |||||||
| @@ -117,8 +117,8 @@ void *SDL_memset4(void *dst, Uint32 val, size_t dwords) | |||||||
| } | } | ||||||
|  |  | ||||||
| /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. | /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. | ||||||
|    Always provide it for the SDL3 DLL, but skip it when building static lib w/ static runtime. */ |    We will provide our own implementation if we're not building with a C runtime. */ | ||||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) | #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(_MT) | ||||||
| /* NOLINTNEXTLINE(readability-redundant-declaration) */ | /* NOLINTNEXTLINE(readability-redundant-declaration) */ | ||||||
| extern void *memset(void *dst, int c, size_t len); | extern void *memset(void *dst, int c, size_t len); | ||||||
| #ifndef __INTEL_LLVM_COMPILER | #ifndef __INTEL_LLVM_COMPILER | ||||||
| @@ -133,5 +133,5 @@ void *memset(void *dst, int c, size_t len) | |||||||
| { | { | ||||||
|     return SDL_memset(dst, c, len); |     return SDL_memset(dst, c, len); | ||||||
| } | } | ||||||
| #endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */ | #endif /* (_MSC_VER >= 1400) && !defined(_MT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -141,7 +141,7 @@ static int stdlib_snprintf(void *arg) | |||||||
|     int result; |     int result; | ||||||
|     int predicted; |     int predicted; | ||||||
|     char text[1024]; |     char text[1024]; | ||||||
|     const char *expected; |     const char *expected, *expected2, *expected3, *expected4, *expected5; | ||||||
|     size_t size; |     size_t size; | ||||||
|  |  | ||||||
|     result = SDL_snprintf(text, sizeof(text), "%s", "foo"); |     result = SDL_snprintf(text, sizeof(text), "%s", "foo"); | ||||||
| @@ -310,22 +310,58 @@ static int stdlib_snprintf(void *arg) | |||||||
|  |  | ||||||
|     result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1234abcd); |     result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1234abcd); | ||||||
|     expected = "0x1234abcd"; |     expected = "0x1234abcd"; | ||||||
|  |     expected2 = "1234ABCD"; | ||||||
|  |     expected3 = "000000001234ABCD"; | ||||||
|  |     expected4 = "1234abcd"; | ||||||
|  |     expected5 = "000000001234abcd"; | ||||||
|     SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1234abcd)"); |     SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1234abcd)"); | ||||||
|     SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); |     SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0 || | ||||||
|     SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); |                         SDL_strcmp(text, expected2) == 0 || | ||||||
|  |                         SDL_strcmp(text, expected3) == 0 || | ||||||
|  |                         SDL_strcmp(text, expected4) == 0 || | ||||||
|  |                         SDL_strcmp(text, expected5) == 0, | ||||||
|  |         "Check text, expected: '%s', got: '%s'", expected, text); | ||||||
|  |     SDLTest_AssertCheck(result == SDL_strlen(expected) || | ||||||
|  |                         result == SDL_strlen(expected2) || | ||||||
|  |                         result == SDL_strlen(expected3) || | ||||||
|  |                         result == SDL_strlen(expected4) || | ||||||
|  |                         result == SDL_strlen(expected5), | ||||||
|  |         "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); | ||||||
|  |  | ||||||
|     result = SDL_snprintf(text, sizeof(text), "A %p B", (void *)0x1234abcd); |     result = SDL_snprintf(text, sizeof(text), "A %p B", (void *)0x1234abcd); | ||||||
|     expected = "A 0x1234abcd B"; |     expected = "A 0x1234abcd B"; | ||||||
|  |     expected2 = "A 1234ABCD B"; | ||||||
|  |     expected3 = "A 000000001234ABCD B"; | ||||||
|  |     expected4 = "A 1234abcd B"; | ||||||
|  |     expected5 = "A 000000001234abcd B"; | ||||||
|     SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"A %%p B\", 0x1234abcd)"); |     SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"A %%p B\", 0x1234abcd)"); | ||||||
|     SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); |     SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0 || | ||||||
|     SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); |                         SDL_strcmp(text, expected2) == 0 || | ||||||
|  |                         SDL_strcmp(text, expected3) == 0 || | ||||||
|  |                         SDL_strcmp(text, expected4) == 0 || | ||||||
|  |                         SDL_strcmp(text, expected5) == 0, | ||||||
|  |         "Check text, expected: '%s', got: '%s'", expected, text); | ||||||
|  |     SDLTest_AssertCheck(result == SDL_strlen(expected) || | ||||||
|  |                         result == SDL_strlen(expected2) || | ||||||
|  |                         result == SDL_strlen(expected3) || | ||||||
|  |                         result == SDL_strlen(expected4) || | ||||||
|  |                         result == SDL_strlen(expected5), | ||||||
|  |         "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); | ||||||
|  |  | ||||||
|     if (sizeof(void *) >= 8) { |     if (sizeof(void *) >= 8) { | ||||||
|         result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1ba07bddf60L); |         result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1ba07bddf60L); | ||||||
|         expected = "0x1ba07bddf60"; |         expected = "0x1ba07bddf60"; | ||||||
|  |         expected2 = "000001BA07BDDF60"; | ||||||
|  |         expected3 = "000001ba07bddf60"; | ||||||
|         SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1ba07bddf60)"); |         SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1ba07bddf60)"); | ||||||
|         SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); |         SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0 || | ||||||
|         SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); |                             SDL_strcmp(text, expected2) == 0 || | ||||||
|  |                             SDL_strcmp(text, expected3) == 0, | ||||||
|  |             "Check text, expected: '%s', got: '%s'", expected, text); | ||||||
|  |         SDLTest_AssertCheck(result == SDL_strlen(expected) || | ||||||
|  |                             result == SDL_strlen(expected2) || | ||||||
|  |                             result == SDL_strlen(expected3), | ||||||
|  |             "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); | ||||||
|     } |     } | ||||||
|     return TEST_COMPLETED; |     return TEST_COMPLETED; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga