[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: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77998}
This commit is contained in:
Leszek Swirski 2021-11-19 13:55:34 +01:00 committed by V8 LUCI CQ
parent a32d2dda80
commit c201bb0909

View File

@ -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)