< prev index next >

src/share/vm/utilities/globalDefinitions_gcc.hpp

Print this page
rev 13110 : imported patch target_macros


 177 // .hpp for the class (os:Solaris usually) that needs them.
 178 
 179 extern "C" {
 180    typedef int (*int_fnP_thread_t_iP_uP_stack_tP_gregset_t)(thread_t, int*, unsigned *, stack_t*, gregset_t);
 181    typedef int (*int_fnP_thread_t_i_gregset_t)(thread_t, int, gregset_t);
 182    typedef int (*int_fnP_thread_t_i)(thread_t, int);
 183    typedef int (*int_fnP_thread_t)(thread_t);
 184 
 185    typedef int (*int_fnP_cond_tP_mutex_tP_timestruc_tP)(cond_t *cv, mutex_t *mx, timestruc_t *abst);
 186    typedef int (*int_fnP_cond_tP_mutex_tP)(cond_t *cv, mutex_t *mx);
 187 
 188    // typedef for missing API in libc
 189    typedef int (*int_fnP_mutex_tP_i_vP)(mutex_t *, int, void *);
 190    typedef int (*int_fnP_mutex_tP)(mutex_t *);
 191    typedef int (*int_fnP_cond_tP_i_vP)(cond_t *cv, int scope, void *arg);
 192    typedef int (*int_fnP_cond_tP)(cond_t *cv);
 193 };
 194 #endif // SOLARIS
 195 
 196 //----------------------------------------------------------------------------------------------------
 197 // Debugging
 198 
 199 #define DEBUG_EXCEPTION ::abort();
 200 
 201 extern "C" void breakpoint();
 202 #define BREAKPOINT ::breakpoint()
 203 
 204 // checking for nanness
 205 #ifdef SOLARIS
 206 #ifdef SPARC
 207 inline int g_isnan(float  f) { return isnanf(f); }
 208 #else
 209 // isnanf() broken on Intel Solaris use isnand()
 210 inline int g_isnan(float  f) { return isnand(f); }
 211 #endif
 212 inline int g_isnan(double f) { return isnand(f); }
 213 #elif defined(__APPLE__)
 214 inline int g_isnan(double f) { return isnan(f); }
 215 #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
 216 inline int g_isnan(float  f) { return isnanf(f); }
 217 inline int g_isnan(double f) { return isnan(f); }
 218 #else
 219 #error "missing platform-specific definition here"
 220 #endif
 221 
 222 // GCC 4.3 does not allow 0.0/0.0 to produce a NAN value
 223 #if (__GNUC__ == 4) && (__GNUC_MINOR__ > 2)
 224 #define CAN_USE_NAN_DEFINE 1
 225 #endif
 226 
 227 
 228 // Checking for finiteness
 229 
 230 inline int g_isfinite(jfloat  f)                 { return finite(f); }
 231 inline int g_isfinite(jdouble f)                 { return finite(f); }
 232 
 233 
 234 // Wide characters
 235 
 236 inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
 237 
 238 
 239 // Portability macros
 240 #define PRAGMA_INTERFACE             #pragma interface
 241 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 242 #define VALUE_OBJ_CLASS_SPEC
 243 
 244 // Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
 245 // were only introduced in GCC 4.2. Because we have no other possibility to ignore
 246 // these warnings for older versions of GCC, we simply don't decorate our printf-style
 247 // functions with __attribute__(format) in that case.
 248 #if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
 249 #ifndef ATTRIBUTE_PRINTF
 250 #define ATTRIBUTE_PRINTF(fmt,vargs)  __attribute__((format(printf, fmt, vargs)))
 251 #endif
 252 #ifndef ATTRIBUTE_SCANF
 253 #define ATTRIBUTE_SCANF(fmt,vargs)  __attribute__((format(scanf, fmt, vargs)))
 254 #endif
 255 #endif
 256 
 257 #define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
 258                                          _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
 259 #define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
 260 
 261 #if defined(__clang_major__) && \
 262       (__clang_major__ >= 4 || \
 263       (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
 264     ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
 265 // Tested to work with clang version 3.1 and better.
 266 #define PRAGMA_DIAG_PUSH             _Pragma("GCC diagnostic push")
 267 #define PRAGMA_DIAG_POP              _Pragma("GCC diagnostic pop")
 268 
 269 // Hack to deal with gcc yammering about non-security format stuff
 270 #else
 271 // Old versions of gcc don't do push/pop, also do not cope with this pragma within a function
 272 // One method does so much varied printing that it is decorated with both internal and external
 273 // versions of the macro-pragma to obtain better checking with newer compilers.
 274 #define PRAGMA_DIAG_PUSH
 275 #define PRAGMA_DIAG_POP
 276 #endif
 277 
 278 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
 279 #define TEMPLATE_TABLE_BUG
 280 #endif
 281 #if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 96)
 282 #define CONST_SDM_BUG
 283 #endif
 284 
 285 // Formatting.
 286 #ifdef _LP64
 287 #define FORMAT64_MODIFIER "l"
 288 #else // !_LP64
 289 #define FORMAT64_MODIFIER "ll"
 290 #endif // _LP64
 291 
 292 // HACK: gcc warns about applying offsetof() to non-POD object or calculating
 293 //       offset directly when base address is NULL. Use 16 to get around the
 294 //       warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
 295 //       this warning.
 296 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)


 177 // .hpp for the class (os:Solaris usually) that needs them.
 178 
 179 extern "C" {
 180    typedef int (*int_fnP_thread_t_iP_uP_stack_tP_gregset_t)(thread_t, int*, unsigned *, stack_t*, gregset_t);
 181    typedef int (*int_fnP_thread_t_i_gregset_t)(thread_t, int, gregset_t);
 182    typedef int (*int_fnP_thread_t_i)(thread_t, int);
 183    typedef int (*int_fnP_thread_t)(thread_t);
 184 
 185    typedef int (*int_fnP_cond_tP_mutex_tP_timestruc_tP)(cond_t *cv, mutex_t *mx, timestruc_t *abst);
 186    typedef int (*int_fnP_cond_tP_mutex_tP)(cond_t *cv, mutex_t *mx);
 187 
 188    // typedef for missing API in libc
 189    typedef int (*int_fnP_mutex_tP_i_vP)(mutex_t *, int, void *);
 190    typedef int (*int_fnP_mutex_tP)(mutex_t *);
 191    typedef int (*int_fnP_cond_tP_i_vP)(cond_t *cv, int scope, void *arg);
 192    typedef int (*int_fnP_cond_tP)(cond_t *cv);
 193 };
 194 #endif // SOLARIS
 195 
 196 //----------------------------------------------------------------------------------------------------






 197 
 198 // checking for nanness
 199 #ifdef SOLARIS
 200 #ifdef SPARC
 201 inline int g_isnan(float  f) { return isnanf(f); }
 202 #else
 203 // isnanf() broken on Intel Solaris use isnand()
 204 inline int g_isnan(float  f) { return isnand(f); }
 205 #endif
 206 inline int g_isnan(double f) { return isnand(f); }
 207 #elif defined(__APPLE__)
 208 inline int g_isnan(double f) { return isnan(f); }
 209 #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
 210 inline int g_isnan(float  f) { return isnanf(f); }
 211 inline int g_isnan(double f) { return isnan(f); }
 212 #else
 213 #error "missing platform-specific definition here"
 214 #endif
 215 
 216 // GCC 4.3 does not allow 0.0/0.0 to produce a NAN value
 217 #if (__GNUC__ == 4) && (__GNUC_MINOR__ > 2)
 218 #define CAN_USE_NAN_DEFINE 1
 219 #endif
 220 
 221 
 222 // Checking for finiteness
 223 
 224 inline int g_isfinite(jfloat  f)                 { return finite(f); }
 225 inline int g_isfinite(jdouble f)                 { return finite(f); }
 226 
 227 
 228 // Wide characters
 229 
 230 inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
 231 
 232 
 233 // Portability macros
 234 #define PRAGMA_INTERFACE             #pragma interface
 235 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 236 #define VALUE_OBJ_CLASS_SPEC


































 237 
 238 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
 239 #define TEMPLATE_TABLE_BUG
 240 #endif
 241 #if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 96)
 242 #define CONST_SDM_BUG
 243 #endif
 244 
 245 // Formatting.
 246 #ifdef _LP64
 247 #define FORMAT64_MODIFIER "l"
 248 #else // !_LP64
 249 #define FORMAT64_MODIFIER "ll"
 250 #endif // _LP64
 251 
 252 // HACK: gcc warns about applying offsetof() to non-POD object or calculating
 253 //       offset directly when base address is NULL. Use 16 to get around the
 254 //       warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
 255 //       this warning.
 256 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
< prev index next >