8034856/8034857: More gcc warnings (original) (raw)

Alan Bateman Alan.Bateman at oracle.com
Sun Feb 16 09:20:47 PST 2014


On 13/02/2014 21:14, Mikael Vidstedt wrote:

:

The change in question appears to come from https://bugs.openjdk.java.net/browse/JDK-6679866, but I'm not sure the bug gives enough additional information. My speculation (and it's really just a speculation) is that it's not related to isspace per-se, but to something else which gets defined/redefined/undefined by including ctype.h. I guess it would be good to know if we have tests which cover the thing the comment is alluding to (non-ascii in Premain-Class). Thanks for pointing this out. I looked at it again and the issue is that isspace is a macro and depends on the locale. By not including ctype.h then it means we get linked to the libc function instead. One approach is to include ctype.h and then #undef isspace, another is to define function prototype ourselves. I think the latter is a little bit better because it would avoid accidental usage of other local sensitive char classifiers. Attached is the patch that I propose. I have deliberate moved to to after other includes so we get a chance to #undef in the event that it gets included by something else.

On tests then PremainClassTest.java is good enough to find this on Solaris.

-Alan

diff --git a/src/share/instrument/JarFacade.c b/src/share/instrument/JarFacade.c --- a/src/share/instrument/JarFacade.c +++ b/src/share/instrument/JarFacade.c @@ -23,17 +23,20 @@

-#ifdef _WIN32 -/*

-#include <ctype.h> + +/**

+#else

#include "jni.h" #include "manifest_info.h"



More information about the serviceability-dev mailing list