[jumbo] fix B macro/symbol clashes in arm64 builds

assembler-arm64.h and assembler-arm64-inl.h have a B() function
which conflicts with the B macro in bytecode-utils.h.

Headers that leak macros can be annoying to deal with, in this case
we can't simply undef B at the end of source files that include
bytecode-utils.h because the second source file that includes
bytecode-utils.h won't see the B macro.  Let's just move this macro
into the two unittest files that include this header.

Bug: chromium:746958
Change-Id: I588b73fe81615f882a0e010c92ba187d3bc2bf25
Reviewed-on: https://chromium-review.googlesource.com/758779
Commit-Queue: Mostyn Bramley-Moore <mostynb@vewd.com>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49258}
This commit is contained in:
Mostyn Bramley-Moore 2017-11-09 10:05:52 +01:00 committed by Commit Bot
parent 23883b85f2
commit b9c9932202
3 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ namespace internal {
namespace interpreter {
namespace bytecode_array_writer_unittest {
#define B(Name) static_cast<uint8_t>(Bytecode::k##Name)
#define R(i) static_cast<uint32_t>(Register(i).ToOperand())
class BytecodeArrayWriterUnittest : public TestWithIsolateAndZone {
@ -364,6 +365,7 @@ TEST_F(BytecodeArrayWriterUnittest, DeadcodeElimination) {
CHECK(source_iterator.done());
}
#undef B
#undef R
} // namespace bytecode_array_writer_unittest

View File

@ -16,6 +16,8 @@ namespace v8 {
namespace internal {
namespace interpreter {
#define B(Name) static_cast<uint8_t>(Bytecode::k##Name)
TEST(BytecodeDecoder, DecodeBytecodeAndOperands) {
struct BytecodesAndResult {
const uint8_t bytecode[32];
@ -95,6 +97,8 @@ TEST(BytecodeDecoder, DecodeBytecodeAndOperands) {
}
}
#undef B
} // namespace interpreter
} // namespace internal
} // namespace v8

View File

@ -27,7 +27,6 @@
#endif
#define U8(i) static_cast<uint8_t>(i)
#define B(Name) static_cast<uint8_t>(Bytecode::k##Name)
#define REG_OPERAND(i) \
(InterpreterFrameConstants::kRegisterFileFromFp / kPointerSize - (i))
#define R8(i) static_cast<uint8_t>(REG_OPERAND(i))