Skip to content

Commit

Permalink
[csa] Fix for debug build in MSVC
Browse files Browse the repository at this point in the history
The preprocessor of MSVC works differently for empty __VA_ARGS__.
Another hack is needed to make this compile in both MSVC and clang.

R=tebbi@chromium.org

Bug: v8:9555
Change-Id: Ie8f2e1ed302730419dae95e49ab0cca35a4a8131
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1720669
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62952}
  • Loading branch information
backes authored and Commit Bot committed Jul 29, 2019
1 parent 282dec2 commit 695c40f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/codegen/code-stub-assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
#define CSA_ASSERT_2_ARGS(a, b, ...) {{a, #a}, {b, #b}}
// clang-format on
#define SWITCH_CSA_ASSERT_ARGS(dummy, a, b, FUNC, ...) FUNC(a, b)
#define CSA_ASSERT_ARGS(...) \
SWITCH_CSA_ASSERT_ARGS(dummy, ##__VA_ARGS__, CSA_ASSERT_2_ARGS, \
CSA_ASSERT_1_ARG, CSA_ASSERT_0_ARGS)
#define CSA_ASSERT_ARGS(...) \
CALL(SWITCH_CSA_ASSERT_ARGS, (, ##__VA_ARGS__, CSA_ASSERT_2_ARGS, \
CSA_ASSERT_1_ARG, CSA_ASSERT_0_ARGS))
// Workaround for MSVC to skip comma in empty __VA_ARGS__.
#define CALL(x, y) x y

// CSA_ASSERT(csa, <condition>, <extra values to print...>)

Expand Down

1 comment on commit 695c40f

@d3x0r
Copy link

@d3x0r d3x0r commented on 695c40f Oct 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.