src/share/vm/utilities/macros.hpp

Thu, 22 May 2014 15:52:41 -0400

author
drchase
date
Thu, 22 May 2014 15:52:41 -0400
changeset 6680
78bbf4d43a14
parent 6503
a9becfeecd1b
child 6876
710a3c8b516e
child 7598
ddce0b7cee93
permissions
-rw-r--r--

8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti

duke@435 1 /*
mikael@6198 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_UTILITIES_MACROS_HPP
stefank@2314 26 #define SHARE_VM_UTILITIES_MACROS_HPP
stefank@2314 27
duke@435 28 // Use this to mark code that needs to be cleaned up (for development only)
duke@435 29 #define NEEDS_CLEANUP
duke@435 30
duke@435 31 // Makes a string of the argument (which is not macro-expanded)
duke@435 32 #define STR(a) #a
duke@435 33
duke@435 34 // Makes a string of the macro expansion of a
duke@435 35 #define XSTR(a) STR(a)
duke@435 36
jprovino@4165 37 // -DINCLUDE_<something>=0 | 1 can be specified on the command line to include
jprovino@4165 38 // or exclude functionality.
duke@435 39
jprovino@4165 40 #ifndef INCLUDE_JVMTI
jprovino@4165 41 #define INCLUDE_JVMTI 1
jprovino@4165 42 #endif // INCLUDE_JVMTI
duke@435 43
jprovino@4165 44 #if INCLUDE_JVMTI
jprovino@4165 45 #define JVMTI_ONLY(x) x
jprovino@4165 46 #define NOT_JVMTI(x)
jprovino@4165 47 #define NOT_JVMTI_RETURN
jprovino@4165 48 #define NOT_JVMTI_RETURN_(code) /* next token must be ; */
jprovino@4165 49 #else
jprovino@4165 50 #define JVMTI_ONLY(x)
jprovino@4165 51 #define NOT_JVMTI(x) x
jprovino@4165 52 #define NOT_JVMTI_RETURN { return; }
jprovino@4165 53 #define NOT_JVMTI_RETURN_(code) { return code; }
jprovino@4165 54 #endif // INCLUDE_JVMTI
duke@435 55
jprovino@4165 56 #ifndef INCLUDE_FPROF
jprovino@4165 57 #define INCLUDE_FPROF 1
jprovino@4165 58 #endif
duke@435 59
jprovino@4165 60 #if INCLUDE_FPROF
jprovino@4165 61 #define NOT_FPROF_RETURN /* next token must be ; */
jprovino@4165 62 #define NOT_FPROF_RETURN_(code) /* next token must be ; */
jprovino@4165 63 #else
jprovino@4165 64 #define NOT_FPROF_RETURN {}
jprovino@4165 65 #define NOT_FPROF_RETURN_(code) { return code; }
jprovino@4165 66 #endif // INCLUDE_FPROF
duke@435 67
jprovino@4165 68 #ifndef INCLUDE_VM_STRUCTS
jprovino@4165 69 #define INCLUDE_VM_STRUCTS 1
jprovino@4165 70 #endif
jprovino@4165 71
jprovino@4165 72 #if INCLUDE_VM_STRUCTS
jprovino@4165 73 #define NOT_VM_STRUCTS_RETURN /* next token must be ; */
jprovino@4165 74 #define NOT_VM_STRUCTS_RETURN_(code) /* next token must be ; */
jprovino@4165 75 #else
jprovino@4165 76 #define NOT_VM_STRUCTS_RETURN {}
jprovino@4165 77 #define NOT_VM_STRUCTS_RETURN_(code) { return code; }
jprovino@4165 78 #endif // INCLUDE_VM_STRUCTS
jprovino@4165 79
jprovino@4165 80 #ifndef INCLUDE_JNI_CHECK
jprovino@4165 81 #define INCLUDE_JNI_CHECK 1
jprovino@4165 82 #endif
jprovino@4165 83
jprovino@4165 84 #if INCLUDE_JNI_CHECK
jprovino@4165 85 #define NOT_JNI_CHECK_RETURN /* next token must be ; */
jprovino@4165 86 #define NOT_JNI_CHECK_RETURN_(code) /* next token must be ; */
jprovino@4165 87 #else
jprovino@4165 88 #define NOT_JNI_CHECK_RETURN {}
jprovino@4165 89 #define NOT_JNI_CHECK_RETURN_(code) { return code; }
jprovino@4165 90 #endif // INCLUDE_JNI_CHECK
jprovino@4165 91
jprovino@4165 92 #ifndef INCLUDE_SERVICES
jprovino@4165 93 #define INCLUDE_SERVICES 1
jprovino@4165 94 #endif
jprovino@4165 95
jprovino@4165 96 #if INCLUDE_SERVICES
jprovino@4165 97 #define NOT_SERVICES_RETURN /* next token must be ; */
jprovino@4165 98 #define NOT_SERVICES_RETURN_(code) /* next token must be ; */
jprovino@4165 99 #else
jprovino@4165 100 #define NOT_SERVICES_RETURN {}
jprovino@4165 101 #define NOT_SERVICES_RETURN_(code) { return code; }
jprovino@4165 102 #endif // INCLUDE_SERVICES
jprovino@4165 103
jprovino@4165 104 #ifndef INCLUDE_CDS
jprovino@4165 105 #define INCLUDE_CDS 1
jprovino@4165 106 #endif
jprovino@4165 107
jprovino@4165 108 #if INCLUDE_CDS
jprovino@4165 109 #define CDS_ONLY(x) x
jprovino@4165 110 #define NOT_CDS(x)
jprovino@4165 111 #define NOT_CDS_RETURN /* next token must be ; */
jprovino@4165 112 #define NOT_CDS_RETURN_(code) /* next token must be ; */
jprovino@4165 113 #else
jprovino@4165 114 #define CDS_ONLY(x)
jprovino@4165 115 #define NOT_CDS(x) x
jprovino@4165 116 #define NOT_CDS_RETURN {}
jprovino@4165 117 #define NOT_CDS_RETURN_(code) { return code; }
jprovino@4165 118 #endif // INCLUDE_CDS
jprovino@4165 119
jprovino@4165 120 #ifndef INCLUDE_MANAGEMENT
jprovino@4165 121 #define INCLUDE_MANAGEMENT 1
jprovino@4165 122 #endif // INCLUDE_MANAGEMENT
jprovino@4165 123
jprovino@4165 124 #if INCLUDE_MANAGEMENT
jprovino@4165 125 #define NOT_MANAGEMENT_RETURN /* next token must be ; */
jprovino@4165 126 #define NOT_MANAGEMENT_RETURN_(code) /* next token must be ; */
jprovino@4165 127 #else
jprovino@4165 128 #define NOT_MANAGEMENT_RETURN {}
jprovino@4165 129 #define NOT_MANAGEMENT_RETURN_(code) { return code; }
jprovino@4165 130 #endif // INCLUDE_MANAGEMENT
jprovino@4165 131
jprovino@4165 132 /*
jprovino@4542 133 * When INCLUDE_ALL_GCS is false the only garbage collectors
jprovino@4165 134 * included in the JVM are defaultNewGeneration and markCompact.
jprovino@4165 135 *
jprovino@4542 136 * When INCLUDE_ALL_GCS is true all garbage collectors are
jprovino@4165 137 * included in the JVM.
jprovino@4165 138 */
jprovino@4542 139 #ifndef INCLUDE_ALL_GCS
jprovino@4542 140 #define INCLUDE_ALL_GCS 1
jprovino@4542 141 #endif // INCLUDE_ALL_GCS
jprovino@4165 142
jprovino@4542 143 #if INCLUDE_ALL_GCS
jprovino@4542 144 #define NOT_ALL_GCS_RETURN /* next token must be ; */
jprovino@4542 145 #define NOT_ALL_GCS_RETURN_(code) /* next token must be ; */
jprovino@4165 146 #else
jprovino@4542 147 #define NOT_ALL_GCS_RETURN {}
jprovino@4542 148 #define NOT_ALL_GCS_RETURN_(code) { return code; }
jprovino@4542 149 #endif // INCLUDE_ALL_GCS
jprovino@4165 150
jprovino@4165 151 #ifndef INCLUDE_NMT
jprovino@4165 152 #define INCLUDE_NMT 1
jprovino@4165 153 #endif // INCLUDE_NMT
jprovino@4165 154
jprovino@4165 155 #if INCLUDE_NMT
jprovino@4165 156 #define NOT_NMT_RETURN /* next token must be ; */
jprovino@4165 157 #define NOT_NMT_RETURN_(code) /* next token must be ; */
jprovino@4165 158 #else
jprovino@4165 159 #define NOT_NMT_RETURN {}
jprovino@4165 160 #define NOT_NMT_RETURN_(code) { return code; }
jprovino@4165 161 #endif // INCLUDE_NMT
duke@435 162
sla@5237 163 #ifndef INCLUDE_TRACE
sla@5237 164 #define INCLUDE_TRACE 1
sla@5237 165 #endif // INCLUDE_TRACE
sla@5237 166
duke@435 167 // COMPILER1 variant
duke@435 168 #ifdef COMPILER1
duke@435 169 #ifdef COMPILER2
duke@435 170 #define TIERED
duke@435 171 #endif
duke@435 172 #define COMPILER1_PRESENT(code) code
duke@435 173 #else // COMPILER1
duke@435 174 #define COMPILER1_PRESENT(code)
duke@435 175 #endif // COMPILER1
duke@435 176
duke@435 177 // COMPILER2 variant
duke@435 178 #ifdef COMPILER2
duke@435 179 #define COMPILER2_PRESENT(code) code
ysr@888 180 #define NOT_COMPILER2(code)
duke@435 181 #else // COMPILER2
duke@435 182 #define COMPILER2_PRESENT(code)
ysr@888 183 #define NOT_COMPILER2(code) code
duke@435 184 #endif // COMPILER2
duke@435 185
iveresov@2138 186 #ifdef TIERED
iveresov@2138 187 #define TIERED_ONLY(code) code
iveresov@2138 188 #define NOT_TIERED(code)
iveresov@2138 189 #else
iveresov@2138 190 #define TIERED_ONLY(code)
iveresov@2138 191 #define NOT_TIERED(code) code
iveresov@2138 192 #endif // TIERED
iveresov@2138 193
duke@435 194
duke@435 195 // PRODUCT variant
duke@435 196 #ifdef PRODUCT
duke@435 197 #define PRODUCT_ONLY(code) code
duke@435 198 #define NOT_PRODUCT(code)
ikrylov@2123 199 #define NOT_PRODUCT_ARG(arg)
duke@435 200 #define PRODUCT_RETURN {}
duke@435 201 #define PRODUCT_RETURN0 { return 0; }
duke@435 202 #define PRODUCT_RETURN_(code) { code }
duke@435 203 #else // PRODUCT
duke@435 204 #define PRODUCT_ONLY(code)
duke@435 205 #define NOT_PRODUCT(code) code
ikrylov@2123 206 #define NOT_PRODUCT_ARG(arg) arg,
duke@435 207 #define PRODUCT_RETURN /*next token must be ;*/
duke@435 208 #define PRODUCT_RETURN0 /*next token must be ;*/
duke@435 209 #define PRODUCT_RETURN_(code) /*next token must be ;*/
duke@435 210 #endif // PRODUCT
duke@435 211
duke@435 212 #ifdef CHECK_UNHANDLED_OOPS
duke@435 213 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
duke@435 214 #define NOT_CHECK_UNHANDLED_OOPS(code)
duke@435 215 #else
duke@435 216 #define CHECK_UNHANDLED_OOPS_ONLY(code)
duke@435 217 #define NOT_CHECK_UNHANDLED_OOPS(code) code
duke@435 218 #endif // CHECK_UNHANDLED_OOPS
duke@435 219
duke@435 220 #ifdef CC_INTERP
duke@435 221 #define CC_INTERP_ONLY(code) code
duke@435 222 #define NOT_CC_INTERP(code)
duke@435 223 #else
duke@435 224 #define CC_INTERP_ONLY(code)
duke@435 225 #define NOT_CC_INTERP(code) code
duke@435 226 #endif // CC_INTERP
duke@435 227
duke@435 228 #ifdef ASSERT
duke@435 229 #define DEBUG_ONLY(code) code
duke@435 230 #define NOT_DEBUG(code)
jcoomes@1244 231 #define NOT_DEBUG_RETURN /*next token must be ;*/
duke@435 232 // Historical.
duke@435 233 #define debug_only(code) code
duke@435 234 #else // ASSERT
duke@435 235 #define DEBUG_ONLY(code)
duke@435 236 #define NOT_DEBUG(code) code
jcoomes@1244 237 #define NOT_DEBUG_RETURN {}
duke@435 238 #define debug_only(code)
duke@435 239 #endif // ASSERT
duke@435 240
duke@435 241 #ifdef _LP64
duke@435 242 #define LP64_ONLY(code) code
duke@435 243 #define NOT_LP64(code)
duke@435 244 #else // !_LP64
duke@435 245 #define LP64_ONLY(code)
duke@435 246 #define NOT_LP64(code) code
duke@435 247 #endif // _LP64
duke@435 248
duke@435 249 #ifdef LINUX
duke@435 250 #define LINUX_ONLY(code) code
duke@435 251 #define NOT_LINUX(code)
duke@435 252 #else
duke@435 253 #define LINUX_ONLY(code)
duke@435 254 #define NOT_LINUX(code) code
duke@435 255 #endif
duke@435 256
goetz@6461 257 #ifdef AIX
goetz@6461 258 #define AIX_ONLY(code) code
goetz@6461 259 #define NOT_AIX(code)
goetz@6461 260 #else
goetz@6461 261 #define AIX_ONLY(code)
goetz@6461 262 #define NOT_AIX(code) code
goetz@6461 263 #endif
goetz@6461 264
duke@435 265 #ifdef SOLARIS
duke@435 266 #define SOLARIS_ONLY(code) code
duke@435 267 #define NOT_SOLARIS(code)
duke@435 268 #else
duke@435 269 #define SOLARIS_ONLY(code)
duke@435 270 #define NOT_SOLARIS(code) code
duke@435 271 #endif
duke@435 272
duke@435 273 #ifdef _WINDOWS
duke@435 274 #define WINDOWS_ONLY(code) code
duke@435 275 #define NOT_WINDOWS(code)
duke@435 276 #else
duke@435 277 #define WINDOWS_ONLY(code)
duke@435 278 #define NOT_WINDOWS(code) code
duke@435 279 #endif
duke@435 280
never@3156 281 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
never@3156 282 #define BSD_ONLY(code) code
never@3156 283 #define NOT_BSD(code)
never@3156 284 #else
never@3156 285 #define BSD_ONLY(code)
never@3156 286 #define NOT_BSD(code) code
never@3156 287 #endif
never@3156 288
twisti@2603 289 #ifdef _WIN64
twisti@2603 290 #define WIN64_ONLY(code) code
twisti@2603 291 #define NOT_WIN64(code)
twisti@2603 292 #else
twisti@2603 293 #define WIN64_ONLY(code)
twisti@2603 294 #define NOT_WIN64(code) code
twisti@2603 295 #endif
twisti@2603 296
twisti@4237 297 #if defined(ZERO)
twisti@4237 298 #define ZERO_ONLY(code) code
twisti@4237 299 #define NOT_ZERO(code)
twisti@4237 300 #else
twisti@4237 301 #define ZERO_ONLY(code)
twisti@4237 302 #define NOT_ZERO(code) code
twisti@4237 303 #endif
twisti@4237 304
twisti@4237 305 #if defined(SHARK)
twisti@4237 306 #define SHARK_ONLY(code) code
twisti@4237 307 #define NOT_SHARK(code)
twisti@4237 308 #else
twisti@4237 309 #define SHARK_ONLY(code)
twisti@4237 310 #define NOT_SHARK(code) code
twisti@4237 311 #endif
twisti@4237 312
never@739 313 #if defined(IA32) || defined(AMD64)
never@739 314 #define X86
never@739 315 #define X86_ONLY(code) code
twisti@2047 316 #define NOT_X86(code)
never@739 317 #else
never@739 318 #undef X86
never@739 319 #define X86_ONLY(code)
twisti@2047 320 #define NOT_X86(code) code
never@739 321 #endif
never@739 322
duke@435 323 #ifdef IA32
duke@435 324 #define IA32_ONLY(code) code
duke@435 325 #define NOT_IA32(code)
duke@435 326 #else
duke@435 327 #define IA32_ONLY(code)
duke@435 328 #define NOT_IA32(code) code
duke@435 329 #endif
duke@435 330
goetz@6453 331 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64.
goetz@6453 332 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included
goetz@6453 333 // by 'pthread.h' and other common system headers.
goetz@6453 334
goetz@6453 335 #if defined(IA64) && !defined(AIX)
duke@435 336 #define IA64_ONLY(code) code
duke@435 337 #define NOT_IA64(code)
duke@435 338 #else
duke@435 339 #define IA64_ONLY(code)
duke@435 340 #define NOT_IA64(code) code
duke@435 341 #endif
duke@435 342
duke@435 343 #ifdef AMD64
duke@435 344 #define AMD64_ONLY(code) code
duke@435 345 #define NOT_AMD64(code)
duke@435 346 #else
duke@435 347 #define AMD64_ONLY(code)
duke@435 348 #define NOT_AMD64(code) code
duke@435 349 #endif
duke@435 350
duke@435 351 #ifdef SPARC
duke@435 352 #define SPARC_ONLY(code) code
duke@435 353 #define NOT_SPARC(code)
duke@435 354 #else
duke@435 355 #define SPARC_ONLY(code)
duke@435 356 #define NOT_SPARC(code) code
duke@435 357 #endif
duke@435 358
goetz@6440 359 #if defined(PPC32) || defined(PPC64)
goetz@6440 360 #ifndef PPC
goetz@6440 361 #define PPC
goetz@6440 362 #endif
bobv@2036 363 #define PPC_ONLY(code) code
bobv@2036 364 #define NOT_PPC(code)
bobv@2036 365 #else
goetz@6440 366 #undef PPC
bobv@2036 367 #define PPC_ONLY(code)
bobv@2036 368 #define NOT_PPC(code) code
bobv@2036 369 #endif
bobv@2036 370
goetz@6440 371 #ifdef PPC32
goetz@6440 372 #define PPC32_ONLY(code) code
goetz@6440 373 #define NOT_PPC32(code)
goetz@6440 374 #else
goetz@6440 375 #define PPC32_ONLY(code)
goetz@6440 376 #define NOT_PPC32(code) code
goetz@6440 377 #endif
goetz@6440 378
goetz@6440 379 #ifdef PPC64
goetz@6440 380 #define PPC64_ONLY(code) code
goetz@6440 381 #define NOT_PPC64(code)
goetz@6440 382 #else
goetz@6440 383 #define PPC64_ONLY(code)
goetz@6440 384 #define NOT_PPC64(code) code
goetz@6440 385 #endif
goetz@6440 386
bobv@2036 387 #ifdef E500V2
bobv@2036 388 #define E500V2_ONLY(code) code
bobv@2036 389 #define NOT_E500V2(code)
bobv@2036 390 #else
bobv@2036 391 #define E500V2_ONLY(code)
bobv@2036 392 #define NOT_E500V2(code) code
bobv@2036 393 #endif
bobv@2036 394
bobv@2036 395
bobv@2036 396 #ifdef ARM
bobv@2036 397 #define ARM_ONLY(code) code
bobv@2036 398 #define NOT_ARM(code)
bobv@2036 399 #else
bobv@2036 400 #define ARM_ONLY(code)
bobv@2036 401 #define NOT_ARM(code) code
bobv@2036 402 #endif
bobv@2036 403
bobv@2036 404 #ifdef JAVASE_EMBEDDED
bobv@2036 405 #define EMBEDDED_ONLY(code) code
bobv@2036 406 #define NOT_EMBEDDED(code)
bobv@2036 407 #else
bobv@2036 408 #define EMBEDDED_ONLY(code)
bobv@2036 409 #define NOT_EMBEDDED(code) code
bobv@2036 410 #endif
bobv@2036 411
duke@435 412 #define define_pd_global(type, name, value) const type pd_##name = value;
stefank@2314 413
stefank@2314 414 #endif // SHARE_VM_UTILITIES_MACROS_HPP

mercurial