Fix clang-tidy warnings in art.

* Add parentheses around macro parameters, or
  use NOLINT to suppress warning.
Bug: 28705665

Test: build with WITH_TIDY=1
Change-Id: Ifc922c2e66215772042bac372754ea70074f0053
diff --git a/compiler/elf_writer_test.cc b/compiler/elf_writer_test.cc
index 449f514..d5f1663 100644
--- a/compiler/elf_writer_test.cc
+++ b/compiler/elf_writer_test.cc
@@ -38,16 +38,16 @@
 
 #define EXPECT_ELF_FILE_ADDRESS(ef, expected_value, symbol_name, build_map) \
   do { \
-    void* addr = reinterpret_cast<void*>(ef->FindSymbolAddress(SHT_DYNSYM, \
-                                                               symbol_name, \
-                                                               build_map)); \
+    void* addr = reinterpret_cast<void*>((ef)->FindSymbolAddress(SHT_DYNSYM, \
+                                                                 symbol_name, \
+                                                                 build_map)); \
     EXPECT_NE(nullptr, addr); \
     EXPECT_LT(static_cast<uintptr_t>(ART_BASE_ADDRESS), reinterpret_cast<uintptr_t>(addr)); \
-    if (expected_value == nullptr) { \
-      expected_value = addr; \
+    if ((expected_value) == nullptr) { \
+      (expected_value) = addr; \
     }                        \
     EXPECT_EQ(expected_value, addr); \
-    EXPECT_EQ(expected_value, ef->FindDynamicSymbolAddress(symbol_name)); \
+    EXPECT_EQ(expected_value, (ef)->FindDynamicSymbolAddress(symbol_name)); \
   } while (false)
 
 TEST_F(ElfWriterTest, dlsym) {
diff --git a/compiler/linker/arm64/relative_patcher_arm64_test.cc b/compiler/linker/arm64/relative_patcher_arm64_test.cc
index 573de73..9932c79 100644
--- a/compiler/linker/arm64/relative_patcher_arm64_test.cc
+++ b/compiler/linker/arm64/relative_patcher_arm64_test.cc
@@ -701,7 +701,7 @@
 
 #define DEFAULT_LDUR_LDR_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, DexCacheReference ## adrp_offset ## Ldur ## disp) { \
-    bool has_thunk = (adrp_offset == 0xff8u || adrp_offset == 0xffcu); \
+    bool has_thunk = ((adrp_offset) == 0xff8u || (adrp_offset) == 0xffcu); \
     TestAdrpLdurLdr(adrp_offset, has_thunk, 0x12345678u, disp); \
   }
 
@@ -725,8 +725,8 @@
 // LDR <Xt>, <label> is aligned when offset + displacement is a multiple of 8.
 #define LDRX_PCREL_LDR_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, DexCacheReference ## adrp_offset ## XPcRel ## disp) { \
-    bool unaligned = !IsAligned<8u>(adrp_offset + 4u + static_cast<uint32_t>(disp)); \
-    bool has_thunk = (adrp_offset == 0xff8u || adrp_offset == 0xffcu) && unaligned; \
+    bool unaligned = !IsAligned<8u>((adrp_offset) + 4u + static_cast<uint32_t>(disp)); \
+    bool has_thunk = ((adrp_offset) == 0xff8u || (adrp_offset) == 0xffcu) && unaligned; \
     TestAdrpLdrPcRelLdr(kLdrXPcRelInsn, disp, adrp_offset, has_thunk, 0x12345678u, 0x1234u); \
   }
 
@@ -735,21 +735,21 @@
 // LDR <Wt>, [SP, #<pimm>] and LDR <Xt>, [SP, #<pimm>] are always aligned. No fixup needed.
 #define LDRW_SPREL_LDR_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, DexCacheReference ## adrp_offset ## WSpRel ## disp) { \
-    TestAdrpLdrSpRelLdr(kLdrWSpRelInsn, disp >> 2, adrp_offset, false, 0x12345678u, 0x1234u); \
+    TestAdrpLdrSpRelLdr(kLdrWSpRelInsn, (disp) >> 2, adrp_offset, false, 0x12345678u, 0x1234u); \
   }
 
 TEST_FOR_OFFSETS(LDRW_SPREL_LDR_TEST, 0, 4)
 
 #define LDRX_SPREL_LDR_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, DexCacheReference ## adrp_offset ## XSpRel ## disp) { \
-    TestAdrpLdrSpRelLdr(kLdrXSpRelInsn, disp >> 3, adrp_offset, false, 0x12345678u, 0x1234u); \
+    TestAdrpLdrSpRelLdr(kLdrXSpRelInsn, (disp) >> 3, adrp_offset, false, 0x12345678u, 0x1234u); \
   }
 
 TEST_FOR_OFFSETS(LDRX_SPREL_LDR_TEST, 0, 8)
 
 #define DEFAULT_LDUR_ADD_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, StringReference ## adrp_offset ## Ldur ## disp) { \
-    bool has_thunk = (adrp_offset == 0xff8u || adrp_offset == 0xffcu); \
+    bool has_thunk = ((adrp_offset) == 0xff8u || (adrp_offset) == 0xffcu); \
     TestAdrpLdurAdd(adrp_offset, has_thunk, disp); \
   }
 
@@ -793,7 +793,7 @@
   TEST_F(Arm64RelativePatcherTestDefault, StringReference ## adrp_offset ## AddsX0X2 ## disp) { \
     /* ADDS that does not use the result of "ADRP x0, addr" but overwrites that register. */ \
     uint32_t adds = kAddsXInsn | (100 << 10) | (2u << 5) | 0u;  /* ADDS x0, x2, #100 */ \
-    bool has_thunk = (adrp_offset == 0xff8u || adrp_offset == 0xffcu); \
+    bool has_thunk = ((adrp_offset) == 0xff8u || (adrp_offset) == 0xffcu); \
     TestAdrpInsn2Add(adds, adrp_offset, has_thunk, disp); \
   }
 
@@ -810,8 +810,8 @@
 // LDR <Xt>, <label> is aligned when offset + displacement is a multiple of 8.
 #define LDRX_PCREL_ADD_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, StringReference ## adrp_offset ## XPcRel ## disp) { \
-    bool unaligned = !IsAligned<8u>(adrp_offset + 4u + static_cast<uint32_t>(disp)); \
-    bool has_thunk = (adrp_offset == 0xff8u || adrp_offset == 0xffcu) && unaligned; \
+    bool unaligned = !IsAligned<8u>((adrp_offset) + 4u + static_cast<uint32_t>(disp)); \
+    bool has_thunk = ((adrp_offset) == 0xff8u || (adrp_offset) == 0xffcu) && unaligned; \
     TestAdrpLdrPcRelAdd(kLdrXPcRelInsn, disp, adrp_offset, has_thunk, 0x12345678u); \
   }
 
@@ -820,14 +820,14 @@
 // LDR <Wt>, [SP, #<pimm>] and LDR <Xt>, [SP, #<pimm>] are always aligned. No fixup needed.
 #define LDRW_SPREL_ADD_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, StringReference ## adrp_offset ## WSpRel ## disp) { \
-    TestAdrpLdrSpRelAdd(kLdrWSpRelInsn, disp >> 2, adrp_offset, false, 0x12345678u); \
+    TestAdrpLdrSpRelAdd(kLdrWSpRelInsn, (disp) >> 2, adrp_offset, false, 0x12345678u); \
   }
 
 TEST_FOR_OFFSETS(LDRW_SPREL_ADD_TEST, 0, 4)
 
 #define LDRX_SPREL_ADD_TEST(adrp_offset, disp) \
   TEST_F(Arm64RelativePatcherTestDefault, StringReference ## adrp_offset ## XSpRel ## disp) { \
-    TestAdrpLdrSpRelAdd(kLdrXSpRelInsn, disp >> 3, adrp_offset, false, 0x12345678u); \
+    TestAdrpLdrSpRelAdd(kLdrXSpRelInsn, (disp) >> 3, adrp_offset, false, 0x12345678u); \
   }
 
 TEST_FOR_OFFSETS(LDRX_SPREL_ADD_TEST, 0, 8)
diff --git a/compiler/utils/intrusive_forward_list_test.cc b/compiler/utils/intrusive_forward_list_test.cc
index 517142e..f2efa4d 100644
--- a/compiler/utils/intrusive_forward_list_test.cc
+++ b/compiler/utils/intrusive_forward_list_test.cc
@@ -39,12 +39,12 @@
   return lhs.value < rhs.value;
 }
 
-#define ASSERT_LISTS_EQUAL(expected, value)                                   \
-  do {                                                                        \
-    ASSERT_EQ(expected.empty(), value.empty());                               \
-    ASSERT_EQ(std::distance(expected.begin(), expected.end()),                \
-              std::distance(value.begin(), value.end()));                     \
-    ASSERT_TRUE(std::equal(expected.begin(), expected.end(), value.begin())); \
+#define ASSERT_LISTS_EQUAL(expected, value)                                         \
+  do {                                                                              \
+    ASSERT_EQ((expected).empty(), (value).empty());                                 \
+    ASSERT_EQ(std::distance((expected).begin(), (expected).end()),                  \
+              std::distance((value).begin(), (value).end()));                       \
+    ASSERT_TRUE(std::equal((expected).begin(), (expected).end(), (value).begin())); \
   } while (false)
 
 TEST(IntrusiveForwardList, IteratorToConstIterator) {