RFR: 8073994: STATIC_ASSERT use of __LINE__ is wrong

Kim Barrett kim.barrett at oracle.com
Wed Mar 4 20:14:21 UTC 2015


Please review this small cleanup of the infrastructure underlying the
STATIC_ASSERT macro.

I will need a sponsor for this change. 

STATIC_ASSERT is using macro token splicing incorrectly to (attempt
to) produce a unique type name.  Rather than fixing the splicing we
note that the unique type name isn't actually needed.

- If the assertion fails the type name never gets used at all.

- If the assertion passes we're just redefining a typedef name with
  the same type, which is permitted (C++03 7.1.3 clause 3).

So we just pick a dummy type name to always use.

CR:
https://bugs.openjdk.java.net/browse/JDK-8073994

Webrev:
http://cr.openjdk.java.net/~kbarrett/8073994/webrev.00

Testing:
JPRT
Local testing of assertion failures.



More information about the hotspot-dev mailing list