meson: Use /Zc:enumTypes enables C++ conforming enum underlying type and enumerator type deduction
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The detail is at https://learn.microsoft.com/en-us/cpp/build/reference/zc-enumtypes?view=msvc-170

For example:

enum Enum {
    A = 'A',
    B = sizeof(A)
};

static_assert(B == 1); // previously failed, now succeeds under /Zc:enumTypes

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38639>
This commit is contained in:
Yonggang Luo 2025-11-22 01:05:35 +08:00 committed by Marge Bot
parent 6e3598177b
commit 9649eee307

View file

@ -1169,6 +1169,7 @@ if cc.get_argument_syntax() == 'msvc'
'/we4024', # Error when passing different type of parameter
'/we4189', # 'identifier' : local variable is initialized but not referenced
'/Zc:__cplusplus', #Set __cplusplus macro to match the /std:c++<version> on the command line
'/Zc:enumTypes', # Enables C++ conforming enum underlying type and enumerator type deduction
'/Zc:preprocessor', # Use the standards-conforming preprocessor
]
c_args += cc.get_supported_arguments(_trial)