changeset 39395:af07388255fc

8159365: assert is not defined for unit tests Reviewed-by: jwilhelm, coleenp
author ehelin
date Mon, 13 Jun 2016 13:54:46 +0200
parents 044a0eb96215
children 84aae7f2f638
files hotspot/test/native/unittest.hpp
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/test/native/unittest.hpp	Mon Jun 13 13:48:37 2016 +0200
+++ b/hotspot/test/native/unittest.hpp	Mon Jun 13 13:54:46 2016 +0200
@@ -27,8 +27,17 @@
 
 #define GTEST_DONT_DEFINE_TEST 1
 #include "gtest/gtest.h"
+
+// gtest/gtest.h includes assert.h which will define the assert macro, but hotspot has its
+// own standards incompatible assert macro that takes two parameters.
+// The workaround is to undef assert and then re-define it. 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.
 #ifdef assert
   #undef assert
+  #ifdef vmassert
+    #define assert(p, ...) vmassert(p, __VA_ARGS__)
+  #endif
 #endif
 
 #define CONCAT(a, b) a ## b