RFR: 8086027: Multiple STATIC_ASSERTs at class scope doesn't work (original) (raw)

Bengt Rutisson bengt.rutisson at oracle.com
Tue Jun 9 08:48:05 UTC 2015


Hi Kim,

On 2015-06-09 07:51, Kim Barrett wrote:

Third time's the charm?

:)

Please review this change to the STATICASSERT macro, to allow multiple assertions in the same class scope. It seems we do need to make the typedef names used in the expansion unique per scope; see CR for details. We accomplish this with preprocessor token pasting with LINE (done correctly, unlike in the change for JDK-8067306). Apparently my testing for JDK-8073994 missed the class scope case. With this change set I'm adding tests for all three of namespace, class, and function scope. As part of this, I'm also adding PASTETOKENS(x, y) utility macro. I'm willing to entertain alternative naming suggestions, though hoping to avoid a bikeshed discussion.

I don't have any better suggestions for the names. I would be fine with XSTRCAT as suggested by David Holmes. Or maybe just XCAT since we are dealing with tokens and not strings.

CR: https://bugs.openjdk.java.net/browse/JDK-8086027 Webrev: http://cr.openjdk.java.net/~kbarrett/8086027/webrev.00/

This looks good to me. One question about the test in debug.cpp:

792 // class scope 793 struct TestMultipleStaticAssertFormsInClassScope {

I know struct and class are pretty much the same, but wouldn't it be more consistent to use class instead of struct here since the comment (and I think the spec) talk about class scope?

Either way is fine with me and in any case you don't need to send out another webrev.

Thanks, Bengt

Testing: JPRT



More information about the hotspot-dev mailing list