Commit c201bb09 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[test] Fix flag scope __LINE__ use

`foo ## __LINE__` just emits foo__LINE__ because of how preprocessor
expansion works.

The typical solution for this is to use a CONCAT macro, but we in fact
already have a helper for what this is trying to solve,
UNIQUE_IDENTIFIER, so just use that instead.

Change-Id: Icea3f01db458c5d557e0affd3b004f4478c6c315
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3293084
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77998}
parent a32d2dda
......@@ -5,6 +5,8 @@
#ifndef V8_TEST_COMMON_FLAG_UTILS_H
#define V8_TEST_COMMON_FLAG_UTILS_H
#include "src/base/macros.h"
namespace v8 {
namespace internal {
......@@ -24,8 +26,8 @@ class V8_NODISCARD FlagScope {
} // namespace internal
} // namespace v8
#define FLAG_VALUE_SCOPE(flag, value) \
v8::internal::FlagScope<bool> __scope_##flag##__LINE__( \
#define FLAG_VALUE_SCOPE(flag, value) \
v8::internal::FlagScope<bool> UNIQUE_IDENTIFIER(__scope_##flag)( \
&v8::internal::FLAG_##flag, value)
#define FLAG_SCOPE(flag) FLAG_VALUE_SCOPE(flag, true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment