headers/{memory, string}: Relax conditions of declarations `memccpy()`, `strdup()` and `strndup()`

This allows these functions to be called in non-strict-conforming code, and when
`_GNU_SOURCE` is defined, and

* `memccpy()` is available since ISO C23, and since POSIX 2001 as an XSI extension, and
* `strdup()` is available since ISO C23, and since POSIX 2001 as an XSI extension, but
  has been moved into POSIX 2008 base standard, and
* `strndup()` is available since ISO C23, and since POSIX 2008.

Conditions around declarations with `__MINGW_ATTRIB_DEPRECATED_MSVC2005` are
removed, so if someone defines `__MINGW_MSVC_COMPAT_WARNINGS` they get those
warnings, always.

Signed-off-by: LIU Hao <lh_mouse@126.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-headers/crt/memory.h b/mingw-w64-headers/crt/memory.h
index 4910a7b..760d84b 100644
--- a/mingw-w64-headers/crt/memory.h
+++ b/mingw-w64-headers/crt/memory.h
@@ -30,7 +30,7 @@
 #ifndef _CRT_MEMORY_DEFINED
 #define _CRT_MEMORY_DEFINED
   _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L || _XOPEN_SOURCE + 0 >= 600
   void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
 #endif
   _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
@@ -43,9 +43,7 @@
   void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
 
 #ifndef	NO_OLDNAMES
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
   void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
-#endif
   int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
 #endif
 #endif
diff --git a/mingw-w64-headers/crt/string.h b/mingw-w64-headers/crt/string.h
index ab72911..36daadc 100644
--- a/mingw-w64-headers/crt/string.h
+++ b/mingw-w64-headers/crt/string.h
@@ -43,7 +43,7 @@
 #ifndef _CRT_MEMORY_DEFINED
 #define _CRT_MEMORY_DEFINED
   _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L || _XOPEN_SOURCE + 0 >= 600
   void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
 #endif
   _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
@@ -55,9 +55,7 @@
   void * __cdecl mempcpy (void *_Dst, const void *_Src, size_t _Size);
   void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
 #ifndef	NO_OLDNAMES
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
   void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
-#endif
   int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
 #endif
 #endif
@@ -77,7 +75,7 @@
 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 #pragma pop_macro("_strdup")
 #endif
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L || _POSIX_C_SOURCE + 0 >= 200809L || _XOPEN_SOURCE + 0 >= 600
 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 #pragma push_macro("strdup")
 #undef strdup
@@ -86,6 +84,8 @@
 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 #pragma pop_macro("strdup")
 #endif
+#endif
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L || _POSIX_C_SOURCE + 0 >= 200809L || _XOPEN_SOURCE + 0 >= 700
   char *__cdecl strndup(const char *_Src,size_t _MaxCount);
 #endif
   _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val);
@@ -128,7 +128,6 @@
   _CRTIMP size_t __cdecl _strxfrm_l(char * __restrict__ _Dst,const char * __restrict__ _Src,size_t _MaxCount,_locale_t _Locale);
 
 #ifndef	NO_OLDNAMES
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 #pragma push_macro("strdup")
 #undef strdup
@@ -137,7 +136,6 @@
 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
 #pragma pop_macro("strdup")
 #endif
-#endif
   int __cdecl strcmpi(const char *_Str1,const char *_Str2) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
   int __cdecl stricmp(const char *_Str1,const char *_Str2) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
   char *__cdecl strlwr(char *_Str) __MINGW_ATTRIB_DEPRECATED_MSVC2005;