Mercurial > hg > graal-compiler
comparison src/share/vm/utilities/globalDefinitions.hpp @ 17937:78bbf4d43a14
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
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | 7384f6a12fc1 |
children | 52b4284cb496 b6a8cc1e0d92 |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
39 # include "utilities/globalDefinitions_sparcWorks.hpp" | 39 # include "utilities/globalDefinitions_sparcWorks.hpp" |
40 #endif | 40 #endif |
41 #ifdef TARGET_COMPILER_xlc | 41 #ifdef TARGET_COMPILER_xlc |
42 # include "utilities/globalDefinitions_xlc.hpp" | 42 # include "utilities/globalDefinitions_xlc.hpp" |
43 #endif | 43 #endif |
44 | |
45 #ifndef PRAGMA_DIAG_PUSH | |
46 #define PRAGMA_DIAG_PUSH | |
47 #endif | |
48 #ifndef PRAGMA_DIAG_POP | |
49 #define PRAGMA_DIAG_POP | |
50 #endif | |
51 #ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED | |
52 #define PRAGMA_FORMAT_NONLITERAL_IGNORED | |
53 #endif | |
54 #ifndef PRAGMA_FORMAT_IGNORED | |
55 #define PRAGMA_FORMAT_IGNORED | |
56 #endif | |
57 #ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL | |
58 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL | |
59 #endif | |
60 #ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL | |
61 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL | |
62 #endif | |
63 #ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC | |
64 #define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC | |
65 #endif | |
66 #ifndef ATTRIBUTE_PRINTF | |
67 #define ATTRIBUTE_PRINTF(fmt, vargs) | |
68 #endif | |
69 | |
44 | 70 |
45 #include "utilities/macros.hpp" | 71 #include "utilities/macros.hpp" |
46 | 72 |
47 // This file holds all globally used constants & types, class (forward) | 73 // This file holds all globally used constants & types, class (forward) |
48 // declarations and a few frequently used utility functions. | 74 // declarations and a few frequently used utility functions. |
1282 | 1308 |
1283 inline int build_int_from_shorts( jushort low, jushort high ) { | 1309 inline int build_int_from_shorts( jushort low, jushort high ) { |
1284 return ((int)((unsigned int)high << 16) | (unsigned int)low); | 1310 return ((int)((unsigned int)high << 16) | (unsigned int)low); |
1285 } | 1311 } |
1286 | 1312 |
1313 // Convert pointer to intptr_t, for use in printing pointers. | |
1314 inline intptr_t p2i(const void * p) { | |
1315 return (intptr_t) p; | |
1316 } | |
1317 | |
1287 // Printf-style formatters for fixed- and variable-width types as pointers and | 1318 // Printf-style formatters for fixed- and variable-width types as pointers and |
1288 // integers. These are derived from the definitions in inttypes.h. If the platform | 1319 // integers. These are derived from the definitions in inttypes.h. If the platform |
1289 // doesn't provide appropriate definitions, they should be provided in | 1320 // doesn't provide appropriate definitions, they should be provided in |
1290 // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) | 1321 // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp) |
1291 | 1322 |
1300 #define PTR32_FORMAT "0x%08" PRIx32 | 1331 #define PTR32_FORMAT "0x%08" PRIx32 |
1301 | 1332 |
1302 // Format 64-bit quantities. | 1333 // Format 64-bit quantities. |
1303 #define INT64_FORMAT "%" PRId64 | 1334 #define INT64_FORMAT "%" PRId64 |
1304 #define UINT64_FORMAT "%" PRIu64 | 1335 #define UINT64_FORMAT "%" PRIu64 |
1336 #define UINT64_FORMAT_X "%" PRIx64 | |
1305 #define INT64_FORMAT_W(width) "%" #width PRId64 | 1337 #define INT64_FORMAT_W(width) "%" #width PRId64 |
1306 #define UINT64_FORMAT_W(width) "%" #width PRIu64 | 1338 #define UINT64_FORMAT_W(width) "%" #width PRIu64 |
1307 | 1339 |
1308 #define PTR64_FORMAT "0x%016" PRIx64 | 1340 #define PTR64_FORMAT "0x%016" PRIx64 |
1309 | 1341 |
1322 #else // !_LP64 | 1354 #else // !_LP64 |
1323 #define INTPTR_FORMAT "0x%08" PRIxPTR | 1355 #define INTPTR_FORMAT "0x%08" PRIxPTR |
1324 #define PTR_FORMAT "0x%08" PRIxPTR | 1356 #define PTR_FORMAT "0x%08" PRIxPTR |
1325 #endif // _LP64 | 1357 #endif // _LP64 |
1326 | 1358 |
1327 #define SSIZE_FORMAT "%" PRIdPTR | 1359 #define INTPTR_FORMAT_W(width) "%" #width PRIxPTR |
1328 #define SIZE_FORMAT "%" PRIuPTR | 1360 |
1329 #define SSIZE_FORMAT_W(width) "%" #width PRIdPTR | 1361 #define SSIZE_FORMAT "%" PRIdPTR |
1330 #define SIZE_FORMAT_W(width) "%" #width PRIuPTR | 1362 #define SIZE_FORMAT "%" PRIuPTR |
1363 #define SIZE_FORMAT_HEX "0x%" PRIxPTR | |
1364 #define SSIZE_FORMAT_W(width) "%" #width PRIdPTR | |
1365 #define SIZE_FORMAT_W(width) "%" #width PRIuPTR | |
1366 #define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR | |
1331 | 1367 |
1332 #define INTX_FORMAT "%" PRIdPTR | 1368 #define INTX_FORMAT "%" PRIdPTR |
1333 #define UINTX_FORMAT "%" PRIuPTR | 1369 #define UINTX_FORMAT "%" PRIuPTR |
1334 #define INTX_FORMAT_W(width) "%" #width PRIdPTR | 1370 #define INTX_FORMAT_W(width) "%" #width PRIdPTR |
1335 #define UINTX_FORMAT_W(width) "%" #width PRIuPTR | 1371 #define UINTX_FORMAT_W(width) "%" #width PRIuPTR |
1351 // specific. | 1387 // specific. |
1352 static inline void* dereference_vptr(const void* addr) { | 1388 static inline void* dereference_vptr(const void* addr) { |
1353 return *(void**)addr; | 1389 return *(void**)addr; |
1354 } | 1390 } |
1355 | 1391 |
1356 | |
1357 #ifndef PRODUCT | 1392 #ifndef PRODUCT |
1358 | 1393 |
1359 // For unit testing only | 1394 // For unit testing only |
1360 class GlobalDefinitions { | 1395 class GlobalDefinitions { |
1361 public: | 1396 public: |