This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [RFA/JVMTI] New JVMTI Environment Initialization/Allocation
- From: Andrew Haley <aph at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Keith Seitz <keiths at redhat dot com>, Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Fri, 1 Sep 2006 10:18:39 +0100
- Subject: Re: [RFA/JVMTI] New JVMTI Environment Initialization/Allocation
- References: <44F78616.2010206@redhat.com> <m3k64ol795.fsf@localhost.localdomain>
Tom Tromey writes:
> >>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>
> Keith> I've also snuck in another little patch which adds another common test
> Keith> macro, this time for JVMTI_ERROR_ILLEGAL_ARGUMENT.
>
> I noticed that this macro has no trailing ';' but NULL_CHECK does have
> one. The semicolon should probably be removed from NULL_CHECK.
These macros are dangerous because of hidden dangling else:
#define NULL_CHECK(Ptr) \
if (Ptr == NULL) return JVMTI_ERROR_NULL_POINTER;
They should be, e.g.,
#define NULL_CHECK(Ptr)
do \
{ \
if (Ptr == NULL) \
return JVMTI_ERROR_NULL_POINTER; \
} \
while (0)
Otherwise, something like
if (poo)
NULL_CHECK (p);
else
barf ();
may not do as you expected.
Andrew.