8007770: fix name clash of assert macro in debug.hpp with libc's assert macro [Was: Re: Bug 100297 - [patch] fix name clash of assert macro in debug.hpp with libc's assert macro]
Christian Thalinger
christian.thalinger at oracle.com
Tue Feb 19 13:56:35 PST 2013
[David already filed an RFE for this:
8007770: fix name clash of assert macro in debug.hpp with libc's assert macro]
On Feb 19, 2013, at 7:55 AM, Péter Radics <mitchnull at gmail.com> wrote:
> Hello,
>
> 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++ (yet?), 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 created a set of patches and attached it to issue 100297:
> https://bugs.openjdk.java.net/show_bug.cgi?id=100297
>
>
> I believe libc++ will be used by more and more systems in the near future
> (as far as I
> know FreeBSD is planning to include it as the default c++ lib in a coming
> release), so
> it would be worthwhile fixing this issue.
That's an interesting point and it's something that will bite us eventually. I would suggest to rename it to ASSERT since it's actually a macro.
-- Chris
>
> cheers,
> mitch
More information about the hotspot-dev
mailing list