From 8d986df5df62ba700457c35c88ad4ab25a32ab62 Mon Sep 17 00:00:00 2001 From: emc Date: Tue, 7 May 2013 13:45:59 -0400 Subject: [PATCH] 8009729: Refix hotspot jni_.h JNIEXPORT and JNIIMPORT definitions to match jdk version Summary: Update JNIEXPORT and JNIIMPORT to work with other compilers that don't necessarily have the __attribute__ type qualifier Reviewed-by: dholmes, dcubed, coleenp --- src/cpu/sparc/vm/jni_sparc.h | 7 ++++++- src/cpu/x86/vm/jni_x86.h | 8 +++++++- src/cpu/zero/vm/jni_zero.h | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/cpu/sparc/vm/jni_sparc.h b/src/cpu/sparc/vm/jni_sparc.h index 5cb443ba9..2b0ce0081 100644 --- a/src/cpu/sparc/vm/jni_sparc.h +++ b/src/cpu/sparc/vm/jni_sparc.h @@ -23,7 +23,12 @@ * questions. */ -#if defined(__GNUC__) && (__GNUC__ >= 4) +// Note: please do not change these without also changing jni_md.h in the JDK +// repository +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) #define JNIEXPORT __attribute__((visibility("default"))) #define JNIIMPORT __attribute__((visibility("default"))) #else diff --git a/src/cpu/x86/vm/jni_x86.h b/src/cpu/x86/vm/jni_x86.h index 2cd7abd30..f5effdbe2 100644 --- a/src/cpu/x86/vm/jni_x86.h +++ b/src/cpu/x86/vm/jni_x86.h @@ -28,7 +28,13 @@ #if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE) -#if defined(__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2) + +// Note: please do not change these without also changing jni_md.h in the JDK +// repository +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) #define JNIEXPORT __attribute__((visibility("default"))) #define JNIIMPORT __attribute__((visibility("default"))) #else diff --git a/src/cpu/zero/vm/jni_zero.h b/src/cpu/zero/vm/jni_zero.h index 6ac4f63ea..11157f4f0 100644 --- a/src/cpu/zero/vm/jni_zero.h +++ b/src/cpu/zero/vm/jni_zero.h @@ -25,7 +25,13 @@ */ -#if defined(__GNUC__) && (__GNUC__ >= 4) + +// Note: please do not change these without also changing jni_md.h in the JDK +// repository +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility) #define JNIEXPORT __attribute__((visibility("default"))) #define JNIIMPORT __attribute__((visibility("default"))) #else -- GitLab