-
Bug
-
Resolution: Fixed
-
P3
-
11, 12, 13
-
b23
In JDK-8211073, we tried to enable -Wextra for gcc on hotspot. This triggers the "enumeral and non-enumeral type in conditional expression" warning for eight methods in hotspot. The code typically looks like this:
types[index] = (tag.is_unresolved_klass()) ? JVM_CONSTANT_Class : tag.value();
but tag.value() returns an unsigned char, and JVM_CONSTANT_Class is an enum.
Kim Barrett suggested to rewrite those enums to be static const members instead. This would allow us to enable -Wextra, without having to add casts to the enums in the ?: clauses.
The enums in question that triggers this warning are:
* CompLevel_highest_tier
* Op_RegFlags
* NO_HASH
* JVM_CONSTANT_Class
I'm also getting the compiler warning for Klass::_lh_array_tag_obj_value, but from my cursory reading of the source code it is not clear to me that any of them is an enum..? But apparently the compiler believes this, so it's probably correct.
types[index] = (tag.is_unresolved_klass()) ? JVM_CONSTANT_Class : tag.value();
but tag.value() returns an unsigned char, and JVM_CONSTANT_Class is an enum.
Kim Barrett suggested to rewrite those enums to be static const members instead. This would allow us to enable -Wextra, without having to add casts to the enums in the ?: clauses.
The enums in question that triggers this warning are:
* CompLevel_highest_tier
* Op_RegFlags
* NO_HASH
* JVM_CONSTANT_Class
I'm also getting the compiler warning for Klass::_lh_array_tag_obj_value, but from my cursory reading of the source code it is not clear to me that any of them is an enum..? But apparently the compiler believes this, so it's probably correct.
- blocks
-
JDK-8211073 Remove -Wno-extra from Hotspot
- Resolved
- is cloned by
-
JDK-8223400 Replace some enums with static const members in hotspot/runtime
- Resolved
- relates to
-
JDK-8223400 Replace some enums with static const members in hotspot/runtime
- Resolved