< prev index next >

src/share/vm/utilities/globalDefinitions_gcc.hpp

Print this page




 246 #define CAN_USE_NAN_DEFINE 1
 247 #endif
 248 
 249 
 250 // Checking for finiteness
 251 
 252 inline int g_isfinite(jfloat  f)                 { return finite(f); }
 253 inline int g_isfinite(jdouble f)                 { return finite(f); }
 254 
 255 
 256 // Wide characters
 257 
 258 inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
 259 
 260 
 261 // Portability macros
 262 #define PRAGMA_INTERFACE             #pragma interface
 263 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 264 #define VALUE_OBJ_CLASS_SPEC
 265 
 266 #ifndef ATTRIBUTE_PRINTF
 267 // Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
 268 // were only introduced in GCC 4.2. Because we have no other possibility to ignore
 269 // these warnings for older versions of GCC, we simply don't decorate our printf-style
 270 // functions with __attribute__(format) in that case.
 271 #if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)

 272 #define ATTRIBUTE_PRINTF(fmt,vargs)  __attribute__((format(printf, fmt, vargs)))
 273 #else
 274 #define ATTRIBUTE_PRINTF(fmt,vargs)
 275 #endif


 276 #endif

 277 
 278 #define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
 279                                          _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
 280 #define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
 281 
 282 #if defined(__clang_major__) && \
 283       (__clang_major__ >= 4 || \
 284       (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
 285     ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
 286 // Tested to work with clang version 3.1 and better.
 287 #define PRAGMA_DIAG_PUSH             _Pragma("GCC diagnostic push")
 288 #define PRAGMA_DIAG_POP              _Pragma("GCC diagnostic pop")
 289 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 290 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED
 291 
 292 // Hack to deal with gcc yammering about non-security format stuff
 293 #else
 294 // Old versions of gcc don't do push/pop, also do not cope with this pragma within a function
 295 // One method does so much varied printing that it is decorated with both internal and external
 296 // versions of the macro-pragma to obtain better checking with newer compilers.


 315 #ifdef _LP64
 316 #define FORMAT64_MODIFIER "l"
 317 #else // !_LP64
 318 #define FORMAT64_MODIFIER "ll"
 319 #endif // _LP64
 320 
 321 // HACK: gcc warns about applying offsetof() to non-POD object or calculating
 322 //       offset directly when base address is NULL. Use 16 to get around the
 323 //       warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
 324 //       this warning.
 325 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
 326 
 327 #ifdef offsetof
 328 # undef offsetof
 329 #endif
 330 #define offsetof(klass,field) offset_of(klass,field)
 331 
 332 #if defined(_LP64) && defined(__APPLE__)
 333 #define JLONG_FORMAT           "%ld"
 334 #endif // _LP64 && __APPLE__




 335 
 336 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP


 246 #define CAN_USE_NAN_DEFINE 1
 247 #endif
 248 
 249 
 250 // Checking for finiteness
 251 
 252 inline int g_isfinite(jfloat  f)                 { return finite(f); }
 253 inline int g_isfinite(jdouble f)                 { return finite(f); }
 254 
 255 
 256 // Wide characters
 257 
 258 inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
 259 
 260 
 261 // Portability macros
 262 #define PRAGMA_INTERFACE             #pragma interface
 263 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 264 #define VALUE_OBJ_CLASS_SPEC
 265 

 266 // Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
 267 // were only introduced in GCC 4.2. Because we have no other possibility to ignore
 268 // these warnings for older versions of GCC, we simply don't decorate our printf-style
 269 // functions with __attribute__(format) in that case.
 270 #if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
 271 #ifndef ATTRIBUTE_PRINTF
 272 #define ATTRIBUTE_PRINTF(fmt,vargs)  __attribute__((format(printf, fmt, vargs)))


 273 #endif
 274 #ifndef ATTRIBUTE_SCANF
 275 #define ATTRIBUTE_SCANF(fmt,vargs)  __attribute__((format(scanf, fmt, vargs)))
 276 #endif
 277 #endif // gcc version check
 278 
 279 #define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
 280                                          _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
 281 #define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
 282 
 283 #if defined(__clang_major__) && \
 284       (__clang_major__ >= 4 || \
 285       (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
 286     ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
 287 // Tested to work with clang version 3.1 and better.
 288 #define PRAGMA_DIAG_PUSH             _Pragma("GCC diagnostic push")
 289 #define PRAGMA_DIAG_POP              _Pragma("GCC diagnostic pop")
 290 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 291 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED
 292 
 293 // Hack to deal with gcc yammering about non-security format stuff
 294 #else
 295 // Old versions of gcc don't do push/pop, also do not cope with this pragma within a function
 296 // One method does so much varied printing that it is decorated with both internal and external
 297 // versions of the macro-pragma to obtain better checking with newer compilers.


 316 #ifdef _LP64
 317 #define FORMAT64_MODIFIER "l"
 318 #else // !_LP64
 319 #define FORMAT64_MODIFIER "ll"
 320 #endif // _LP64
 321 
 322 // HACK: gcc warns about applying offsetof() to non-POD object or calculating
 323 //       offset directly when base address is NULL. Use 16 to get around the
 324 //       warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
 325 //       this warning.
 326 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
 327 
 328 #ifdef offsetof
 329 # undef offsetof
 330 #endif
 331 #define offsetof(klass,field) offset_of(klass,field)
 332 
 333 #if defined(_LP64) && defined(__APPLE__)
 334 #define JLONG_FORMAT           "%ld"
 335 #endif // _LP64 && __APPLE__
 336 
 337 // Inlining support
 338 #define NOINLINE     __attribute__ ((noinline))
 339 #define ALWAYSINLINE inline __attribute__ ((always_inline))
 340 
 341 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP
< prev index next >