fix: clean up __valid macro leak at source in sal.h instead of patching every include site

This commit is contained in:
MatthewBeshay 2026-04-01 13:15:16 +11:00
parent 70194c6a3b
commit 4271e562a6
3 changed files with 5 additions and 22 deletions

View file

@ -4234,6 +4234,11 @@ __PRIMOP(int, _In_function_class_(__In_impl_ char *);)
#define _Maybe_raises_SEH_exception_ _Pre_ _SA_annotes1(SAL_inTry, __yes)
#define _Raises_SEH_exception_ _Group_(_Maybe_raises_SEH_exception_ _Analysis_noreturn_)
// Clean up macros that collide with libstdc++ internals
#undef __valid
#undef __notvalid
#undef __maybevalid
#ifdef __cplusplus // [
}
#endif // ]

View file

@ -6,19 +6,6 @@
#include "winapi_stubs.h"
#include "Minecraft.Client/Linux/Stubs/DirectXMath/DirectXMath.h"
// The DirectXMath SAL shim defines a few reserved identifiers such as
// `__valid`. Newer libstdc++ headers also use those internal names, so keep
// the shim's macros from leaking past the DirectXMath include.
#ifdef __valid
#undef __valid
#endif
#ifdef __notvalid
#undef __notvalid
#endif
#ifdef __maybevalid
#undef __maybevalid
#endif
using namespace DirectX;
typedef struct _RECT {

View file

@ -1,15 +1,6 @@
#pragma once
#ifdef __valid
#pragma push_macro("__valid")
#undef __valid
#define PERFORMANCE_TIMER_RESTORE_VALID_MACRO
#endif
#include <chrono>
#ifdef PERFORMANCE_TIMER_RESTORE_VALID_MACRO
#pragma pop_macro("__valid")
#undef PERFORMANCE_TIMER_RESTORE_VALID_MACRO
#endif
#include <string>
class PerformanceTimer {