RFR: 8067306: Improve STATIC_ASSERT

Stefan Karlsson stefan.karlsson at oracle.com
Fri Dec 12 11:47:45 UTC 2014

Hi Kim,

On 2014-12-12 08:30, Kim Barrett wrote:
> Please review this enhancement to the hotspot STATIC_ASSERT() macro.
> I will also need a sponsor for this change.
> [Note: Although this is in "runtime", development was done in hs-gc
> rather than hs-rt, and I'd rather have it pushed via hs-gc. The point
> of making this change was that I wanted it for some other work I'm
> doing. I'd rather not wait for repo reconcilliation, and I don't think
> anyone else is champing at the bit for this.]
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8067306
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/8067306/webrev/

Why do you use '(cond) ? true : false' instead of just '(cond)'?

243     STATIC_ASSERT_FAILURE< (Cond) ? true : false >::value ] \

Why do you have this line at the end of the define:

  244   /* */


> Testing:
> JPRT with temporary static assertions inserted at top-level, at class
> scope, and with value dependent on a template parameter, to verify the
> macro can now be used in those contexts. [The code base already
> contains several uses in function bodies, including with template
> dependencies.]
> JPRT with temporary intentional static assertion failures at
> top-level, class scope, function scope, and with value dependent on a
> template parameter, to verify expected failures occurred, and that the
> compiler error messages were informative.

More information about the hotspot-gc-dev mailing list