RFR: 8159365: assert is not defined for unit tests

Coleen Phillimore coleen.phillimore at oracle.com
Tue Jun 14 15:58:41 UTC 2016


Or you could just change all the hotspot non conforming asserts to 
vmassert.  j.k.
Looks good.

Coleen

On 6/14/16 5:59 AM, Erik Helin wrote:
> Hi all,
>
> we have a small problem with the `assert` macro and the gtest unit
> tests. The issue is that unittest.hpp will include gtest/gtest.h and
> gtest/gtest.h includes assert.h which will define the assert macro.
> The problem is that hotspot has its own standards incompatible assert
> macro that takes two parameters. So if a test includes unittest.hpp,
> then the standard assert macro will be defined, not the hotspot one.
>
> The workaround is to undef assert and then re-define hotspot's assert
> macro. The re-definition must unfortunately be copied since debug.hpp
> might already have been included and a second include wouldn't work due
> to the header guards in debug.hpp.
>
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8159365
>
> Webrev:
> http://cr.openjdk.java.net/~ehelin/8159365/00/
>
> Testing:
> - JPRT
>
> Thanks,
> Erik



More information about the hotspot-dev mailing list