[MSVCRT][CRT][UCRT] Disable intrinsic string functions on MSVC (#9157)

VS2022 version 17.2 and later (`_MSC_VER >= 1932`) added new intrinsic
functions (`strncmp`, `strncpy`, `wcsncmp`, and `wcsncpy`).
As we implement these ourselves, we have to avoid compiler error C2169.

This problem surfaced with a recent GitHub Actions update:
https://github.com/actions/runner-images/issues/14017

Use `#pragma function(...)` to disable new intrinsic functions.
This commit is contained in:
Katayama Hirofumi MZ
2026-06-13 18:10:15 +03:00
committed by GitHub
parent eecfbaeaa0
commit 300e1d525d
8 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
#include <stddef.h>
#include <tchar.h>
#if defined(_MSC_VER) && defined(_M_ARM)
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later
#pragma function(_tcsncmp)
#endif /* _MSC_VER */
+1 -1
View File
@@ -2,7 +2,7 @@
#include <stddef.h>
#include <tchar.h>
#if defined(_MSC_VER) && defined(_M_ARM)
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later
#pragma function(_tcsncpy)
#endif /* _MSC_VER */
+1 -1
View File
@@ -11,7 +11,7 @@
#include <string.h>
#ifdef _M_ARM
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later
#pragma function(strncmp)
#endif
+1 -1
View File
@@ -10,7 +10,7 @@
#include <string.h>
#if defined _M_ARM
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later
#pragma function(strncpy)
#endif
+1 -1
View File
@@ -19,7 +19,7 @@
#ifdef _M_ARM
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later
#pragma function(wcsncmp)
#endif
+1 -1
View File
@@ -12,7 +12,7 @@
#pragma warning(disable:__WARNING_POSTCONDITION_NULLTERMINATION_VIOLATION) // 26036
#ifdef _M_ARM
#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later
#pragma function(wcsncpy)
#endif