Fix misc-macro-parentheses warnings.
* Add parentheses to fix warnings.
* Use NOLINT to suppress wrong clang-tidy warnings.
Bug: 28705665
Change-Id: Icc8bc9b59583dee0ea17ab83e0ff0383b8599c3e
diff --git a/runtime/dex_file_verifier.cc b/runtime/dex_file_verifier.cc
index bbffbbb..88eca44 100644
--- a/runtime/dex_file_verifier.cc
+++ b/runtime/dex_file_verifier.cc
@@ -101,31 +101,31 @@
}
// Helper macro to load string and return false on error.
-#define LOAD_STRING(var, idx, error) \
- const char* var = CheckLoadStringByIdx(idx, error); \
- if (UNLIKELY(var == nullptr)) { \
- return false; \
+#define LOAD_STRING(var, idx, error) \
+ const char* (var) = CheckLoadStringByIdx(idx, error); \
+ if (UNLIKELY((var) == nullptr)) { \
+ return false; \
}
// Helper macro to load string by type idx and return false on error.
-#define LOAD_STRING_BY_TYPE(var, type_idx, error) \
- const char* var = CheckLoadStringByTypeIdx(type_idx, error); \
- if (UNLIKELY(var == nullptr)) { \
- return false; \
+#define LOAD_STRING_BY_TYPE(var, type_idx, error) \
+ const char* (var) = CheckLoadStringByTypeIdx(type_idx, error); \
+ if (UNLIKELY((var) == nullptr)) { \
+ return false; \
}
// Helper macro to load method id. Return last parameter on error.
-#define LOAD_METHOD(var, idx, error_string, error_stmt) \
- const DexFile::MethodId* var = CheckLoadMethodId(idx, error_string); \
- if (UNLIKELY(var == nullptr)) { \
- error_stmt; \
+#define LOAD_METHOD(var, idx, error_string, error_stmt) \
+ const DexFile::MethodId* (var) = CheckLoadMethodId(idx, error_string); \
+ if (UNLIKELY((var) == nullptr)) { \
+ error_stmt; \
}
// Helper macro to load method id. Return last parameter on error.
-#define LOAD_FIELD(var, idx, fmt, error_stmt) \
- const DexFile::FieldId* var = CheckLoadFieldId(idx, fmt); \
- if (UNLIKELY(var == nullptr)) { \
- error_stmt; \
+#define LOAD_FIELD(var, idx, fmt, error_stmt) \
+ const DexFile::FieldId* (var) = CheckLoadFieldId(idx, fmt); \
+ if (UNLIKELY((var) == nullptr)) { \
+ error_stmt; \
}
bool DexFileVerifier::Verify(const DexFile* dex_file, const uint8_t* begin, size_t size,