RFR: 8159365: assert is not defined for unit tests
Erik Helin
erik.helin at oracle.com
Tue Jun 14 09:59:37 UTC 2016
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