[vm] Use /Zc:preprocessor to get __VA_OPT__ under MSVC.
Needed by irregexp. TEST=ci Change-Id: Ie64ee2869ddbb5bad234aea9b49d140b96fed2be Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481242 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
d0eb238f1f
commit
293e84cd5c
@@ -284,6 +284,12 @@ config("dart_config") {
|
||||
"/Gw",
|
||||
]
|
||||
}
|
||||
if (!is_clang) {
|
||||
cflags += [
|
||||
# Fixes __VA_OPT__ when using MSVC.
|
||||
"/Zc:preprocessor",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
cflags = [
|
||||
"-Wno-unused-parameter",
|
||||
|
||||
@@ -282,9 +282,9 @@ static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib,
|
||||
// TODO(iposva): Allocate from the zone instead of leaking error string
|
||||
// here. On the other hand the binary is about to exit anyway.
|
||||
#define SET_ERROR_MSG(error_msg, format, ...) \
|
||||
intptr_t len = snprintf(nullptr, 0, format, __VA_ARGS__); \
|
||||
intptr_t len = snprintf(nullptr, 0, format, ##__VA_ARGS__); \
|
||||
char* msg = reinterpret_cast<char*>(malloc(len + 1)); \
|
||||
snprintf(msg, len + 1, format, __VA_ARGS__); \
|
||||
snprintf(msg, len + 1, format, ##__VA_ARGS__); \
|
||||
*error_msg = msg
|
||||
|
||||
static uint8_t* ReadFileFully(const char* filename,
|
||||
|
||||
@@ -51,21 +51,12 @@ bool IsTreeShaken(const char* name, Dart_Handle handle, const char* error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define FATAL(fmt, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "Failed at %s:%d: " fmt "!\n", __FILE__, __LINE__, \
|
||||
__VA_ARGS__); \
|
||||
abort(); \
|
||||
} while (false)
|
||||
#else
|
||||
#define FATAL(fmt, ...) \
|
||||
do { \
|
||||
fprintf(stderr, "Failed at %s:%d: " fmt "!\n", __FILE__, __LINE__, \
|
||||
##__VA_ARGS__); \
|
||||
abort(); \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
#define CHECK(H) \
|
||||
do { \
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace dart {
|
||||
namespace bin {
|
||||
|
||||
#define SET_ERROR_MSG(error_msg, format, ...) \
|
||||
intptr_t len = snprintf(nullptr, 0, format, __VA_ARGS__); \
|
||||
intptr_t len = snprintf(nullptr, 0, format, ##__VA_ARGS__); \
|
||||
char* msg = reinterpret_cast<char*>(malloc(len + 1)); \
|
||||
snprintf(msg, len + 1, format, __VA_ARGS__); \
|
||||
snprintf(msg, len + 1, format, ##__VA_ARGS__); \
|
||||
*error_msg = msg
|
||||
|
||||
#if defined(DART_HOST_OS_WINDOWS)
|
||||
|
||||
@@ -250,13 +250,8 @@ void Expect::Null(const T p) {
|
||||
|
||||
} // namespace dart
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define FATAL(format, ...) \
|
||||
dart::Assert(__FILE__, __LINE__).Fail(format, __VA_ARGS__);
|
||||
#else
|
||||
#define FATAL(format, ...) \
|
||||
dart::Assert(__FILE__, __LINE__).Fail(format, ##__VA_ARGS__);
|
||||
#endif
|
||||
|
||||
#define UNIMPLEMENTED() FATAL("unimplemented code")
|
||||
|
||||
@@ -402,13 +397,8 @@ void Expect::Null(const T p) {
|
||||
|
||||
#define EXPECT_NULLPTR(ptr) dart::Expect(__FILE__, __LINE__).Null((ptr))
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define FAIL(format, ...) \
|
||||
dart::Expect(__FILE__, __LINE__).Fail(format, __VA_ARGS__);
|
||||
#else
|
||||
#define FAIL(format, ...) \
|
||||
dart::Expect(__FILE__, __LINE__).Fail(format, ##__VA_ARGS__);
|
||||
#endif
|
||||
dart::Expect(__FILE__, __LINE__).Fail(format, ##__VA_ARGS__)
|
||||
|
||||
#endif // defined(TESTING)
|
||||
|
||||
|
||||
@@ -24,13 +24,8 @@
|
||||
DECLARE_FLAG(bool, verbose_debug);
|
||||
|
||||
// 'Trace Debugger' TD_Print.
|
||||
#if defined(_MSC_VER)
|
||||
#define TD_Print(format, ...) \
|
||||
if (FLAG_verbose_debug) Log::Current()->Print(format, __VA_ARGS__)
|
||||
#else
|
||||
#define TD_Print(format, ...) \
|
||||
if (FLAG_verbose_debug) Log::Current()->Print(format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
namespace dart {
|
||||
|
||||
|
||||
@@ -23,22 +23,12 @@ DECLARE_FLAG(bool, trace_reload);
|
||||
DECLARE_FLAG(bool, trace_reload_verbose);
|
||||
|
||||
// 'Trace Isolate Reload' TIR_Print
|
||||
#if defined(_MSC_VER)
|
||||
#define TIR_Print(format, ...) \
|
||||
if (FLAG_trace_reload) Log::Current()->Print(format, __VA_ARGS__)
|
||||
#else
|
||||
#define TIR_Print(format, ...) \
|
||||
if (FLAG_trace_reload) Log::Current()->Print(format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
// 'Verbose Trace Isolate Reload' VTIR_Print
|
||||
#if defined(_MSC_VER)
|
||||
#define VTIR_Print(format, ...) \
|
||||
if (FLAG_trace_reload_verbose) Log::Current()->Print(format, __VA_ARGS__)
|
||||
#else
|
||||
#define VTIR_Print(format, ...) \
|
||||
if (FLAG_trace_reload_verbose) Log::Current()->Print(format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
|
||||
@@ -14,11 +14,7 @@ namespace dart {
|
||||
class IsolateGroup;
|
||||
class LogBlock;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define THR_Print(format, ...) Log::Current()->Print(format, __VA_ARGS__)
|
||||
#else
|
||||
#define THR_Print(format, ...) Log::Current()->Print(format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define THR_VPrint(format, args) Log::Current()->VPrint(format, args)
|
||||
|
||||
|
||||
@@ -222,17 +222,10 @@ PRECOMPILER_WSR_FIELD_DEFINITION(Function, FunctionType, signature)
|
||||
|
||||
#undef PRECOMPILER_WSR_FIELD_DEFINITION
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define TRACE_TYPE_CHECKS_VERBOSE(format, ...) \
|
||||
if (FLAG_trace_type_checks_verbose) { \
|
||||
OS::PrintErr(format, __VA_ARGS__); \
|
||||
}
|
||||
#else
|
||||
#define TRACE_TYPE_CHECKS_VERBOSE(format, ...) \
|
||||
if (FLAG_trace_type_checks_verbose) { \
|
||||
OS::PrintErr(format, ##__VA_ARGS__); \
|
||||
}
|
||||
#endif
|
||||
|
||||
// Takes a vm internal name and makes it suitable for external user.
|
||||
//
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
#endif // defined(TARGET_ARCH_{ARM, ARM64})
|
||||
|
||||
#define ZONE_STR(FMT, ...) \
|
||||
OS::SCreate(Thread::Current()->zone(), FMT, __VA_ARGS__)
|
||||
OS::SCreate(Thread::Current()->zone(), FMT, ##__VA_ARGS__)
|
||||
|
||||
inline Dart_Handle NewString(const char* str) {
|
||||
return Dart_NewStringFromCString(str);
|
||||
|
||||
Reference in New Issue
Block a user