ART: Fix macro parentheses warnings
Change code for types. Add NOLINT where there's no better way.
Bug: 32619234
Test: m
Change-Id: Ie5d9cc576b72c4a1bb1d9e4b439333702800abb9
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 8f72714..35f2f0c 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -31,6 +31,8 @@
#include "ti_method.h"
+#include <type_traits>
+
#include "art_jvmti.h"
#include "art_method-inl.h"
#include "base/enums.h"
@@ -1012,11 +1014,11 @@
#undef JNI_TYPE_CHAR
-#define RW_JVALUE(type, prim, id) \
- template<> void ReadJvalue<type>(jvalue in, type* out) { \
+#define RW_JVALUE(srctype, prim, id) \
+ template<> void ReadJvalue<srctype>(jvalue in, std::add_pointer<srctype>::type out) { \
*out = in.id; \
} \
- template<> void WriteJvalue<type>(type in, jvalue* out) { \
+ template<> void WriteJvalue<srctype>(srctype in, jvalue* out) { \
out->id = in; \
}
@@ -1058,9 +1060,17 @@
}
}
-#define GET_SET_LV(type, prim, id) \
- template jvmtiError MethodUtil::GetLocalVariable<type>(jvmtiEnv*, jthread, jint, jint, type*); \
- template jvmtiError MethodUtil::SetLocalVariable<type>(jvmtiEnv*, jthread, jint, jint, type);
+#define GET_SET_LV(srctype, prim, id) \
+ template jvmtiError MethodUtil::GetLocalVariable<srctype>(jvmtiEnv*, \
+ jthread, \
+ jint, \
+ jint, \
+ std::add_pointer<srctype>::type); \
+ template jvmtiError MethodUtil::SetLocalVariable<srctype>(jvmtiEnv*, \
+ jthread, \
+ jint, \
+ jint, \
+ srctype);
FOR_JVMTI_JVALUE_TYPES(GET_SET_LV);
diff --git a/runtime/entrypoints/quick/quick_field_entrypoints.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc
index b298db6..b13103d 100644
--- a/runtime/entrypoints/quick/quick_field_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc
@@ -79,12 +79,12 @@
field_idx, referrer, Static ## PrimitiveOrObject ## Read, \
sizeof(PrimitiveType)); \
if (LIKELY(field != nullptr)) { \
- return field->Get ## Kind (field->GetDeclaringClass())Ptr; \
+ return field->Get ## Kind (field->GetDeclaringClass())Ptr; /* NOLINT */ \
} \
field = FindFieldFromCode<Static ## PrimitiveOrObject ## Read, true>( \
field_idx, referrer, self, sizeof(PrimitiveType)); \
if (LIKELY(field != nullptr)) { \
- return field->Get ## Kind (field->GetDeclaringClass())Ptr; \
+ return field->Get ## Kind (field->GetDeclaringClass())Ptr; /* NOLINT */ \
} \
/* Will throw exception by checking with Thread::Current. */ \
return 0; \
@@ -100,12 +100,12 @@
field_idx, referrer, Instance ## PrimitiveOrObject ## Read, \
sizeof(PrimitiveType)); \
if (LIKELY(field != nullptr) && obj != nullptr) { \
- return field->Get ## Kind (obj)Ptr; \
+ return field->Get ## Kind (obj)Ptr; /* NOLINT */ \
} \
field = FindInstanceField<Instance ## PrimitiveOrObject ## Read, true>( \
field_idx, referrer, self, sizeof(PrimitiveType), &obj); \
if (LIKELY(field != nullptr)) { \
- return field->Get ## Kind (obj)Ptr; \
+ return field->Get ## Kind (obj)Ptr; /* NOLINT */ \
} \
/* Will throw exception by checking with Thread::Current. */ \
return 0; \