comparison src/share/vm/runtime/globals.cpp @ 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 b257acb35d3e
children 52b4284cb496 009de2b033fc
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.
43 #endif 43 #endif
44 #ifdef SHARK 44 #ifdef SHARK
45 #include "shark/shark_globals.hpp" 45 #include "shark/shark_globals.hpp"
46 #endif 46 #endif
47 47
48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
49
48 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ 50 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \
49 MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ 51 MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \
50 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ 52 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \
51 MATERIALIZE_NOTPRODUCT_FLAG, \ 53 MATERIALIZE_NOTPRODUCT_FLAG, \
52 MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \ 54 MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \
281 283
282 284
283 // Length of format string (e.g. "%.1234s") for printing ccstr below 285 // Length of format string (e.g. "%.1234s") for printing ccstr below
284 #define FORMAT_BUFFER_LEN 16 286 #define FORMAT_BUFFER_LEN 16
285 287
288 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
286 void Flag::print_on(outputStream* st, bool withComments) { 289 void Flag::print_on(outputStream* st, bool withComments) {
287 // Don't print notproduct and develop flags in a product build. 290 // Don't print notproduct and develop flags in a product build.
288 if (is_constant_in_binary()) { 291 if (is_constant_in_binary()) {
289 return; 292 return;
290 } 293 }
313 while ((eol = strchr(cp, '\n')) != NULL) { 316 while ((eol = strchr(cp, '\n')) != NULL) {
314 char format_buffer[FORMAT_BUFFER_LEN]; 317 char format_buffer[FORMAT_BUFFER_LEN];
315 size_t llen = pointer_delta(eol, cp, sizeof(char)); 318 size_t llen = pointer_delta(eol, cp, sizeof(char));
316 jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, 319 jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
317 "%%." SIZE_FORMAT "s", llen); 320 "%%." SIZE_FORMAT "s", llen);
321 PRAGMA_DIAG_PUSH
322 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
318 st->print(format_buffer, cp); 323 st->print(format_buffer, cp);
324 PRAGMA_DIAG_POP
319 st->cr(); 325 st->cr();
320 cp = eol+1; 326 cp = eol+1;
321 st->print("%5s %-35s += ", "", _name); 327 st->print("%5s %-35s += ", "", _name);
322 } 328 }
323 st->print("%-16s", cp); 329 st->print("%-16s", cp);
370 if (is_first) { 376 if (is_first) {
371 is_first = false; 377 is_first = false;
372 } else { 378 } else {
373 st->print(" "); 379 st->print(" ");
374 } 380 }
375 st->print(d.name); 381 st->print("%s", d.name);
376 } 382 }
377 } 383 }
378 384
379 st->print("}"); 385 st->print("}");
380 } 386 }