From 6946b06a173de5798b3cb45995245172f58d03b9 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Wed, 22 Feb 2023 05:56:38 -0800 Subject: [PATCH] vlc_fixups: do warn about "deprecated" ANSI calls on Windows GDK These functions are not available when linking, so we should avoid using them. Also mingw-w64 understands _CRT_NONSTDC_NO_DEPRECATE but not _CRT_NONSTDC_NO_WARNINGS. --- compat/windows/unistd.h | 6 +++++- include/vlc_fixups.h | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compat/windows/unistd.h b/compat/windows/unistd.h index 66d83040a7..a4db2cad87 100644 --- a/compat/windows/unistd.h +++ b/compat/windows/unistd.h @@ -9,8 +9,12 @@ // Windows is not a real POSIX system and doesn't provide this header // provide a dummy one so the code can compile +#if defined(_GAMING_XBOX_SCARLETT) || defined(_GAMING_XBOX_XBOXONE) || defined(_XBOX_ONE) +# define _CRT_DECLARE_NONSTDC_NAMES 0 +#else // many functions commonly found in unistd.h are found in io.h and process.h -#define _CRT_DECLARE_NONSTDC_NAMES 1 +# define _CRT_DECLARE_NONSTDC_NAMES 1 +#endif #include #include diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h index 0adcbf227e..89647b67d2 100644 --- a/include/vlc_fixups.h +++ b/include/vlc_fixups.h @@ -28,8 +28,11 @@ #if defined(_MSC_VER) // disable common warnings when compiling POSIX code -#ifndef _CRT_NONSTDC_NO_WARNINGS -#define _CRT_NONSTDC_NO_WARNINGS 1 +#ifndef _CRT_NONSTDC_NO_DEPRECATE +// the POSIX variants are not available in the GDK +# if !(defined(_GAMING_XBOX_SCARLETT) || defined(_GAMING_XBOX_XBOXONE) || defined(_XBOX_ONE)) +# define _CRT_NONSTDC_NO_DEPRECATE +# endif #endif #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS 1