> This seems like an obvious improvement. > There are already bunches of places in the jdk sources that do things like: > > ./hotspot/src/cpu/x86/vm/jni_x86.h > #if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) > > #if defined(__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4) && > (__GNUC_MINOR__ > 2) > #define JNIEXPORT __attribute__((visibility("default"))) > #define JNIIMPORT __attribute__((visibility("default"))) > #else > #define JNIEXPORT > #define JNIIMPORT > #endif
That version check didn't work for me running on Mac OS X (using llvm-gcc 4.2). If that's what hotspot is using then they may not be getting the desired effect. The problem is __GNUC_MINOR__ is 2, so it needs to be changed to >= 2. Gnu recommends just using "#if __GNUC__ >= 4", and everything I've read about it says it's 4.0 and later, so I don't understand why the minor version check is even in there. -DrD-