As reported in:
https://bugs.openjdk.java.net/show_bug.cgi?id=100297
Description From Radics Péter 2013-02-02 10:34:52 PDT
Created an attachment (id=288) [details]
Rename assert macro to assert_vm as it conflicts with libc's assert.
hotspot/src/share/vm/utilities/debug.hpp defines an assert macro with two
parameters. This macro definition clashes with libc's assert macro from
<assert.h> (and to the best of my knowledge it's undefined behavior to redefine
assert like this).
The name clash causes build failures if any of the files using debug.hpp
directly or indirectly include <assert.h> (or <cassert>), too.
This doesn't seem to happen with libstdc++, but this error is triggered if
trying to build with libc++ (http://libcxx.llvm.org).
I propose changing the name of the assert macro defined in debug.hpp to
assert_vm (based on the fact that this macro is used solely in the vm
subsystem).
I've broken up the patches to three parts, these should be applied in this
order:
1) patch-assert-vm-1.txt changes only the assert macro to assert_vm only in
debug.hpp (note: this patch assumes that the typo fix from bug 100294 is
already applied)
2) patch-assert-vm-2.txt removes the trickery used in
hotspot/src/share/vm/shark/llvmHeaders.hpp that was applied to avoid the
name-clash brought forth by including LLVM headers
3) fix-assert-vm-users.sh changes all other references to assert(cond, msg) to
assert_vm(cond, msg). This script should be run in hotspot/src. I decided to
post a fix-up script instead of a patch because the patch would be huge (there
are a lot of uses of the "new" assert macro.
https://bugs.openjdk.java.net/show_bug.cgi?id=100297
Description From Radics Péter 2013-02-02 10:34:52 PDT
Created an attachment (id=288) [details]
Rename assert macro to assert_vm as it conflicts with libc's assert.
hotspot/src/share/vm/utilities/debug.hpp defines an assert macro with two
parameters. This macro definition clashes with libc's assert macro from
<assert.h> (and to the best of my knowledge it's undefined behavior to redefine
assert like this).
The name clash causes build failures if any of the files using debug.hpp
directly or indirectly include <assert.h> (or <cassert>), too.
This doesn't seem to happen with libstdc++, but this error is triggered if
trying to build with libc++ (http://libcxx.llvm.org).
I propose changing the name of the assert macro defined in debug.hpp to
assert_vm (based on the fact that this macro is used solely in the vm
subsystem).
I've broken up the patches to three parts, these should be applied in this
order:
1) patch-assert-vm-1.txt changes only the assert macro to assert_vm only in
debug.hpp (note: this patch assumes that the typo fix from bug 100294 is
already applied)
2) patch-assert-vm-2.txt removes the trickery used in
hotspot/src/share/vm/shark/llvmHeaders.hpp that was applied to avoid the
name-clash brought forth by including LLVM headers
3) fix-assert-vm-users.sh changes all other references to assert(cond, msg) to
assert_vm(cond, msg). This script should be run in hotspot/src. I decided to
post a fix-up script instead of a patch because the patch would be huge (there
are a lot of uses of the "new" assert macro.
- blocks
-
JDK-8080775 Better argument formatting for assert() and friends
- Resolved
- is blocked by
-
JDK-8068396 Rename assert() to vmassert()
- Resolved
- relates to
-
JDK-8321558 HotSpot Style Guide needs update regarding stdlib assert
- Open
-
JDK-8068396 Rename assert() to vmassert()
- Resolved
-
JDK-8299254 Support dealing with standard assert macro
- Resolved