# HG changeset patch # User drchase # Date 1399668654 14400 # Node ID 2658d7834c6ed97061131f0b050e3c4c68bae0a5 # Parent 8528b67f65626d138556bc8380b54a1beb6cca0a 8037816: Fix for 8036122 breaks build with Xcode5/clang Summary: Repaired or selectively disabled offending formats; future-proofed with additional checking Reviewed-by: kvn, jrose, stefank diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -149,7 +149,7 @@ } void VM_Version::print_features() { - tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), get_cache_line_size()); + tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), (int) get_cache_line_size()); } #ifdef COMPILER2 diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Fri May 09 16:50:54 2014 -0400 @@ -318,22 +318,22 @@ tty->print("BIS"); } if (AllocatePrefetchLines > 1) { - tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize); } else { - tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize); } } if (PrefetchCopyIntervalInBytes > 0) { - tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes); + tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes); } if (PrefetchScanIntervalInBytes > 0) { - tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes); + tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes); } if (PrefetchFieldsAhead > 0) { - tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead); + tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead); } if (ContendedPaddingWidth > 0) { - tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth); + tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth); } } #endif // PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/assembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -522,11 +522,11 @@ // these asserts are somewhat nonsensical #ifndef _LP64 assert(which == imm_operand || which == disp32_operand, - err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip)); + err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip))); #else assert((which == call32_operand || which == imm_operand) && is_64bit || which == narrow_oop_operand && !is_64bit, - err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip)); + err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip))); #endif // _LP64 return ip; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ #ifndef PRODUCT if (TraceFPURegisterUsage) { - tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->print_cr(""); + tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->cr(); } #endif } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/compiledIC_x86.cpp --- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,7 +122,7 @@ if (TraceICs) { ResourceMark rm; tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", - instruction_address(), + p2i(instruction_address()), callee->name_and_sig_as_C_string()); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/frame_x86.cpp --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,7 @@ } #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Profiling/safepoint support diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,7 @@ #define __ _masm-> +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #ifdef _WIN64 address AbstractInterpreterGenerator::generate_slow_signature_handler() { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,6 +55,7 @@ #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #ifdef ASSERT bool AbstractAssembler::pd_check_instruction_mark() { return true; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/methodHandles_x86.cpp --- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ #include "memory/allocation.inline.hpp" #include "prims/methodHandles.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define __ _masm-> #ifdef PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/nativeInst_x86.cpp --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include "c1/c1_Runtime1.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void NativeInstruction::wrote(int offset) { ICache::invalidate_word(addr_at(offset)); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/vm_version_x86.cpp --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -925,16 +925,16 @@ if (PrintMiscellaneous && Verbose) { tty->print_cr("Logical CPUs per core: %u", logical_processors_per_package()); - tty->print("UseSSE=%d",UseSSE); + tty->print("UseSSE=%d", (int) UseSSE); if (UseAVX > 0) { - tty->print(" UseAVX=%d",UseAVX); + tty->print(" UseAVX=%d", (int) UseAVX); } if (UseAES) { tty->print(" UseAES=1"); } #ifdef COMPILER2 if (MaxVectorSize > 0) { - tty->print(" MaxVectorSize=%d", MaxVectorSize); + tty->print(" MaxVectorSize=%d", (int) MaxVectorSize); } #endif tty->cr(); @@ -957,23 +957,23 @@ } } if (AllocatePrefetchLines > 1) { - tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize); } else { - tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize); } } if (PrefetchCopyIntervalInBytes > 0) { - tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes); + tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes); } if (PrefetchScanIntervalInBytes > 0) { - tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes); + tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes); } if (PrefetchFieldsAhead > 0) { - tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead); + tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead); } if (ContendedPaddingWidth > 0) { - tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth); + tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth); } } #endif // !PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -118,7 +118,7 @@ if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d", - vtable_index, s->entry_point(), + vtable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } @@ -199,7 +199,7 @@ if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", - itable_index, s->entry_point(), + itable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // machine-dependent part of VtableStubs: create VtableStub of correct size and // initialize its code diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os/bsd/vm/decoder_machO.cpp --- a/hotspot/src/os/bsd/vm/decoder_machO.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os/bsd/vm/decoder_machO.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ struct symtab_command * symt = (struct symtab_command *) mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB); if (symt == NULL) { - DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", mach_base)); + DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", p2i(mach_base))); return false; } uint32_t off = symt->symoff; /* symbol table offset (within this mach file) */ diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Fri May 09 16:50:54 2014 -0400 @@ -124,6 +124,9 @@ #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) #define LARGEPAGES_BIT (1 << 6) + +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + //////////////////////////////////////////////////////////////////////////////// // global variables julong os::Bsd::_physical_memory = 0; @@ -2394,7 +2397,6 @@ (!FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(LargePageSizeInBytes) ); - char msg[128]; // Create a large shared memory region to attach to based on size. // Currently, size is the total size of the heap @@ -2415,8 +2417,7 @@ // coalesce into large pages. Try to reserve large pages when // the system is still "fresh". if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning(msg); + warning("Failed to reserve shared memory (errno = %d).", errno); } return NULL; } @@ -2433,8 +2434,7 @@ if ((intptr_t)addr == -1) { if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning(msg); + warning("Failed to attach shared memory (errno = %d).", err); } return NULL; } @@ -3810,6 +3810,7 @@ return true; } +ATTRIBUTE_PRINTF(3, 0) int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { return ::vsnprintf(buf, count, format, args); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os/bsd/vm/perfMemory_bsd.cpp --- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -925,7 +925,7 @@ if (PerfTraceMemOps) { tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at " - INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress); + INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress)); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Fri May 09 16:50:54 2014 -0400 @@ -102,6 +102,8 @@ # include # include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling // getrusage() is prepared to handle the associated failure. #ifndef RUSAGE_THREAD @@ -2138,7 +2140,7 @@ // Print warning if unsafe chroot environment detected if (unsafe_chroot_detected) { st->print("WARNING!! "); - st->print_cr(unstable_chroot_error); + st->print_cr("%s", unstable_chroot_error); } os::Linux::print_libversion_info(st); @@ -2199,8 +2201,8 @@ void os::Linux::print_libversion_info(outputStream* st) { // libc, pthread st->print("libc:"); - st->print(os::Linux::glibc_version()); st->print(" "); - st->print(os::Linux::libpthread_version()); st->print(" "); + st->print("%s ", os::Linux::glibc_version()); + st->print("%s ", os::Linux::libpthread_version()); if (os::Linux::is_LinuxThreads()) { st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); } @@ -3417,7 +3419,7 @@ // the system is still "fresh". if (warn_on_failure) { jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning(msg); + warning("%s", msg); } return NULL; } @@ -3435,7 +3437,7 @@ if ((intptr_t)addr == -1) { if (warn_on_failure) { jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning(msg); + warning("%s", msg); } return NULL; } @@ -3455,7 +3457,7 @@ char msg[128]; jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: " PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error); - warning(msg); + warning("%s", msg); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os/linux/vm/perfMemory_linux.cpp --- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp Fri May 09 16:50:54 2014 -0400 @@ -931,7 +931,7 @@ if (PerfTraceMemOps) { tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at " - INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress); + INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress)); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os/posix/vm/os_posix.cpp --- a/hotspot/src/os/posix/vm/os_posix.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os/posix/vm/os_posix.cpp Fri May 09 16:50:54 2014 -0400 @@ -36,6 +36,8 @@ #include #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Todo: provide a os::get_max_process_id() or similar. Number of processes // may have been configured, can be read more accurately from proc fs etc. #ifndef MAX_PID @@ -192,10 +194,10 @@ st->print("uname:"); struct utsname name; uname(&name); - st->print(name.sysname); st->print(" "); - st->print(name.release); st->print(" "); - st->print(name.version); st->print(" "); - st->print(name.machine); + st->print("%s ", name.sysname); + st->print("%s ", name.release); + st->print("%s ", name.version); + st->print("%s", name.machine); st->cr(); } @@ -682,7 +684,7 @@ void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) { char buf[NUM_IMPORTANT_SIGS + 1]; os::Posix::describe_signal_set_short(set, buf, sizeof(buf)); - st->print(buf); + st->print("%s", buf); } // Writes one-line description of a combination of sigaction.sa_flags into a user @@ -742,7 +744,7 @@ void os::Posix::print_sa_flags(outputStream* st, int flags) { char buffer[0x100]; os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer)); - st->print(buffer); + st->print("%s", buffer); } // Helper function for os::Posix::print_siginfo_...(): diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -276,6 +276,8 @@ # endif #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + address os::current_stack_pointer() { #if defined(__clang__) || defined(__llvm__) register void *esp; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,6 +89,8 @@ #define SPELL_REG_FP "ebp" #endif // AMD64 +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + address os::current_stack_pointer() { #ifdef SPARC_WORKS register void *esp; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/adlc/formssel.cpp --- a/hotspot/src/share/vm/adlc/formssel.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/adlc/formssel.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1322,7 +1322,7 @@ OperandForm* oper = form->is_operand(); if (oper != NULL && oper->is_bound_register()) { const RegDef* first = oper->get_RegClass()->find_first_elem(); - fprintf(fp, " st->print(\"%s\");\n", first->_regname); + fprintf(fp, " st->print_raw(\"%s\");\n", first->_regname); } else { globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var); } @@ -2530,7 +2530,7 @@ case Form::idealP: fprintf(fp," if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break; case Form::idealNKlass: case Form::idealN: fprintf(fp," if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break; - case Form::idealL: fprintf(fp," st->print(\"#%%lld\", _c%d);\n", const_index); break; + case Form::idealL: fprintf(fp," st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break; case Form::idealF: fprintf(fp," st->print(\"#%%f\", _c%d);\n", const_index); break; case Form::idealD: fprintf(fp," st->print(\"#%%f\", _c%d);\n", const_index); break; default: diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/adlc/output_h.cpp --- a/hotspot/src/share/vm/adlc/output_h.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/adlc/output_h.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -386,14 +386,14 @@ static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) { assert(oper != NULL, "what"); CondInterface* cond = oper->_interface->is_CondInterface(); - fprintf(fp, " if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format); - fprintf(fp, " else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format); - fprintf(fp, " else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format); - fprintf(fp, " else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format); + fprintf(fp, " if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::le ) st->print_raw(\"%s\");\n",i,cond->_less_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::ge ) st->print_raw(\"%s\");\n",i,cond->_greater_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::lt ) st->print_raw(\"%s\");\n",i,cond->_less_format); + fprintf(fp, " else if( _c%d == BoolTest::gt ) st->print_raw(\"%s\");\n",i,cond->_greater_format); + fprintf(fp, " else if( _c%d == BoolTest::overflow ) st->print_raw(\"%s\");\n",i,cond->_overflow_format); + fprintf(fp, " else if( _c%d == BoolTest::no_overflow ) st->print_raw(\"%s\");\n",i,cond->_no_overflow_format); } // Output code that dumps constant values, increment "i" if type is constant @@ -416,8 +416,8 @@ ++i; } else if (!strcmp(ideal_type, "ConL")) { - fprintf(fp," st->print(\"#\" INT64_FORMAT, _c%d);\n", i); - fprintf(fp," st->print(\"/\" PTR64_FORMAT, _c%d);\n", i); + fprintf(fp," st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", i); + fprintf(fp," st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%d);\n", i); ++i; } else if (!strcmp(ideal_type, "ConF")) { @@ -429,7 +429,7 @@ else if (!strcmp(ideal_type, "ConD")) { fprintf(fp," st->print(\"#%%f\", _c%d);\n", i); fprintf(fp," jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i); - fprintf(fp," st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i); + fprintf(fp," st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%dl);\n", i); ++i; } else if (!strcmp(ideal_type, "Bool")) { @@ -471,7 +471,7 @@ if ( string != NameList::_signal ) { // Normal string // Pass through to st->print - fprintf(fp," st->print(\"%s\");\n", string); + fprintf(fp," st->print_raw(\"%s\");\n", string); } else { // Replacement variable const char *rep_var = oper._format->_rep_vars.iter(); @@ -542,7 +542,7 @@ if ( string != NameList::_signal ) { // Normal string // Pass through to st->print - fprintf(fp," st->print(\"%s\");\n", string); + fprintf(fp," st->print_raw(\"%s\");\n", string); } else { // Replacement variable const char *rep_var = oper._format->_rep_vars.iter(); @@ -669,7 +669,7 @@ } else if( string == NameList::_signal2 ) // Raw program text fputs(inst._format->_strings.iter(), fp); else - fprintf(fp,"st->print(\"%s\");\n", string); + fprintf(fp,"st->print_raw(\"%s\");\n", string); } // Done with all format strings } // Done generating the user-defined portion of the format @@ -696,13 +696,13 @@ default: assert(0,"ShouldNotReachHere"); } - fprintf(fp, " st->print_cr(\"\");\n" ); + fprintf(fp, " st->cr();\n" ); fprintf(fp, " if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\" No JVM State Info\");\n" ); fprintf(fp, " st->print(\" # \");\n" ); fprintf(fp, " if( _jvms && _oop_map ) _oop_map->print_on(st);\n"); } else if(inst.is_ideal_safepoint()) { - fprintf(fp, " st->print(\"\");\n" ); + fprintf(fp, " st->print_raw(\"\");\n" ); fprintf(fp, " if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\" No JVM State Info\");\n" ); fprintf(fp, " st->print(\" # \");\n" ); fprintf(fp, " if( _jvms && _oop_map ) _oop_map->print_on(st);\n"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/asm/codeBuffer.cpp --- a/hotspot/src/share/vm/asm/codeBuffer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -988,7 +988,7 @@ for (csize_t step; ptr < end(); ptr += step) { step = end() - ptr; if (step > jintSize * 4) step = jintSize * 4; - tty->print(PTR_FORMAT ": ", ptr); + tty->print(INTPTR_FORMAT ": ", p2i(ptr)); while (step > 0) { tty->print(" " PTR32_FORMAT, *(jint*)ptr); ptr += jintSize; @@ -1098,7 +1098,7 @@ while (c && c->offset() == offset) { stream->bol(); stream->print(" ;; "); - stream->print_cr(c->string()); + stream->print_cr("%s", c->string()); c = c->next_comment(); } } @@ -1154,10 +1154,10 @@ void CodeSection::print(const char* name) { csize_t locs_size = locs_end() - locs_start(); tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)%s", - name, start(), end(), limit(), size(), capacity(), + name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity(), is_frozen()? " [frozen]": ""); tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d", - name, locs_start(), locs_end(), locs_limit(), locs_size, locs_capacity(), locs_point_off()); + name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off()); if (PrintRelocations) { RelocIterator iter(this); iter.print(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/asm/codeBuffer.hpp --- a/hotspot/src/share/vm/asm/codeBuffer.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/asm/codeBuffer.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -173,7 +173,7 @@ bool allocates(address pc) const { return pc >= _start && pc < _limit; } bool allocates2(address pc) const { return pc >= _start && pc <= _limit; } - void set_end(address pc) { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, _start, pc, _limit)); _end = pc; } + void set_end(address pc) { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit))); _end = pc; } void set_mark(address pc) { assert(contains2(pc), "not in codeBuffer"); _mark = pc; } void set_mark_off(int offset) { assert(contains2(offset+_start),"not in codeBuffer"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/asm/register.hpp --- a/hotspot/src/share/vm/asm/register.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/asm/register.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -118,8 +118,8 @@ ) { assert( a != b, - err_msg_res("registers must be different: a=%d, b=%d", - a, b) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "", + p2i(a), p2i(b)) ); } @@ -132,8 +132,9 @@ assert( a != b && a != c && b != c, - err_msg_res("registers must be different: a=%d, b=%d, c=%d", - a, b, c) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c)) ); } @@ -148,8 +149,9 @@ a != b && a != c && a != d && b != c && b != d && c != d, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d", - a, b, c, d) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d)) ); } @@ -166,8 +168,9 @@ && b != c && b != d && b != e && c != d && c != e && d != e, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d", - a, b, c, d, e) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e)) ); } @@ -186,8 +189,10 @@ && c != d && c != e && c != f && d != e && d != f && e != f, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d", - a, b, c, d, e, f) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f)) ); } @@ -208,8 +213,10 @@ && d != e && d != f && d != g && e != f && e != g && f != g, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d", - a, b, c, d, e, f, g) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g)) ); } @@ -232,8 +239,10 @@ && e != f && e != g && e != h && f != g && f != h && g != h, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d", - a, b, c, d, e, f, g, h) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h)) ); } @@ -258,8 +267,11 @@ && f != g && f != h && f != i && g != h && g != i && h != i, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d", - a, b, c, d, e, f, g, h, i) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT + ", i=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i)) ); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/c1/c1_CFGPrinter.cpp --- a/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ void inc_indent(); void dec_indent(); - void print(const char* format, ...); + void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void print_begin(const char* tag); void print_end(const char* tag); @@ -161,7 +161,7 @@ print("name \"%s\"", method_name(_compilation->method(), true)); print("method \"%s\"", method_name(_compilation->method())); - print("date "INT64_FORMAT, os::javaTimeMillis()); + print("date "INT64_FORMAT, (int64_t) os::javaTimeMillis()); print_end("compilation"); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp --- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -134,23 +134,23 @@ if (value->is_null_object()) { output()->print("null"); } else if (!value->is_loaded()) { - output()->print("", value); + output()->print("", p2i(value)); } else { - output()->print(""); } } else if (type->as_InstanceConstant() != NULL) { ciInstance* value = type->as_InstanceConstant()->value(); if (value->is_loaded()) { - output()->print(""); } else { - output()->print("", value); + output()->print("", p2i(value)); } } else if (type->as_ArrayConstant() != NULL) { - output()->print("", type->as_ArrayConstant()->value()->constant_encoding()); + output()->print("", p2i(type->as_ArrayConstant()->value()->constant_encoding())); } else if (type->as_ClassConstant() != NULL) { ciInstanceKlass* klass = type->as_ClassConstant()->value(); if (!klass->is_loaded()) { @@ -268,7 +268,7 @@ void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) { - output()->print(name); + output()->print("%s", name); output()->print(".("); } @@ -479,7 +479,7 @@ if (x->declared_type()->is_klass()) print_klass(x->declared_type()->as_klass()); else - output()->print(type2name(x->declared_type()->basic_type())); + output()->print("%s", type2name(x->declared_type()->basic_type())); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/c1/c1_LIR.cpp --- a/hotspot/src/share/vm/c1/c1_LIR.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1563,15 +1563,15 @@ } else if (is_virtual()) { out->print("R%d", vreg_number()); } else if (is_single_cpu()) { - out->print(as_register()->name()); + out->print("%s", as_register()->name()); } else if (is_double_cpu()) { - out->print(as_register_hi()->name()); - out->print(as_register_lo()->name()); + out->print("%s", as_register_hi()->name()); + out->print("%s", as_register_lo()->name()); #if defined(X86) } else if (is_single_xmm()) { - out->print(as_xmm_float_reg()->name()); + out->print("%s", as_xmm_float_reg()->name()); } else if (is_double_xmm()) { - out->print(as_xmm_double_reg()->name()); + out->print("%s", as_xmm_double_reg()->name()); } else if (is_single_fpu()) { out->print("fpu%d", fpu_regnr()); } else if (is_double_fpu()) { @@ -1583,9 +1583,9 @@ out->print("d%d", fpu_regnrLo() >> 1); #else } else if (is_single_fpu()) { - out->print(as_float_reg()->name()); + out->print("%s", as_float_reg()->name()); } else if (is_double_fpu()) { - out->print(as_double_reg()->name()); + out->print("%s", as_double_reg()->name()); #endif } else if (is_illegal()) { @@ -1611,9 +1611,9 @@ case T_LONG: out->print("lng:" JLONG_FORMAT, as_jlong()); break; case T_FLOAT: out->print("flt:%f", as_jfloat()); break; case T_DOUBLE: out->print("dbl:%f", as_jdouble()); break; - case T_OBJECT: out->print("obj:0x%x", as_jobject()); break; - case T_METADATA: out->print("metadata:0x%x", as_metadata());break; - default: out->print("%3d:0x%x",type(), as_jdouble()); break; + case T_OBJECT: out->print("obj:" INTPTR_FORMAT, p2i(as_jobject())); break; + case T_METADATA: out->print("metadata:" INTPTR_FORMAT, p2i(as_metadata()));break; + default: out->print("%3d:0x" UINT64_FORMAT_X, type(), (uint64_t)as_jlong()); break; } } @@ -1629,7 +1629,7 @@ case times_8: out->print(" * 8"); break; } } - out->print(" Disp: %d", _disp); + out->print(" Disp: " INTX_FORMAT, _disp); } // debug output of block header without InstructionPrinter @@ -1703,7 +1703,7 @@ } else { out->print(" "); } - out->print(name()); out->print(" "); + out->print("%s ", name()); print_instr(out); if (info() != NULL) out->print(" [bci:%d]", info()->stack()->bci()); #ifdef ASSERT @@ -1833,7 +1833,7 @@ // LIR_OpJavaCall void LIR_OpJavaCall::print_instr(outputStream* out) const { out->print("call: "); - out->print("[addr: 0x%x]", address()); + out->print("[addr: " INTPTR_FORMAT "]", p2i(address())); if (receiver()->is_valid()) { out->print(" [recv: "); receiver()->print(out); out->print("]"); } @@ -1844,7 +1844,7 @@ // LIR_OpLabel void LIR_OpLabel::print_instr(outputStream* out) const { - out->print("[label:0x%x]", _label); + out->print("[label:" INTPTR_FORMAT "]", p2i(_label)); } // LIR_OpArrayCopy @@ -1911,7 +1911,7 @@ // LIR_Op1 void LIR_OpRTCall::print_instr(outputStream* out) const { intx a = (intx)addr(); - out->print(Runtime1::name_for_address(addr())); + out->print("%s", Runtime1::name_for_address(addr())); out->print(" "); tmp()->print(out); } @@ -1934,10 +1934,10 @@ } else if (stub() != NULL) { out->print("["); stub()->print_name(out); - out->print(": 0x%x]", stub()); + out->print(": " INTPTR_FORMAT "]", p2i(stub())); if (stub()->info() != NULL) out->print(" [bci:%d]", stub()->info()->stack()->bci()); } else { - out->print("[label:0x%x] ", label()); + out->print("[label:" INTPTR_FORMAT "] ", p2i(label())); } if (ublock() != NULL) { out->print("unordered: [B%d] ", ublock()->block_id()); @@ -2004,7 +2004,7 @@ tmp4()->print(out); out->print(" "); out->print("[hdr:%d]", header_size()); out->print(" "); out->print("[obj:%d]", object_size()); out->print(" "); - out->print("[lbl:0x%x]", stub()->entry()); + out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry())); } void LIR_OpRoundFP::print_instr(outputStream* out) const { @@ -2037,7 +2037,7 @@ tmp3()->print(out); out->print(" "); tmp4()->print(out); out->print(" "); out->print("[type:0x%x]", type()); out->print(" "); - out->print("[label:0x%x]", stub()->entry()); + out->print("[label:" INTPTR_FORMAT "]", p2i(stub()->entry())); } @@ -2074,7 +2074,7 @@ if (_scratch->is_valid()) { _scratch->print(out); out->print(" "); } - out->print("[lbl:0x%x]", stub()->entry()); + out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry())); } #ifdef ASSERT @@ -2082,7 +2082,7 @@ print_condition(out, condition()); out->print(" "); in_opr1()->print(out); out->print(" "); in_opr2()->print(out); out->print(", \""); - out->print(msg()); out->print("\""); + out->print("%s", msg()); out->print("\""); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp --- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,10 +62,10 @@ _optimistic = ir->compilation()->is_optimistic(); TRACE_RANGE_CHECK_ELIMINATION( - tty->print_cr(""); + tty->cr(); tty->print_cr("Range check elimination"); ir->method()->print_name(tty); - tty->print_cr(""); + tty->cr(); ); TRACE_RANGE_CHECK_ELIMINATION( @@ -1024,7 +1024,7 @@ tty->print("i%d", phi->id()); tty->print(": "); bound->print(); - tty->print_cr(""); + tty->cr(); ); } }); @@ -1039,7 +1039,7 @@ tty->print("i%d", instr->id()); tty->print(": "); bound->print(); - tty->print_cr(""); + tty->cr(); ); } } @@ -1400,7 +1400,7 @@ // print void RangeCheckEliminator::Bound::print() { - tty->print(""); + tty->print("%s", ""); if (this->_lower_instr || this->_lower != min_jint) { if (this->_lower_instr) { tty->print("i%d", this->_lower_instr->id()); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/c1/c1_Runtime1.cpp --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -532,8 +532,8 @@ if (TraceExceptions) { ttyLocker ttyl; ResourceMark rm; - tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " for thread 0x%x", - exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, thread); + tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "", + exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); } // for AbortVMOnException flag NOT_PRODUCT(Exceptions::debug_check_abort(exception)); @@ -563,7 +563,7 @@ ttyLocker ttyl; ResourceMark rm; tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, - thread, continuation, pc); + p2i(thread), p2i(continuation), p2i(pc)); } return continuation; @@ -988,8 +988,8 @@ address copy_buff = stub_location - *byte_skip - *byte_count; address being_initialized_entry = stub_location - *being_initialized_entry_offset; if (TracePatching) { - tty->print_cr(" Patching %s at bci %d at address 0x%x (%s)", Bytecodes::name(code), bci, - instr_pc, (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); + tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, + p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); assert(caller_code != NULL, "nmethod not found"); @@ -1448,7 +1448,7 @@ methodHandle inlinee = methodHandle(vfst.method()); inlinee->print_short_name(&ss1); m->print_short_name(&ss2); - tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc %x", ss1.as_string(), vfst.bci(), ss2.as_string(), caller_frame.pc()); + tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc())); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/c1/c1_ValueType.hpp --- a/hotspot/src/share/vm/c1/c1_ValueType.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/c1/c1_ValueType.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,7 +175,7 @@ ValueType* join(ValueType* y) const; // debugging - void print(outputStream* s = tty) { s->print(name()); } + void print(outputStream* s = tty) { s->print("%s", name()); } }; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp --- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1287,10 +1287,10 @@ tty->print_cr("class of method is not initialized."); else if (_level > MaxBCEAEstimateLevel) tty->print_cr("level (%d) exceeds MaxBCEAEstimateLevel (%d).", - _level, MaxBCEAEstimateLevel); + _level, (int) MaxBCEAEstimateLevel); else if (method()->code_size() > MaxBCEAEstimateSize) - tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize.", - method()->code_size(), MaxBCEAEstimateSize); + tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize (%d).", + method()->code_size(), (int) MaxBCEAEstimateSize); else ShouldNotReachHere(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciConstant.cpp --- a/hotspot/src/share/vm/ci/ciConstant.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciConstant.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ tty->print("%d", _value._int); break; case T_LONG: - tty->print(INT64_FORMAT, _value._long); + tty->print(INT64_FORMAT, (int64_t)(_value._long)); break; case T_FLOAT: tty->print("%f", _value._float); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciEnv.cpp --- a/hotspot/src/share/vm/ci/ciEnv.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciEnv.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1250,8 +1250,7 @@ if (replay_data_file != NULL) { fileStream replay_data_stream(replay_data_file, /*need_close=*/true); dump_replay_data(&replay_data_stream); - tty->print("# Compiler replay data is saved as: "); - tty->print_cr(buffer); + tty->print_cr("# Compiler replay data is saved as: %s", buffer); } else { tty->print_cr("# Can't open file to dump replay data."); } @@ -1274,7 +1273,7 @@ ) replay_data_stream.flush(); tty->print("# Compiler inline data is saved as: "); - tty->print_cr(buffer); + tty->print_cr("%s", buffer); } else { tty->print_cr("# Can't open file to dump inline data."); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciInstanceKlass.cpp --- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -292,7 +292,7 @@ // Implementation of the print method. void ciInstanceKlass::print_impl(outputStream* st) { ciKlass::print_impl(st); - GUARDED_VM_ENTRY(st->print(" loader=0x%x", (address)loader());) + GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));) if (is_loaded()) { st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=", bool_to_str(is_initialized()), @@ -618,7 +618,7 @@ case T_SHORT: _out->print_cr("%d", mirror->short_field(fd->offset())); break; case T_CHAR: _out->print_cr("%d", mirror->char_field(fd->offset())); break; case T_INT: _out->print_cr("%d", mirror->int_field(fd->offset())); break; - case T_LONG: _out->print_cr(INT64_FORMAT, mirror->long_field(fd->offset())); break; + case T_LONG: _out->print_cr(INT64_FORMAT, (int64_t)(mirror->long_field(fd->offset()))); break; case T_FLOAT: { float f = mirror->float_field(fd->offset()); _out->print_cr("%d", *(int*)&f); @@ -626,7 +626,7 @@ } case T_DOUBLE: { double d = mirror->double_field(fd->offset()); - _out->print_cr(INT64_FORMAT, *(jlong*)&d); + _out->print_cr(INT64_FORMAT, *(int64_t*)&d); break; } case T_ARRAY: { @@ -656,7 +656,7 @@ _out->print_cr("\""); } else { const char* klass_name = value->klass()->name()->as_quoted_ascii(); - _out->print_cr(klass_name); + _out->print_cr("%s", klass_name); } } else { ShouldNotReachHere(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciMetadata.cpp --- a/hotspot/src/share/vm/ci/ciMetadata.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciMetadata.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ void ciMetadata::print(outputStream* st) { st->print("<%s", type_string()); GUARDED_VM_ENTRY(print_impl(st);) - st->print(" ident=%d address=0x%x>", ident(), (address)this); + st->print(" ident=%d address=" INTPTR_FORMAT ">", ident(), p2i((address)this)); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciMethodData.cpp --- a/hotspot/src/share/vm/ci/ciMethodData.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciMethodData.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -557,7 +557,7 @@ if (round == 0) { count++; } else { - out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii()); + out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); } } } @@ -569,7 +569,7 @@ if (round == 0) { count++; } else { - out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii()); + out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciObject.cpp --- a/hotspot/src/share/vm/ci/ciObject.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciObject.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -213,9 +213,9 @@ void ciObject::print(outputStream* st) { st->print("<%s", type_string()); GUARDED_VM_ENTRY(print_impl(st);) - st->print(" ident=%d %s address=0x%x>", ident(), + st->print(" ident=%d %s address=" INTPTR_FORMAT ">", ident(), is_scavengable() ? "SCAVENGABLE" : "", - (address)this); + p2i((address)this)); } // ------------------------------------------------------------------ diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciSignature.cpp --- a/hotspot/src/share/vm/ci/ciSignature.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciSignature.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -148,5 +148,5 @@ print_signature(); tty->print(" accessing_klass="); _accessing_klass->print(); - tty->print(" address=0x%x>", (address)this); + tty->print(" address=" INTPTR_FORMAT ">", p2i((address)this)); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/ci/ciType.cpp --- a/hotspot/src/share/vm/ci/ciType.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/ci/ciType.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ // Print the name of this type void ciType::print_name_on(outputStream* st) { ResourceMark rm; - st->print(name()); + st->print("%s", name()); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/classFileError.cpp --- a/hotspot/src/share/vm/classfile/classFileError.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/classFileError.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,9 @@ // Keep these in a separate file to prevent inlining +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED + void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) { ResourceMark rm(THREAD); Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(), @@ -53,6 +56,8 @@ msg, index, name, _class_name->as_C_string()); } +PRAGMA_DIAG_POP + void StackMapStream::stackmap_format_error(const char* msg, TRAPS) { ResourceMark rm(THREAD); Exceptions::fthrow( diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/classFileParser.hpp --- a/hotspot/src/share/vm/classfile/classFileParser.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -312,7 +312,9 @@ if (!b) { classfile_parse_error(msg, CHECK); } } - inline void assert_property(bool b, const char* msg, TRAPS) { +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED +inline void assert_property(bool b, const char* msg, TRAPS) { #ifdef ASSERT if (!b) { ResourceMark rm(THREAD); @@ -329,6 +331,7 @@ } #endif } +PRAGMA_DIAG_POP inline void check_property(bool property, const char* msg, int index, TRAPS) { if (_need_verify) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/classLoader.cpp --- a/hotspot/src/share/vm/classfile/classLoader.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/classLoader.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -343,7 +343,7 @@ tty->print("[Meta index for %s=", entry->name()); for (int i = 0; i < meta_packages.length(); i++) { if (i > 0) tty->print(" "); - tty->print(meta_packages.at(i)); + tty->print("%s", meta_packages.at(i)); } tty->print_cr("]"); } @@ -1299,7 +1299,7 @@ e = e->next(); } jlong end = os::javaTimeMillis(); - tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, %d ms)", + tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, " JLONG_FORMAT " ms)", _compile_the_world_class_counter, _compile_the_world_method_counter, (end - start)); { // Print statistics as if before normal exit: diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/classLoaderData.cpp --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Fri May 09 16:50:54 2014 -0400 @@ -281,10 +281,10 @@ ResourceMark rm; tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: " PTR_FORMAT " loader: " PTR_FORMAT " %s", - k, + p2i(k), k->external_name(), - k->class_loader_data(), - (void *)k->class_loader(), + p2i(k->class_loader_data()), + p2i((void *)k->class_loader()), loader_name()); } } @@ -319,11 +319,11 @@ if (TraceClassLoaderData) { ResourceMark rm; - tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this); - tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(), + tty->print("[ClassLoaderData: unload loader data " INTPTR_FORMAT, p2i(this)); + tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()), loader_name()); if (is_anonymous()) { - tty->print(" for anonymous class "PTR_FORMAT " ", _klasses); + tty->print(" for anonymous class " INTPTR_FORMAT " ", p2i(_klasses)); } tty->print_cr("]"); } @@ -485,14 +485,14 @@ void ClassLoaderData::dump(outputStream * const out) { ResourceMark rm; out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {", - this, (void *)class_loader(), - class_loader() != NULL ? class_loader()->klass() : NULL, loader_name()); + p2i(this), p2i((void *)class_loader()), + p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name()); if (claimed()) out->print(" claimed "); if (is_unloading()) out->print(" unloading "); - out->print(" handles " INTPTR_FORMAT, handles()); + out->print(" handles " INTPTR_FORMAT, p2i(handles())); out->cr(); if (metaspace_or_null() != NULL) { - out->print_cr("metaspace: " PTR_FORMAT, metaspace_or_null()); + out->print_cr("metaspace: " INTPTR_FORMAT, p2i(metaspace_or_null())); metaspace_or_null()->dump(out); } else { out->print_cr("metaspace: NULL"); @@ -586,8 +586,8 @@ if (TraceClassLoaderData) { ResourceMark rm; tty->print("[ClassLoaderData: "); - tty->print("create class loader data "PTR_FORMAT, cld); - tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(), + tty->print("create class loader data " INTPTR_FORMAT, p2i(cld)); + tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()), cld->loader_name()); tty->print_cr("]"); } @@ -847,7 +847,7 @@ if (class_loader() == NULL) { out->print("NULL class_loader"); } else { - out->print("class loader "PTR_FORMAT, this); + out->print("class loader " INTPTR_FORMAT, p2i(this)); class_loader()->print_value_on(out); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/defaultMethods.cpp --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp Fri May 09 16:50:54 2014 -0400 @@ -436,7 +436,7 @@ _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); if (TraceDefaultMethods) { _exception_message->print_value_on(tty); - tty->print_cr(""); + tty->cr(); } } } @@ -463,7 +463,7 @@ if (_members.at(i).second == DISQUALIFIED) { str->print(" (disqualified)"); } - str->print_cr(""); + str->cr(); } if (_selected_target != NULL) { @@ -480,7 +480,7 @@ if (!method_holder->is_interface()) { tty->print(" : in superclass"); } - str->print_cr(""); + str->cr(); } void print_exception(outputStream* str, int indent) { @@ -688,7 +688,7 @@ for (int i = 0; i < slots->length(); ++i) { tty->indent(); slots->at(i)->print_on(tty); - tty->print_cr(""); + tty->cr(); } } #endif // ndef PRODUCT @@ -828,7 +828,7 @@ streamIndentor si(tty, 2); tty->indent().print("Looking for default methods for slot "); slot->print_on(tty); - tty->print_cr(""); + tty->cr(); } #endif // ndef PRODUCT @@ -946,7 +946,7 @@ if (TraceDefaultMethods) { tty->print("for slot: "); slot->print_on(tty); - tty->print_cr(""); + tty->cr(); if (method->has_target()) { method->print_selected(tty, 1); } else if (method->throws_exception()) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/dictionary.cpp --- a/hotspot/src/share/vm/classfile/dictionary.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/dictionary.cpp Fri May 09 16:50:54 2014 -0400 @@ -31,6 +31,7 @@ #include "runtime/orderAccess.inline.hpp" #include "utilities/hashtable.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC DictionaryEntry* Dictionary::_current_class_entry = NULL; int Dictionary::_current_class_index = 0; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/dictionary.hpp --- a/hotspot/src/share/vm/classfile/dictionary.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/dictionary.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -379,7 +379,7 @@ } if (method_type() != NULL) { if (printed) st->print(" and "); - st->print(INTPTR_FORMAT, (void *)method_type()); + st->print(INTPTR_FORMAT, p2i((void *)method_type())); printed = true; } st->print_cr(printed ? "" : "(empty)"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/javaClasses.cpp --- a/hotspot/src/share/vm/classfile/javaClasses.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Fri May 09 16:50:54 2014 -0400 @@ -51,6 +51,8 @@ #include "runtime/vframe.hpp" #include "utilities/preserveException.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java) \ klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum); @@ -1490,7 +1492,7 @@ while (h_throwable.not_null()) { objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable()))); if (result.is_null()) { - st->print_cr(no_stack_trace_message()); + st->print_cr("%s", no_stack_trace_message()); return; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/symbolTable.cpp --- a/hotspot/src/share/vm/classfile/symbolTable.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp Fri May 09 16:50:54 2014 -0400 @@ -39,6 +39,8 @@ #include "gc_implementation/g1/g1StringDedup.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // -------------------------------------------------------------------------- // the number of buckets a thread claims diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri May 09 16:50:54 2014 -0400 @@ -2269,7 +2269,7 @@ oop appendix = appendix_box->obj_at(0); if (TraceMethodHandles) { #ifndef PRODUCT - tty->print("Linked method="INTPTR_FORMAT": ", m); + tty->print("Linked method=" INTPTR_FORMAT ": ", p2i(m)); m->print(); if (appendix != NULL) { tty->print("appendix = "); appendix->print(); } tty->cr(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/verifier.cpp --- a/hotspot/src/share/vm/classfile/verifier.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/verifier.cpp Fri May 09 16:50:54 2014 -0400 @@ -364,7 +364,7 @@ void ErrorContext::details(outputStream* ss, const Method* method) const { if (is_valid()) { - ss->print_cr(""); + ss->cr(); ss->print_cr("Exception Details:"); location_details(ss, method); reason_details(ss); @@ -379,7 +379,7 @@ streamIndentor si(ss); ss->indent().print_cr("Reason:"); streamIndentor si2(ss); - ss->indent().print(""); + ss->indent().print("%s", ""); switch (_fault) { case INVALID_BYTECODE: ss->print("Error exists in the bytecode"); @@ -432,7 +432,7 @@ ShouldNotReachHere(); ss->print_cr("Unknown"); } - ss->print_cr(""); + ss->cr(); } void ErrorContext::location_details(outputStream* ss, const Method* method) const { @@ -507,7 +507,7 @@ for (u2 i = 0; i < sm_table->number_of_entries(); ++i) { ss->indent(); sm_frame->print_on(ss, current_offset); - ss->print_cr(""); + ss->cr(); current_offset += sm_frame->offset_delta(); sm_frame = sm_frame->next(); } @@ -579,7 +579,8 @@ tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string()); } - const char* bad_type_msg = "Bad type on operand stack in %s"; +// For clang, the only good constant format string is a literal constant format string. +#define bad_type_msg "Bad type on operand stack in %s" int32_t max_stack = m->verifier_max_stack(); int32_t max_locals = m->max_locals(); @@ -1676,6 +1677,8 @@ } } +#undef bad_type_message + char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) { char* code_data = NEW_RESOURCE_ARRAY(char, code_length); memset(code_data, 0, sizeof(char) * code_length); @@ -2363,8 +2366,8 @@ if (opcode == Bytecodes::_invokedynamic) { if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) { class_format_error( - "invokedynamic instructions not supported by this class file version", - _klass->external_name()); + "invokedynamic instructions not supported by this class file version (%d), class %s", + _klass->major_version(), _klass->external_name()); return; } } else { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/verifier.hpp --- a/hotspot/src/share/vm/classfile/verifier.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/verifier.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -375,15 +375,15 @@ bool has_error() const { return result() != NULL; } char* exception_message() { stringStream ss; - ss.print(_message); + ss.print("%s", _message); _error_context.details(&ss, _method()); return ss.as_string(); } // Called when verify or class format errors are encountered. // May throw an exception based upon the mode. - void verify_error(ErrorContext ctx, const char* fmt, ...); - void class_format_error(const char* fmt, ...); + void verify_error(ErrorContext ctx, const char* fmt, ...) ATTRIBUTE_PRINTF(3, 4); + void class_format_error(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3); Klass* load_class(Symbol* name, TRAPS); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/classfile/vmSymbols.cpp --- a/hotspot/src/share/vm/classfile/vmSymbols.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -533,7 +533,7 @@ xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'", actual_name, declared_name); xtty->method(mh); - xtty->end_elem(""); + xtty->end_elem("%s", ""); } if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):", diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/codeBlob.cpp --- a/hotspot/src/share/vm/code/codeBlob.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/codeBlob.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -530,7 +530,7 @@ } void CodeBlob::print_on(outputStream* st) const { - st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this); + st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this)); st->print_cr("Framesize: %d", _frame_size); } @@ -548,7 +548,7 @@ } void BufferBlob::print_value_on(outputStream* st) const { - st->print_cr("BufferBlob (" INTPTR_FORMAT ") used for %s", this, name()); + st->print_cr("BufferBlob (" INTPTR_FORMAT ") used for %s", p2i(this), name()); } void RuntimeStub::verify() { @@ -558,13 +558,13 @@ void RuntimeStub::print_on(outputStream* st) const { ttyLocker ttyl; CodeBlob::print_on(st); - st->print("Runtime Stub (" INTPTR_FORMAT "): ", this); - st->print_cr(name()); + st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this)); + st->print_cr("%s", name()); Disassembler::decode((CodeBlob*)this, st); } void RuntimeStub::print_value_on(outputStream* st) const { - st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name()); + st->print("RuntimeStub (" INTPTR_FORMAT "): ", p2i(this)); st->print("%s", name()); } void SingletonBlob::verify() { @@ -574,12 +574,12 @@ void SingletonBlob::print_on(outputStream* st) const { ttyLocker ttyl; CodeBlob::print_on(st); - st->print_cr(name()); + st->print_cr("%s", name()); Disassembler::decode((CodeBlob*)this, st); } void SingletonBlob::print_value_on(outputStream* st) const { - st->print_cr(name()); + st->print_cr("%s", name()); } void DeoptimizationBlob::print_value_on(outputStream* st) const { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/codeCache.cpp --- a/hotspot/src/share/vm/code/codeCache.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/codeCache.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,10 +81,10 @@ bool is_empty() { return count == 0; } void print(const char* title) { - tty->print_cr(" #%d %s = %dK (hdr %d%%, loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])", + tty->print_cr(" #%d %s = %dK (hdr %d%%, loc %d%%, code %d%%, stub %d%%, [oops %d%%, metadata %d%%, data %d%%, pcs %d%%])", count, title, - total() / K, + (int)(total() / K), header_size * 100 / total_size, relocation_size * 100 / total_size, code_size * 100 / total_size, @@ -191,7 +191,7 @@ } if (PrintCodeCacheExtension) { ResourceMark rm; - tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (%d bytes)", + tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)", (intptr_t)_heap->low_boundary(), (intptr_t)_heap->high(), (address)_heap->high() - (address)_heap->low_boundary()); } @@ -487,7 +487,7 @@ if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) { CompiledIC *ic = CompiledIC_at(iter.reloc()); if (TraceCompiledIC) { - tty->print("noticed icholder " INTPTR_FORMAT " ", ic->cached_icholder()); + tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder())); ic->print(); } assert(ic->cached_icholder() != NULL, "must be non-NULL"); @@ -741,10 +741,10 @@ } // Print bytes that are allocated in the freelist ttyLocker ttl; - tty->print_cr("Number of elements in freelist: %d", freelist_length()); - tty->print_cr("Allocated in freelist: %dkB", bytes_allocated_in_freelist()/K); - tty->print_cr("Unused bytes in CodeBlobs: %dkB", (int)(wasted_bytes/K)); - tty->print_cr("Segment map size: %dkB", allocated_segments()/K); // 1 byte per segment + tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT, freelist_length()); + tty->print_cr("Allocated in freelist: " SSIZE_FORMAT "kB", bytes_allocated_in_freelist()/K); + tty->print_cr("Unused bytes in CodeBlobs: " SSIZE_FORMAT "kB", (wasted_bytes/K)); + tty->print_cr("Segment map size: " SSIZE_FORMAT "kB", allocated_segments()/K); // 1 byte per segment } //------------------------------------------------------------------------------------------------ @@ -756,7 +756,7 @@ if (PrintCodeCache2) { // Need to add a new flag ResourceMark rm; if (size == 0) size = cb->size(); - tty->print_cr("CodeCache %s: addr: " INTPTR_FORMAT ", size: 0x%x", event, cb, size); + tty->print_cr("CodeCache %s: addr: " INTPTR_FORMAT ", size: 0x%x", event, p2i(cb), size); } } @@ -926,9 +926,9 @@ if (detailed) { st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]", - _heap->low_boundary(), - _heap->high(), - _heap->high_boundary()); + p2i(_heap->low_boundary()), + p2i(_heap->high()), + p2i(_heap->high_boundary())); st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT " adapters=" UINT32_FORMAT, nof_blobs(), nof_nmethods(), nof_adapters()); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/compiledIC.cpp --- a/hotspot/src/share/vm/code/compiledIC.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/compiledIC.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,9 +88,9 @@ if (TraceCompiledIC) { tty->print(" "); print_compiled_ic(); - tty->print(" changing destination to " INTPTR_FORMAT, entry_point); + tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point)); if (!is_optimized()) { - tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", (address)cache); + tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache)); } if (is_icstub) { tty->print(" (icstub)"); @@ -195,7 +195,7 @@ if (TraceICs) { ResourceMark rm; tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT, - instruction_address(), call_info->selected_method()->print_value_string(), entry); + p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry)); } // We can't check this anymore. With lazy deopt we could have already @@ -272,7 +272,7 @@ void CompiledIC::set_to_clean() { assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call"); if (TraceInlineCacheClearing || TraceICs) { - tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", instruction_address()); + tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address())); print(); } @@ -354,7 +354,7 @@ if (TraceICs) { ResourceMark rm(thread); tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter: %s", - instruction_address(), + p2i(instruction_address()), method->print_value_string()); } } else { @@ -362,7 +362,7 @@ InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry()); if (TraceICs) { ResourceMark rm(thread); - tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", instruction_address()); + tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address())); } } } else { @@ -392,7 +392,7 @@ ResourceMark rm(thread); assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be"); tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s", - instruction_address(), + p2i(instruction_address()), ((Klass*)info.cached_metadata())->print_value_string(), (safe) ? "" : "via stub"); } @@ -530,8 +530,8 @@ if (TraceICs) { ResourceMark rm; tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_compiled " INTPTR_FORMAT, - instruction_address(), - info.entry()); + p2i(instruction_address()), + p2i(info.entry())); } // Call to compiled code assert (CodeCache::contains(info.entry()), "wrong entry point"); @@ -600,11 +600,11 @@ void CompiledIC::print_compiled_ic() { tty->print("Inline cache at " INTPTR_FORMAT ", calling %s " INTPTR_FORMAT " cached_value " INTPTR_FORMAT, - instruction_address(), is_call_to_interpreted() ? "interpreted " : "", ic_destination(), is_optimized() ? NULL : cached_value()); + p2i(instruction_address()), is_call_to_interpreted() ? "interpreted " : "", p2i(ic_destination()), p2i(is_optimized() ? NULL : cached_value())); } void CompiledStaticCall::print() { - tty->print("static call at " INTPTR_FORMAT " -> ", instruction_address()); + tty->print("static call at " INTPTR_FORMAT " -> ", p2i(instruction_address())); if (is_clean()) { tty->print("clean"); } else if (is_call_to_compiled()) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/compressedStream.cpp --- a/hotspot/src/share/vm/code/compressedStream.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/compressedStream.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -212,6 +212,8 @@ return h ^ l; } +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_IGNORED // Someone needs to deal with this. void test_compressed_stream(int trace) { CompressedWriteStream bytes(stretch_limit * 100); jint n; @@ -275,6 +277,7 @@ guarantee(length == length2, "bad length"); guarantee(fails == 0, "test failures"); } +PRAGMA_DIAG_POP #if defined(_MSC_VER) &&_MSC_VER >=1400 && !defined(_WIN64) #pragma warning(default: 4748) diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/debugInfo.cpp --- a/hotspot/src/share/vm/code/debugInfo.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/debugInfo.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,9 @@ #include "code/nmethod.hpp" #include "runtime/handles.inline.hpp" -// Comstructors +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + +// Constructors DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size) : CompressedWriteStream(initial_size) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/exceptionHandlerTable.cpp --- a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ #include "code/nmethod.hpp" #include "memory/allocation.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) { _nesting.check(); if (_length >= _size) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/icBuffer.cpp --- a/hotspot/src/share/vm/code/icBuffer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/icBuffer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ #include "runtime/mutexLocker.hpp" #include "runtime/stubRoutines.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC DEF_STUB_INTERFACE(ICStub); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/nmethod.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,8 @@ #include "shark/sharkCompiler.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef DTRACE_ENABLED // Only bother with this argument setup if dtrace is available diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/pcDesc.cpp --- a/hotspot/src/share/vm/code/pcDesc.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/pcDesc.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ #include "code/scopeDesc.hpp" #include "memory/resourceArea.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PcDesc::PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset) { _pc_offset = pc_offset; _scope_decode_offset = scope_decode_offset; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/relocInfo.cpp --- a/hotspot/src/share/vm/code/relocInfo.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/relocInfo.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ #include "runtime/stubCodeGenerator.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC const RelocationHolder RelocationHolder::none; // its type is relocInfo::none diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/scopeDesc.cpp --- a/hotspot/src/share/vm/code/scopeDesc.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/scopeDesc.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop) { _code = code; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/code/vtableStubs.cpp --- a/hotspot/src/share/vm/code/vtableStubs.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/code/vtableStubs.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ #include "opto/matcher.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // ----------------------------------------------------------------------------------------- // Implementation of VtableStub diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/compileBroker.cpp --- a/hotspot/src/share/vm/compiler/compileBroker.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -172,7 +172,7 @@ void log_nmethod(JavaThread* thread, nmethod* nm) { log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]", nm->compile_id(), nm->is_osr_method() ? "%" : "", - nm, nm->code_begin(), nm->code_end()); + p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end())); } void log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) { @@ -1786,7 +1786,7 @@ if (xtty != NULL) { ttyLocker ttyl; // Record any per thread log files - xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file_name); + xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name); } return; } @@ -1817,7 +1817,7 @@ if (_should_block) { #ifndef PRODUCT if (PrintCompilation && (Verbose || WizardMode)) - tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", Thread::current()); + tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", p2i(Thread::current())); #endif ThreadInVMfromNative tivfn(JavaThread::current()); } @@ -1834,7 +1834,7 @@ CodeCache::print_summary(&s, detailed); } ttyLocker ttyl; - tty->print(s.as_string()); + tty->print("%s", s.as_string()); } // ------------------------------------------------------------------ @@ -2039,7 +2039,7 @@ // Lock to prevent tearing ttyLocker ttyl; xtty->begin_elem("code_cache_full"); - xtty->print(s.as_string()); + xtty->print("%s", s.as_string()); xtty->stamp(); xtty->end_elem(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/compileLog.cpp --- a/hotspot/src/share/vm/compiler/compileLog.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/compileLog.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,9 +174,9 @@ void CompileLog::name(ciKlass* k) { print(" name='"); if (!k->is_loaded()) { - text()->print(k->name()->as_klass_external_name()); + text()->print("%s", k->name()->as_klass_external_name()); } else { - text()->print(k->external_name()); + text()->print("%s", k->external_name()); } print("'"); } @@ -303,7 +303,7 @@ // Print about successful method inlining. void CompileLog::inline_success(const char* reason) { begin_elem("inline_success reason='"); - text(reason); + text("%s", reason); end_elem("'"); } @@ -313,7 +313,7 @@ // Print about failed method inlining. void CompileLog::inline_fail(const char* reason) { begin_elem("inline_fail reason='"); - text(reason); + text("%s", reason); end_elem("'"); } @@ -339,5 +339,5 @@ void CompileLog::code_cache_state() { begin_elem("code_cache"); CodeCache::log_state(this); - end_elem(""); + end_elem("%s", ""); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/compileLog.hpp --- a/hotspot/src/share/vm/compiler/compileLog.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/compileLog.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ static CompileLog* _first; // head of static chain - void va_tag(bool push, const char* format, va_list ap); + void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0); public: CompileLog(const char* file_name, FILE* fp, intx thread_id); @@ -69,7 +69,7 @@ // or reset, context string will be silently ignored stringStream* context() { return &_context; } void clear_context() { context()->reset(); } - void set_context(const char* format, ...); + void set_context(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void name(ciSymbol* s); // name='s' void name(Symbol* s) { xmlStream::name(s); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/compilerOracle.cpp --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -520,7 +520,7 @@ tty->print_cr("CompilerOracle: unrecognized line"); tty->print_cr(" \"%s\"", original_line); if (error_msg != NULL) { - tty->print_cr(error_msg); + tty->print_cr("%s", error_msg); } } } @@ -642,7 +642,7 @@ char method_sep = have_colon ? ':' : '.'; if (Verbose) { - tty->print_cr(line); + tty->print_cr("%s", line); } ResourceMark rm; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/disassembler.cpp --- a/hotspot/src/share/vm/compiler/disassembler.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/disassembler.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,8 @@ #include "shark/sharkEntry.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void* Disassembler::_library = NULL; bool Disassembler::_tried_to_load_library = false; @@ -411,6 +413,7 @@ return env->handle_event(event, (address) arg); } +ATTRIBUTE_PRINTF(2, 3) static int printf_to_env(void* env_pv, const char* format, ...) { decode_env* env = (decode_env*) env_pv; outputStream* st = env->output(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/methodLiveness.cpp --- a/hotspot/src/share/vm/compiler/methodLiveness.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ #include "memory/allocation.inline.hpp" #include "utilities/bitMap.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // The MethodLiveness class performs a simple liveness analysis on a method // in order to decide which locals are live (that is, will be used again) at // a particular bytecode index (bci). diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/compiler/oopMap.cpp --- a/hotspot/src/share/vm/compiler/oopMap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/compiler/oopMap.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -633,8 +633,8 @@ tty->print_cr( "Add derived pointer@" INTPTR_FORMAT " - Derived: " INTPTR_FORMAT - " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)", - derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset + " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")", + p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset ); } // Set derived oop location to point to base. @@ -661,8 +661,8 @@ if (TraceDerivedPointers) { tty->print_cr("Updating derived pointer@" INTPTR_FORMAT - " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %d)", - derived_loc, (address)*derived_loc, (address)base, offset); + " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")", + p2i(derived_loc), p2i((address)*derived_loc), p2i((address)base), offset); } // Delete entry diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,7 +157,7 @@ " split_deaths(" SIZE_FORMAT ")" " coal_deaths(" SIZE_FORMAT ")" " + count(" SSIZE_FORMAT ")", - this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(), + p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(), _allocation_stats.coal_births(), _allocation_stats.split_deaths(), _allocation_stats.coal_deaths(), count())); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -428,7 +428,7 @@ void LinearAllocBlock::print_on(outputStream* st) const { st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT, - _ptr, _word_size, _refillSize, _allocation_size_limit); + p2i(_ptr), _word_size, _refillSize, _allocation_size_limit); } void CompactibleFreeListSpace::print_on(outputStream* st) const { @@ -459,7 +459,7 @@ for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; fc = fc->next()) { gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ") %s", - fc, (HeapWord*)fc + i, + p2i(fc), p2i((HeapWord*)fc + i), fc->cantCoalesce() ? "\t CC" : ""); } } @@ -503,7 +503,7 @@ if (_sp->block_is_obj(addr)) { const bool dead = _post_remark && !_live_bit_map->isMarked(addr); _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s", - addr, + p2i(addr), dead ? "dead" : "live", sz, (!dead && CMSPrintObjectsInDump) ? ":" : "."); @@ -513,7 +513,7 @@ } } else { // free block _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s", - addr, sz, CMSPrintChunksInDump ? ":" : "."); + p2i(addr), sz, CMSPrintChunksInDump ? ":" : "."); if (CMSPrintChunksInDump) { ((FreeChunk*)addr)->print_on(_st); _st->print_cr("--------------------------------------"); @@ -1983,7 +1983,7 @@ assert(ur.contains(urasm), err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" " should contain [" PTR_FORMAT "," PTR_FORMAT ")", - ur.start(), ur.end(), urasm.start(), urasm.end())); + p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end()))); #endif // inform allocator that promotions should be tracked. assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); @@ -2206,7 +2206,7 @@ if (PrintFLSStatistics > 0) { HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict(); gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT, - largestAddr); + p2i(largestAddr)); } setFLSurplus(); setFLHints(); @@ -2355,8 +2355,8 @@ gclog_or_tty->print_cr( " Current: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n" " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n", - addr, res, was_obj ?"true":"false", was_live ?"true":"false", - _last_addr, _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false"); + p2i(addr), res, was_obj ?"true":"false", was_live ?"true":"false", + p2i(_last_addr), _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false"); _sp->print_on(gclog_or_tty); guarantee(false, "Seppuku!"); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -403,7 +403,7 @@ if (CMSTraceSweeper) { gclog_or_tty->print_cr(">>>>> Saving sweep limit " PTR_FORMAT " for space [" PTR_FORMAT "," PTR_FORMAT ") <<<<<<", - _sweep_limit, bottom(), end()); + p2i(_sweep_limit), p2i(bottom()), p2i(end())); } } NOT_PRODUCT( diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,6 +64,8 @@ #include "services/memoryService.hpp" #include "services/runtimeService.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // statics CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; bool CMSCollector::_full_gc_requested = false; @@ -1182,7 +1184,7 @@ gclog_or_tty->print(" icms alloc limits: " PTR_FORMAT "," PTR_FORMAT " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ", - _icms_start_limit, _icms_stop_limit, + p2i(_icms_start_limit), p2i(_icms_stop_limit), percent_of_space(eden, _icms_start_limit), percent_of_space(eden, _icms_stop_limit)); if (Verbose) { @@ -1210,7 +1212,7 @@ gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT ", new limit=" PTR_FORMAT " (" SIZE_FORMAT "%%)", - top, _icms_stop_limit, + p2i(top), p2i(_icms_stop_limit), percent_of_space(space, _icms_stop_limit)); } ConcurrentMarkSweepThread::start_icms(); @@ -1227,7 +1229,7 @@ gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT ", new limit=" PTR_FORMAT " (" SIZE_FORMAT "%%)", - top, space->end(), + p2i(top), p2i(space->end()), percent_of_space(space, space->end())); } ConcurrentMarkSweepThread::stop_icms(); @@ -1502,7 +1504,7 @@ if (PrintCMSInitiationStatistics && stats().valid()) { gclog_or_tty->print("CMSCollector shouldConcurrentCollect: "); gclog_or_tty->stamp(); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); stats().print_on(gclog_or_tty); gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f", stats().time_until_cms_gen_full()); @@ -3588,7 +3590,7 @@ _collector->cmsGen()->short_name(), _phase, _collector->timerValue(), _wallclock.seconds()); if (_print_cr) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); } if (PrintCMSStatistics != 0) { gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ // From this time Thread::current() should be working. assert(this == Thread::current(), "just checking"); if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) { - warning("Couldn't bind CMS thread to processor %u", CPUForCMSThread); + warning("Couldn't bind CMS thread to processor " UINTX_FORMAT, CPUForCMSThread); } // Wait until Universe::is_fully_initialized() { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -239,7 +239,7 @@ jio_snprintf(buf, sizeof(buf), " [%.3f: CMSThread %s] ", ts.seconds(), desc); buf[sizeof(buf) - 1] = '\0'; - gclog_or_tty->print(buf); + gclog_or_tty->print("%s", buf); } } @@ -271,7 +271,7 @@ inline void tick() { _ticks++; if (CMSLoopWarn && _ticks % _threshold == 0) { - warning("%s has looped %d times %s", _src, _ticks, _msg); + warning("%s has looped " INTX_FORMAT " times %s", _src, _ticks, _msg); } } }; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ #include "memory/freeBlockDictionary.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifndef PRODUCT #define baadbabeHeapWord badHeapWordVal diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ #include "oops/markOop.inline.hpp" #include "oops/oop.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ///////////////////////////////////////////////////////////////////////// //// PromotionInfo ///////////////////////////////////////////////////////////////////////// diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ #include "runtime/os.hpp" #include "utilities/dtrace.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC ////////////////////////////////////////////////////////// // Methods in abstract class VM_CMS_Operation diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -537,7 +537,7 @@ if (verbose_low()) { gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " - "heap end = "PTR_FORMAT, _heap_start, _heap_end); + "heap end = " PTR_FORMAT, p2i(_heap_start), p2i(_heap_end)); } if (!_markBitMap1.allocate(heap_rs)) { @@ -651,7 +651,7 @@ if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) { warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): " "must be between " UINTX_FORMAT " and " UINTX_FORMAT, - mark_stack_size, 1, MarkStackSizeMax); + mark_stack_size, (uintx) 1, MarkStackSizeMax); return; } FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size); @@ -662,7 +662,7 @@ if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): " "must be between " UINTX_FORMAT " and " UINTX_FORMAT, - MarkStackSize, 1, MarkStackSizeMax); + MarkStackSize, (uintx) 1, MarkStackSizeMax); return; } } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) { @@ -821,7 +821,7 @@ assert(!concurrent_marking_in_progress(), "invariant"); assert(_finger == _heap_end, err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT, - _finger, _heap_end)); + p2i(_finger), p2i(_heap_end))); update_g1_committed(true); } } @@ -1424,7 +1424,7 @@ assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), err_msg("Preconditions not met - " "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT, - start, ntams, hr->end())); + p2i(start), p2i(ntams), p2i(hr->end()))); // Find the first marked object at or after "start". start = _bm->getNextMarkedWordAddress(start, ntams); @@ -1609,7 +1609,7 @@ if (failures > 0 && _verbose) { gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", " "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT, - HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(), + HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()), _calc_cl.region_marked_bytes(), hr->next_marked_bytes()); } @@ -2241,7 +2241,7 @@ if (_cm->verbose_high()) { gclog_or_tty->print_cr("\t[%u] we're looking at location " "*"PTR_FORMAT" = "PTR_FORMAT, - _task->worker_id(), p, (void*) obj); + _task->worker_id(), p2i(p), p2i((void*) obj)); } _task->deal_with_reference(obj); @@ -2675,7 +2675,7 @@ } _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s", - p, (void*) obj, str, str2); + p2i(p), p2i((void*) obj), str, str2); } }; @@ -2702,7 +2702,7 @@ if (print_it) { _out->print_cr(" "PTR_FORMAT"%s", - (void *)o, (over_tams) ? " >" : (marked) ? " M" : ""); + p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : ""); PrintReachableOopClosure oopCl(_out, _vo, _all); o->oop_iterate_no_header(&oopCl); } @@ -2723,14 +2723,14 @@ HeapWord* t = hr->top(); HeapWord* p = _g1h->top_at_mark_start(hr, _vo); _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " - "TAMS: "PTR_FORMAT, b, e, t, p); + "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p)); _out->cr(); HeapWord* from = b; HeapWord* to = t; if (to > from) { - _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to); + _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to)); _out->cr(); PrintReachableObjectClosure ocl(_out, _vo, _all, hr); hr->object_iterate_mem_careful(MemRegion(from, to), &ocl); @@ -2846,7 +2846,7 @@ gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" " "["PTR_FORMAT", "PTR_FORMAT"), " "limit = "PTR_FORMAT, - worker_id, curr_region, bottom, end, limit); + worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit)); } // Is the gap between reading the finger and doing the CAS too long? @@ -2860,13 +2860,13 @@ if (verbose_low()) { gclog_or_tty->print_cr("[%u] we were successful with region = " - PTR_FORMAT, worker_id, curr_region); + PTR_FORMAT, worker_id, p2i(curr_region)); } if (limit > bottom) { if (verbose_low()) { gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, " - "returning it ", worker_id, curr_region); + "returning it ", worker_id, p2i(curr_region)); } return curr_region; } else { @@ -2874,7 +2874,7 @@ "the region limit should be at bottom"); if (verbose_low()) { gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, " - "returning NULL", worker_id, curr_region); + "returning NULL", worker_id, p2i(curr_region)); } // we return NULL and the caller should try calling // claim_region() again. @@ -2886,7 +2886,7 @@ gclog_or_tty->print_cr("[%u] somebody else moved the finger, " "global finger = "PTR_FORMAT", " "our finger = "PTR_FORMAT, - worker_id, _finger, finger); + worker_id, p2i(_finger), p2i(finger)); } // read it again @@ -2925,7 +2925,7 @@ void do_object_work(oop obj) { guarantee(!_g1h->obj_in_cs(obj), err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d", - (void*) obj, phase_str(), _info)); + p2i((void*) obj), phase_str(), _info)); } public: @@ -3004,7 +3004,7 @@ HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); guarantee(global_finger == global_hr->bottom(), err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT, - global_finger, HR_FORMAT_PARAMS(global_hr))); + p2i(global_finger), HR_FORMAT_PARAMS(global_hr))); } // Verify the task fingers @@ -3018,7 +3018,7 @@ guarantee(task_finger == task_hr->bottom() || !task_hr->in_collection_set(), err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT, - task_finger, HR_FORMAT_PARAMS(task_hr))); + p2i(task_finger), HR_FORMAT_PARAMS(task_hr))); } } } @@ -3062,7 +3062,7 @@ err_msg("Preconditions not met - " "start: "PTR_FORMAT", limit: "PTR_FORMAT", " "top: "PTR_FORMAT", end: "PTR_FORMAT, - start, limit, hr->top(), hr->end())); + p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end()))); assert(hr->next_marked_bytes() == 0, "Precondition"); @@ -3303,7 +3303,7 @@ void ConcurrentMark::print_on_error(outputStream* st) const { st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, - _prevMarkBitMap, _nextMarkBitMap); + p2i(_prevMarkBitMap), p2i(_nextMarkBitMap)); _prevMarkBitMap->print_on_error(st, " Prev Bits: "); _nextMarkBitMap->print_on_error(st, " Next Bits: "); } @@ -3336,11 +3336,11 @@ // for debugging purposes void ConcurrentMark::print_finger() { gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, - _heap_start, _heap_end, _finger); + p2i(_heap_start), p2i(_heap_end), p2i(_finger)); for (uint i = 0; i < _max_worker_id; ++i) { - gclog_or_tty->print(" %u: "PTR_FORMAT, i, _tasks[i]->finger()); + gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger())); } - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); } #endif @@ -3349,7 +3349,7 @@ if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT, - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } size_t obj_size = obj->size(); @@ -3428,7 +3428,7 @@ if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT, - _worker_id, hr); + _worker_id, p2i(hr)); } _curr_region = hr; @@ -3445,7 +3445,7 @@ if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] found an empty region " "["PTR_FORMAT", "PTR_FORMAT")", - _worker_id, bottom, limit); + _worker_id, p2i(bottom), p2i(limit)); } // The region was collected underneath our feet. // We set the finger to bottom to ensure that the bitmap @@ -3477,7 +3477,7 @@ assert(_curr_region != NULL, "invariant"); if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT, - _worker_id, _curr_region); + _worker_id, p2i(_curr_region)); } clear_region_fields(); } @@ -3768,7 +3768,7 @@ if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id, - (void*) obj); + p2i((void*) obj)); } assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); @@ -4153,7 +4153,7 @@ gclog_or_tty->print_cr("[%u] we're scanning part " "["PTR_FORMAT", "PTR_FORMAT") " "of region "HR_FORMAT, - _worker_id, _finger, _region_limit, + _worker_id, p2i(_finger), p2i(_region_limit), HR_FORMAT_PARAMS(_curr_region)); } @@ -4240,7 +4240,7 @@ if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] we successfully claimed " "region "PTR_FORMAT, - _worker_id, claimed_region); + _worker_id, p2i(claimed_region)); } setup_for_region(claimed_region); @@ -4301,7 +4301,7 @@ if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) { if (_cm->verbose_medium()) { gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully", - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } statsOnly( ++_steals ); @@ -4549,8 +4549,8 @@ G1PPRL_SUM_ADDR_FORMAT("committed") G1PPRL_SUM_ADDR_FORMAT("reserved") G1PPRL_SUM_BYTE_FORMAT("region-size"), - g1_committed.start(), g1_committed.end(), - g1_reserved.start(), g1_reserved.end(), + p2i(g1_committed.start()), p2i(g1_committed.end()), + p2i(g1_reserved.start()), p2i(g1_reserved.end()), HeapRegion::GrainBytes); _out->print_cr(G1PPRL_LINE_PREFIX); _out->print_cr(G1PPRL_LINE_PREFIX @@ -4667,7 +4667,7 @@ G1PPRL_DOUBLE_FORMAT G1PPRL_BYTE_FORMAT G1PPRL_BYTE_FORMAT, - type, bottom, end, + type, p2i(bottom), p2i(end), used_bytes, prev_live_bytes, next_live_bytes, gc_eff, remset_bytes, strong_code_roots_bytes); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -277,7 +277,7 @@ assert(_nextMarkBitMap->isMarked(objAddr), "invariant"); if (_cm->verbose_high()) { - gclog_or_tty->print_cr("[%u] pushing "PTR_FORMAT, _worker_id, (void*) obj); + gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj)); } if (!_task_queue->push(obj)) { @@ -317,7 +317,7 @@ inline void CMTask::deal_with_reference(oop obj) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT, - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } ++_refs_reached; @@ -334,7 +334,7 @@ if (!hr->obj_allocated_since_next_marking(obj)) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked", - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } // we need to mark it first @@ -349,7 +349,7 @@ if (_finger != NULL && objAddr < _finger) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), " - "pushing it", _worker_id, _finger); + "pushing it", _worker_id, p2i(_finger)); } push(obj); } else if (_curr_region != NULL && objAddr < _region_limit) { @@ -367,7 +367,7 @@ if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] below the global finger " "("PTR_FORMAT"), pushing it", - _worker_id, global_finger); + _worker_id, p2i(global_finger)); } push(obj); } else { @@ -382,7 +382,7 @@ if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] below the global finger " "("PTR_FORMAT"), pushing it", - _worker_id, global_finger); + _worker_id, p2i(global_finger)); } push(obj); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,7 @@ void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) { msg->append("[%s] %s c: %u b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT, _name, message, _count, BOOL_TO_STR(_bot_updates), - _alloc_region, _used_bytes_before); + p2i(_alloc_region), _used_bytes_before); } void G1AllocRegion::init() { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -184,7 +184,7 @@ class ar_ext_msg : public err_msg { public: - ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("") { + ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") { alloc_region->fill_in_ext_msg(this, message); } }; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ REGION_SIZE_IN_WORDS * HeapWordSize); // Check address calculation (bounds) assert(array.bottom_address_mapped() == fake_heap, - err_msg("bottom mapped address should be "PTR_FORMAT", but is "PTR_FORMAT, fake_heap, array.bottom_address_mapped())); + err_msg("bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped()))); assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be"); int* bottom = array.address_mapped_to(fake_heap); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { assert(base != NULL, "just checking"); assert(length > 0, "just checking"); - assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by)); + assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %u, larger than word size?", shift_by)); _base = base; _length = length; _biased_base = base - (bias * elem_size); @@ -71,10 +71,10 @@ err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, - mapping_granularity_in_bytes, bottom)); + mapping_granularity_in_bytes, p2i(bottom))); assert((uintptr_t)end % mapping_granularity_in_bytes == 0, err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, - mapping_granularity_in_bytes, end)); + mapping_granularity_in_bytes, p2i(end))); size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes); idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ #include "runtime/java.hpp" #include "services/memTracker.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ////////////////////////////////////////////////////////////////////// // G1BlockOffsetSharedArray ////////////////////////////////////////////////////////////////////// diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,7 +80,7 @@ virtual void set_bottom(HeapWord* new_bottom) { assert(new_bottom <= _end, err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")", - new_bottom, _end)); + p2i(new_bottom), p2i(_end))); _bottom = new_bottom; resize(pointer_delta(_end, _bottom)); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ assert(pc >= (char*)_reserved.start() && pc < (char*)_reserved.end(), err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", - p, (char*)_reserved.start(), (char*)_reserved.end())); + p2i(p), p2i(_reserved.start()), p2i(_reserved.end()))); size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char)); size_t result = delta >> LogN; check_index(result, "bad index from address"); @@ -65,7 +65,7 @@ err_msg("bad address from index result " PTR_FORMAT " _reserved.start() " PTR_FORMAT " _reserved.end() " PTR_FORMAT, - result, _reserved.start(), _reserved.end())); + p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); return result; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ #include "services/memTracker.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) { if (has_count_table()) { assert(from_card_num >= 0 && from_card_num < _committed_max_card_num, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,10 +77,10 @@ err_msg("Invalid card pointer: " "card_ptr: " PTR_FORMAT ", " "_ct_bot: " PTR_FORMAT, - card_ptr, _ct_bot)); + p2i(card_ptr), p2i(_ct_bot))); size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); assert(card_num >= 0 && card_num < _committed_max_card_num, - err_msg("card pointer out of range: " PTR_FORMAT, card_ptr)); + err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr))); return card_num; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp Fri May 09 16:50:54 2014 -0400 @@ -28,6 +28,8 @@ #include "gc_implementation/g1/g1CodeCacheRemSet.hpp" #include "memory/iterator.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + G1CodeRootChunk::G1CodeRootChunk() : _top(NULL), _next(NULL), _prev(NULL) { _top = bottom(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri May 09 16:50:54 2014 -0400 @@ -22,6 +22,11 @@ * */ +#if !defined(__clang_major__) && defined(__GNUC__) +// FIXME, formats have issues. Disable this macro definition, compile, and study warnings for more information. +#define ATTRIBUTE_PRINTF(x,y) +#endif + #include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/icBuffer.hpp" @@ -370,7 +375,7 @@ } } - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); } void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr) @@ -3470,7 +3475,7 @@ // help us track down what went wrong. This is why we call // print_extended_on() instead of print_on(). print_extended_on(gclog_or_tty); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); #ifndef PRODUCT if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) { concurrent_mark()->print_reachable("at-verification-failure", @@ -3664,7 +3669,7 @@ PrintRSetsClosure(const char* msg) : _msg(msg), _occupied_sum(0) { gclog_or_tty->cr(); gclog_or_tty->print_cr("========================================"); - gclog_or_tty->print_cr(msg); + gclog_or_tty->print_cr("%s", msg); gclog_or_tty->cr(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ assert(addr != NULL, "invariant"); assert(_g1_reserved.contains((const void*) addr), err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")", - (void*)addr, _g1_reserved.start(), _g1_reserved.end())); + p2i((void*)addr), p2i(_g1_reserved.start()), p2i(_g1_reserved.end()))); return _hrs.addr_to_region((HeapWord*) addr); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,11 @@ * */ +#ifndef __clang_major__ +// FIXME, formats have issues. Disable this macro definition, compile, and study warnings for more information. +#define ATTRIBUTE_PRINTF(x,y) +#endif + #include "precompiled.hpp" #include "gc_implementation/g1/concurrentG1Refine.hpp" #include "gc_implementation/g1/concurrentMark.hpp" @@ -965,7 +970,7 @@ #ifndef PRODUCT if (G1YoungSurvRateVerbose) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); _short_lived_surv_rate_group->print(); // do that for any other surv rate groups too } @@ -2222,11 +2227,11 @@ gclog_or_tty->print_cr("ALL PAUSES"); print_summary_sd(" Total", &_total); - gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); + gclog_or_tty->cr(); gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num); gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("EVACUATION PAUSES"); @@ -2246,7 +2251,7 @@ print_summary(" Clear CT", &_clear_ct); print_summary(" Other", &_other); } - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("MISC"); print_summary_sd(" Stop World", &_all_stop_world_times_ms); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Fri May 09 16:50:54 2014 -0400 @@ -39,7 +39,7 @@ int _indent_level; int _cur; - void vappend(const char* format, va_list ap) { + void vappend(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) { int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap); if (res != -1) { _cur += res; @@ -63,14 +63,14 @@ } #endif - void append(const char* format, ...) { + void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { va_list ap; va_start(ap, format); vappend(format, ap); va_end(ap); } - void append_and_print_cr(const char* format, ...) { + void append_and_print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { va_list ap; va_start(ap, format); vappend(format, ap); @@ -80,6 +80,8 @@ } }; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED template void WorkerDataArray::print(int level, const char* title) { if (_length == 1) { @@ -109,7 +111,7 @@ } if (G1Log::finest()) { - buf.append_and_print_cr(""); + buf.append_and_print_cr("%s", ""); } double avg = (double)sum / (double)_length; @@ -129,6 +131,7 @@ } buf.append_and_print_cr("]"); } +PRAGMA_DIAG_POP #ifndef PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ #include "gc_implementation/g1/heapRegion.hpp" #include "utilities/ostream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + const char* G1HRPrinter::action_name(ActionType action) { switch(action) { case Alloc: return "ALLOC"; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,7 +114,7 @@ if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] we're looking at location " "*"PTR_FORMAT" = "PTR_FORMAT, - _task->worker_id(), p, (void*) obj); + _task->worker_id(), p2i(p), p2i((void*) obj)); } _task->deal_with_reference(obj); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/intHisto.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define CARD_REPEAT_HISTO 0 #if CARD_REPEAT_HISTO diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Fri May 09 16:50:54 2014 -0400 @@ -35,6 +35,8 @@ #include "oops/oop.inline.hpp" #include "runtime/orderAccess.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + int HeapRegion::LogOfHRGrainBytes = 0; int HeapRegion::LogOfHRGrainWords = 0; size_t HeapRegion::GrainBytes = 0; @@ -827,7 +829,7 @@ Mutex::_no_safepoint_check_flag); if (!_failures) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("----------"); } if (!_g1h->is_in_closed_subset(obj)) { @@ -882,7 +884,7 @@ Mutex::_no_safepoint_check_flag); if (!_failures) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("----------"); } gclog_or_tty->print_cr("Missing rem set entry:"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ (_hr_)->startsHumongous() ? "HS" : \ (_hr_)->continuesHumongous() ? "HC" : \ !(_hr_)->is_empty() ? "O" : "F", \ - (_hr_)->bottom(), (_hr_)->top(), (_hr_)->end() + p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end()) // sentinel value for hrs_index #define G1_NULL_HRS_INDEX ((uint) -1) @@ -550,7 +550,7 @@ (containing_set != NULL && _containing_set == NULL), err_msg("containing_set: "PTR_FORMAT" " "_containing_set: "PTR_FORMAT, - containing_set, _containing_set)); + p2i(containing_set), p2i(_containing_set))); _containing_set = containing_set; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri May 09 16:50:54 2014 -0400 @@ -36,6 +36,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/growableArray.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class PerRegionTable: public CHeapObj { friend class OtherRegionsTable; friend class HeapRegionRemSetIterator; @@ -1218,7 +1220,7 @@ while (cur_evnt < _n_recorded_events && i == cur_evnt_ind) { gclog_or_tty->print("Event: "); print_event(gclog_or_tty, cur_evnt_kind); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); cur_evnt++; if (cur_evnt < MaxRecordedEvents) { cur_evnt_kind = _recorded_events[cur_evnt]; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -233,7 +233,7 @@ guarantee(hr != NULL, err_msg("invariant: i: %u", i)); guarantee(hr->bottom() == prev_end, err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT, - i, HR_FORMAT_PARAMS(hr), prev_end)); + i, HR_FORMAT_PARAMS(hr), p2i(prev_end))); guarantee(hr->hrs_index() == i, err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index())); if (i < length()) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,9 +30,9 @@ inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const { assert(addr < heap_end(), - err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, addr, heap_end())); + err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, p2i(addr), p2i(heap_end()))); assert(addr >= heap_bottom(), - err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom())); + err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, p2i(addr), p2i(heap_bottom()))); HeapRegion* hr = _regions.get_by_address(addr); assert(hr != NULL, "invariant"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp Fri May 09 16:50:54 2014 -0400 @@ -26,6 +26,8 @@ #include "gc_implementation/g1/heapRegionRemSet.hpp" #include "gc_implementation/g1/heapRegionSet.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + uint FreeRegionList::_unrealistically_long_length = 0; void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp Fri May 09 16:50:54 2014 -0400 @@ -162,7 +162,7 @@ // diagnosing failures. class hrs_ext_msg : public hrs_err_msg { public: - hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("") { + hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("%s","") { set->fill_in_ext_msg(this, message); } }; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void ObjPtrQueue::flush() { // The buffer might contain refs into the CSet. We have to filter it // first before we flush it, otherwise we might end up with an diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ #include "gc_implementation/g1/survRateGroup.hpp" #include "memory/allocation.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p, const char* name, size_t summary_surv_rates_len) : @@ -202,7 +204,7 @@ if (length == 0) return; - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("%s Rate Summary (for up to age " SIZE_FORMAT ")", _name, length-1); gclog_or_tty->print_cr(" age range survival rate (avg) samples (avg)"); gclog_or_tty->print_cr(" ---------------------------------------------------------"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -259,22 +259,22 @@ requested_eden_size, requested_survivor_size); gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - eden()->bottom(), - eden()->end(), + p2i(eden()->bottom()), + p2i(eden()->end()), pointer_delta(eden()->end(), eden()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - from()->bottom(), - from()->end(), + p2i(from()->bottom()), + p2i(from()->end()), pointer_delta(from()->end(), from()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - to()->bottom(), - to()->end(), + p2i(to()->bottom()), + p2i(to()->end()), pointer_delta( to()->end(), to()->bottom(), sizeof(char))); @@ -382,18 +382,18 @@ if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); } } else { @@ -473,18 +473,18 @@ if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp --- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,8 @@ #include "runtime/virtualspace.hpp" #include "runtime/vmThread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, OopsInGenClosure* cl, CardTableRS* ct, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,6 +55,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/workgroup.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable:4355 ) // 'this' : used in base member initializer list diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,12 +79,12 @@ if ((HeapWord*)obj < _boundary) { #ifndef PRODUCT if (_g->to()->is_in_reserved(obj)) { - tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p); + tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p2i(p)); GenCollectedHeap* gch = (GenCollectedHeap*)Universe::heap(); Space* sp = gch->space_containing(p); oop obj = oop(sp->block_start(p)); assert((HeapWord*)obj < (HeapWord*)p, "Error"); - tty->print_cr("Object: " PTR_FORMAT, (void *)obj); + tty->print_cr("Object: " PTR_FORMAT, p2i((void *)obj)); tty->print_cr("-------"); obj->print(); tty->print_cr("-----"); @@ -110,7 +110,7 @@ if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", "forwarded ", - new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i(p), p2i((void *)obj), p2i((void *)new_obj), new_obj->size()); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -252,22 +252,22 @@ requested_eden_size, requested_survivor_size); gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - eden_space()->bottom(), - eden_space()->end(), + p2i(eden_space()->bottom()), + p2i(eden_space()->end()), pointer_delta(eden_space()->end(), eden_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - from_space()->bottom(), - from_space()->end(), + p2i(from_space()->bottom()), + p2i(from_space()->end()), pointer_delta(from_space()->end(), from_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - to_space()->bottom(), - to_space()->end(), + p2i(to_space()->bottom()), + p2i(to_space()->end()), pointer_delta( to_space()->end(), to_space()->bottom(), sizeof(char))); @@ -373,18 +373,18 @@ if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); } } else { @@ -427,18 +427,18 @@ if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -478,23 +478,23 @@ gclog_or_tty->print_cr(" " " _covered[%d].start(): " INTPTR_FORMAT " _covered[%d].last(): " INTPTR_FORMAT, - ind, _covered[ind].start(), - ind, _covered[ind].last()); + ind, p2i(_covered[ind].start()), + ind, p2i(_covered[ind].last())); gclog_or_tty->print_cr(" " " _committed[%d].start(): " INTPTR_FORMAT " _committed[%d].last(): " INTPTR_FORMAT, - ind, _committed[ind].start(), - ind, _committed[ind].last()); + ind, p2i(_committed[ind].start()), + ind, p2i(_committed[ind].last())); gclog_or_tty->print_cr(" " " byte_for(start): " INTPTR_FORMAT " byte_for(last): " INTPTR_FORMAT, - byte_for(_covered[ind].start()), - byte_for(_covered[ind].last())); + p2i(byte_for(_covered[ind].start())), + p2i(byte_for(_covered[ind].last()))); gclog_or_tty->print_cr(" " " addr_for(start): " INTPTR_FORMAT " addr_for(last): " INTPTR_FORMAT, - addr_for((jbyte*) _committed[ind].start()), - addr_for((jbyte*) _committed[ind].last())); + p2i(addr_for((jbyte*) _committed[ind].start())), + p2i(addr_for((jbyte*) _committed[ind].last()))); } debug_only(verify_guard();) } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // // GCTask // diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,8 @@ #include "runtime/os.hpp" #include "runtime/thread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + GCTaskThread::GCTaskThread(GCTaskManager* manager, uint which, uint processor_id) : diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,7 +155,7 @@ static inline idx_t bits_required(MemRegion covered_region); void print_on_error(outputStream* st) const { - st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this); + st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, p2i(this)); _beg_bits.print_on_error(st, " Begin Bits: "); _end_bits.print_on_error(st, " End Bits: "); } @@ -390,9 +390,9 @@ inline void ParMarkBitMap::verify_addr(HeapWord* addr) const { // Allow one past the last valid address; useful for loop bounds. assert(addr >= region_start(), - err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, addr, region_start())); + err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start()))); assert(addr <= region_end(), - err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, addr, region_end())); + err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end()))); } #endif // #ifdef ASSERT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -373,7 +373,7 @@ if ((result == NULL) && (QueuedAllocationWarningCount > 0) && (loop_count % QueuedAllocationWarningCount == 0)) { warning("ParallelScavengeHeap::mem_allocate retries %d times \n\t" - " size=%d", loop_count, size); + " size=" SIZE_FORMAT, loop_count, size); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ const void* loc = (void*) p; bool result = ((HeapWord*)p) >= young_gen()->reserved().start(); assert(result == young_gen()->is_in_reserved(p), - err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p)); + err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p))); return result; } #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_INLINE_HPP diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,8 @@ #include "runtime/vmThread.hpp" #include "services/management.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // // ThreadRootsMarkingTask // diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size, size_t init_promo_size, size_t init_survivor_size, @@ -1033,7 +1035,7 @@ "AdaptiveSizePolicy::adjust_promo_for_footprint " "adjusting tenured gen for footprint. " "starting promo size " SIZE_FORMAT - " reduced promo size " SIZE_FORMAT, + " reduced promo size " SIZE_FORMAT " promo delta " SIZE_FORMAT, desired_promo_size, reduced_size, change ); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,6 +54,8 @@ #include "utilities/events.hpp" #include "utilities/stack.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + elapsedTimer PSMarkSweep::_accumulated_time; jlong PSMarkSweep::_time_of_last_gc = 0; CollectorCounters* PSMarkSweep::_counters = NULL; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + inline const char* PSOldGen::select_name() { return UseParallelOldGC ? "ParOldGen" : "PSOldGen"; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,6 +62,8 @@ #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // All sizes are in HeapWords. const size_t ParallelCompactData::Log2RegionSize = 16; // 64K words const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include "oops/oop.inline.hpp" #include "oops/oop.psgc.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PaddedEnd* PSPromotionManager::_manager_array = NULL; OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; PSOldGen* PSPromotionManager::_old_gen = NULL; @@ -136,7 +138,7 @@ } const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); - for (uint i = 0; i < hlines; ++i) tty->print_cr(pm_stats_hdr[i]); + for (uint i = 0; i < hlines; ++i) tty->print_cr("%s", pm_stats_hdr[i]); for (uint i = 0; i < ParallelGCThreads + 1; ++i) { manager_array(i)->print_local_stats(i); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -226,7 +226,7 @@ if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring", - new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp Fri May 09 16:50:54 2014 -0400 @@ -56,6 +56,7 @@ #include "services/memoryService.hpp" #include "utilities/stack.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC HeapWord* PSScavenge::_to_space_top_before_gc = NULL; int PSScavenge::_consecutive_skipped_scavenges = 0; @@ -833,7 +834,7 @@ if (AlwaysTenure || NeverTenure) { assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, - err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold)); + err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold)); _tenuring_threshold = MaxTenuringThreshold; } else { // We want to smooth out our startup times for the AdaptiveSizePolicy diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,7 @@ if (TraceScavenge && o->is_forwarded()) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", "forwarding", - new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); } #endif @@ -180,7 +180,7 @@ if (TraceScavenge) { ResourceMark rm; gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass " PTR_FORMAT ", %s, dirty: %s", - klass, + p2i(klass), klass->external_name(), klass->has_modified_oops() ? "true" : "false"); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,8 @@ # include "os_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // PSVirtualSpace PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) : diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) : diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp Fri May 09 16:50:54 2014 -0400 @@ -84,7 +84,7 @@ if (AlwaysTenure || NeverTenure) { assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, - err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold)); + err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold)); result = MaxTenuringThreshold; } else { size_t total = 0; @@ -106,7 +106,7 @@ gclog_or_tty->cr(); gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold " UINTX_FORMAT " (max threshold " UINTX_FORMAT ")", - desired_survivor_size*oopSize, result, MaxTenuringThreshold); + desired_survivor_size*oopSize, (uintx) result, MaxTenuringThreshold); } size_t total = 0; @@ -115,8 +115,8 @@ total += sizes[age]; if (sizes[age] > 0) { if (PrintTenuringDistribution) { - gclog_or_tty->print_cr("- age %3u: %10ld bytes, %10ld total", - age, sizes[age]*oopSize, total*oopSize); + gclog_or_tty->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total", + age, sizes[age]*oopSize, total*oopSize); } } if (UsePerfData) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp --- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,7 @@ assert(demand >= 0, err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for " PTR_FORMAT " (size=" SIZE_FORMAT ")", - demand, this, count)); + demand, p2i(this), count)); // Defensive: adjust for imprecision in event counting if (demand < 0) { demand = 0; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ void ImmutableSpace::print() const { print_short(); - tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end()); + tty->print_cr(" [" INTPTR_FORMAT_W(#-6) "," INTPTR_FORMAT_W(#-6) ")", p2i(bottom()), p2i(end())); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + uint MarkSweep::_total_invocations = 0; Stack MarkSweep::_marking_stack; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ #include "oops/oop.inline.hpp" #include "runtime/thread.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) { _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray(0, true); _page_size = os::vm_page_size(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ #include "runtime/thread.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) { assert(MutableSpace::alignment() >= 0 && MutableSpace::alignment() % os::vm_page_size() == 0, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ #include "oops/oop.inline.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) : _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL), _end(NULL), _hard_end(NULL), diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ #include "memory/space.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Catch-all file for utility classes #ifndef PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/gc_interface/collectedHeap.cpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Fri May 09 16:50:54 2014 -0400 @@ -599,12 +599,12 @@ assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity"); void* before_heap = (void*)(heap_start - epsilon); assert(!heap->is_in(before_heap), - err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap)); + err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap))); // Test that a pointer to after the heap end is reported as outside the heap. assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity"); void* after_heap = (void*)(heap_end + epsilon); assert(!heap->is_in(after_heap), - err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap)); + err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap))); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/interpreter/bytecodeTracer.cpp --- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -213,7 +213,7 @@ st->print_cr(" %s", buf); } } else { - st->print_cr(" " PTR_FORMAT, (void *)value); + st->print_cr(" " INTPTR_FORMAT, p2i((void *)value)); } } @@ -282,7 +282,7 @@ if (i >= 0 && i < climit) { cp_index = cache->entry_at(i)->constant_pool_index(); } else { - st->print_cr(" not in CP[*]?", i); + st->print_cr("%d not in CP[*]?", i); return false; } return true; @@ -297,7 +297,7 @@ cp_index = constants->object_to_cp_index(i); return true; } else { - st->print_cr(" not in OBJ[*]?", i); + st->print_cr("%d not in OBJ[*]?", i); return false; } } @@ -321,7 +321,7 @@ if (tag.is_int()) { st->print_cr(" " INT32_FORMAT, constants->int_at(i)); } else if (tag.is_long()) { - st->print_cr(" " INT64_FORMAT, constants->long_at(i)); + st->print_cr(" " INT64_FORMAT, (int64_t)(constants->long_at(i))); } else if (tag.is_float()) { st->print_cr(" %f", constants->float_at(i)); } else if (tag.is_double()) { @@ -340,7 +340,7 @@ } else if (tag.is_method_handle()) { int kind = constants->method_handle_ref_kind_at(i); int i2 = constants->method_handle_index_at(i); - st->print(" ", kind, i2); + st->print(" ", kind, i2); print_field_or_method(-i, i2, st); } else { st->print_cr(" bad tag=%d at %d", tag.value(), i); @@ -389,6 +389,7 @@ } +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void BytecodePrinter::print_attributes(int bci, outputStream* st) { // Show attributes of pre-rewritten codes Bytecodes::Code code = Bytecodes::java_code(raw_code()); @@ -515,7 +516,10 @@ int idx = ll - lo; const char *format = first ? " %d:" INT32_FORMAT " (delta: %d)" : ", %d:" INT32_FORMAT " (delta: %d)"; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format, ll, dest[idx], dest[idx]-bci); +PRAGMA_DIAG_POP } st->cr(); } @@ -535,7 +539,10 @@ for (int ll = 0; ll < len; ll++, first = false) { const char *format = first ? " " INT32_FORMAT ":" INT32_FORMAT : ", " INT32_FORMAT ":" INT32_FORMAT ; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format, key[ll], dest[ll]); +PRAGMA_DIAG_POP } st->cr(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/interpreter/interpreter.cpp --- a/hotspot/src/share/vm/interpreter/interpreter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,7 @@ if (description() != NULL) st->print("%s ", description()); if (bytecode() >= 0 ) st->print("%d %s ", bytecode(), Bytecodes::name(bytecode())); st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes", - code_begin(), code_end(), code_size()); + p2i(code_begin()), p2i(code_end()), code_size()); if (PrintInterpreter) { st->cr(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/interpreter/interpreterRuntime.cpp --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,6 +75,8 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class UnlockFlagSaver { private: JavaThread* _thread; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/interpreter/linkResolver.cpp --- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Fri May 09 16:50:54 2014 -0400 @@ -1626,7 +1626,7 @@ THREAD); if (HAS_PENDING_EXCEPTION) { if (TraceMethodHandles) { - tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION); + tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); PENDING_EXCEPTION->print(); } if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/interpreter/oopMapCache.cpp --- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ #include "runtime/handles.inline.hpp" #include "runtime/signature.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class OopMapCacheEntry: private InterpreterOopMap { friend class InterpreterOopMap; friend class OopMapForCacheEntry; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/interpreter/templateInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,7 +104,7 @@ tty->print("["); for (int i = 0; i < number_of_states; i++) { if (i > 0) tty->print(", "); - tty->print(INTPTR_FORMAT, _entry[i]); + tty->print(INTPTR_FORMAT, p2i(_entry[i])); } tty->print("]"); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/libadt/dict.cpp --- a/hotspot/src/share/vm/libadt/dict.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/libadt/dict.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,8 @@ #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // The iostream is not needed and it gets confused for gcc by the // define of bool. // diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/libadt/set.cpp --- a/hotspot/src/share/vm/libadt/set.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/libadt/set.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,7 +116,7 @@ void Set::print() const { char *printable_set = setstr(); - tty->print_cr(printable_set); + tty->print_cr("%s", printable_set); FreeHeap(printable_set); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/allocation.cpp --- a/hotspot/src/share/vm/memory/allocation.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/allocation.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ } void MetaspaceObj::print_address_on(outputStream* st) const { - st->print(" {"INTPTR_FORMAT"}", this); + st->print(" {" INTPTR_FORMAT "}", p2i(this)); } void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() { @@ -142,7 +142,7 @@ void ResourceObj::set_allocation_type(address res, allocation_type type) { // Set allocation type in the resource object uintptr_t allocation = (uintptr_t)res; - assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " PTR_FORMAT, res)); + assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " INTPTR_FORMAT, p2i(res))); assert(type <= allocation_mask, "incorrect allocation type"); ResourceObj* resobj = (ResourceObj *)res; resobj->_allocation_t[0] = ~(allocation + type); @@ -179,7 +179,7 @@ // Operator new() was called and type was set. assert(!allocated_on_stack(), err_msg("not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - this, get_allocation_type(), _allocation_t[0], _allocation_t[1])); + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); } else { // Operator new() was not called. // Assume that it is embedded or stack object. @@ -193,7 +193,7 @@ // Note: garbage may resembles valid value. assert(~(_allocation_t[0] | allocation_mask) != (uintptr_t)this || !is_type_set(), err_msg("embedded or stack only, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - this, get_allocation_type(), _allocation_t[0], _allocation_t[1])); + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); set_allocation_type((address)this, STACK_OR_EMBEDDED); _allocation_t[1] = 0; // Zap verification value } @@ -202,7 +202,7 @@ // Used in InlineTree::ok_to_inline() for WarmCallInfo. assert(allocated_on_stack(), err_msg("copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - this, get_allocation_type(), _allocation_t[0], _allocation_t[1])); + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); // Keep current _allocation_t value; return *this; } @@ -218,13 +218,13 @@ void trace_heap_malloc(size_t size, const char* name, void* p) { // A lock is not needed here - tty uses a lock internally - tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p, size, name == NULL ? "" : name); + tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p2i(p), size, name == NULL ? "" : name); } void trace_heap_free(void* p) { // A lock is not needed here - tty uses a lock internally - tty->print_cr("Heap free " INTPTR_FORMAT, p); + tty->print_cr("Heap free " INTPTR_FORMAT, p2i(p)); } //-------------------------------------------------------------------------------------- @@ -725,11 +725,11 @@ void AllocatedObj::print_value() const { print_value_on(tty); } void AllocatedObj::print_on(outputStream* st) const { - st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", this); + st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", p2i(this)); } void AllocatedObj::print_value_on(outputStream* st) const { - st->print("AllocatedObj(" INTPTR_FORMAT ")", this); + st->print("AllocatedObj(" INTPTR_FORMAT ")", p2i(this)); } julong Arena::_bytes_allocated = 0; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/binaryTreeDictionary.cpp --- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Fri May 09 16:50:54 2014 -0400 @@ -1318,7 +1318,7 @@ for (Chunk_t* fc = fl->head(); fc != NULL; fc = fc->next()) { _st->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ") %s", - fc, (HeapWord*)fc + sz, + p2i(fc), p2i((HeapWord*)fc + sz), fc->cantCoalesce() ? "\t CC" : ""); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/blockOffsetTable.cpp --- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,12 +59,12 @@ " rs.base(): " INTPTR_FORMAT " rs.size(): " INTPTR_FORMAT " rs end(): " INTPTR_FORMAT, - rs.base(), rs.size(), rs.base() + rs.size()); + p2i(rs.base()), rs.size(), p2i(rs.base() + rs.size())); gclog_or_tty->print_cr(" " " _vs.low_boundary(): " INTPTR_FORMAT " _vs.high_boundary(): " INTPTR_FORMAT, - _vs.low_boundary(), - _vs.high_boundary()); + p2i(_vs.low_boundary()), + p2i(_vs.high_boundary())); } } @@ -537,10 +537,10 @@ q -= (N_words * n_cards_back); assert(q >= _sp->bottom(), err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, - q, _sp->bottom())); + p2i(q), p2i(_sp->bottom()))); assert(q < _sp->end(), err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, - q, _sp->end())); + p2i(q), p2i(_sp->end()))); index -= n_cards_back; offset = _array->offset_array(index); } @@ -549,10 +549,10 @@ q -= offset; assert(q >= _sp->bottom(), err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, - q, _sp->bottom())); + p2i(q), p2i(_sp->bottom()))); assert(q < _sp->end(), err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, - q, _sp->end())); + p2i(q), p2i(_sp->end()))); HeapWord* n = q; while (n <= addr) { @@ -563,14 +563,14 @@ err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT"," " while querying blk_start(" PTR_FORMAT ")" " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")", - n, last, addr, _sp->bottom(), _sp->end())); + p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end()))); } assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")", - q, addr)); + p2i(q), p2i(addr))); assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", - addr, n)); + p2i(addr), p2i(n))); return q; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/cardTableModRefBS.cpp --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -138,11 +138,11 @@ gclog_or_tty->print_cr(" " " &_byte_map[0]: " INTPTR_FORMAT " &_byte_map[_last_valid_index]: " INTPTR_FORMAT, - &_byte_map[0], - &_byte_map[_last_valid_index]); + p2i(&_byte_map[0]), + p2i(&_byte_map[_last_valid_index])); gclog_or_tty->print_cr(" " " byte_map_base: " INTPTR_FORMAT, - byte_map_base); + p2i(byte_map_base)); } } @@ -392,23 +392,23 @@ gclog_or_tty->print_cr(" " " _covered[%d].start(): " INTPTR_FORMAT " _covered[%d].last(): " INTPTR_FORMAT, - ind, _covered[ind].start(), - ind, _covered[ind].last()); + ind, p2i(_covered[ind].start()), + ind, p2i(_covered[ind].last())); gclog_or_tty->print_cr(" " " _committed[%d].start(): " INTPTR_FORMAT " _committed[%d].last(): " INTPTR_FORMAT, - ind, _committed[ind].start(), - ind, _committed[ind].last()); + ind, p2i(_committed[ind].start()), + ind, p2i(_committed[ind].last())); gclog_or_tty->print_cr(" " " byte_for(start): " INTPTR_FORMAT " byte_for(last): " INTPTR_FORMAT, - byte_for(_covered[ind].start()), - byte_for(_covered[ind].last())); + p2i(byte_for(_covered[ind].start())), + p2i(byte_for(_covered[ind].last()))); gclog_or_tty->print_cr(" " " addr_for(start): " INTPTR_FORMAT " addr_for(last): " INTPTR_FORMAT, - addr_for((jbyte*) _committed[ind].start()), - addr_for((jbyte*) _committed[ind].last())); + p2i(addr_for((jbyte*) _committed[ind].start())), + p2i(addr_for((jbyte*) _committed[ind].last()))); } // Touch the last card of the covered region to show that it // is committed (or SEGV). @@ -657,14 +657,14 @@ if (failed) { if (!failures) { tty->cr(); - tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]", start, end); + tty->print_cr("== CT verification failed: [" INTPTR_FORMAT "," INTPTR_FORMAT "]", p2i(start), p2i(end)); tty->print_cr("== %sexpecting value: %d", (val_equals) ? "" : "not ", val); failures = true; } tty->print_cr("== card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], " - "val: %d", curr, addr_for(curr), - (HeapWord*) (((size_t) addr_for(curr)) + card_size), + "val: %d", p2i(curr), p2i(addr_for(curr)), + p2i((HeapWord*) (((size_t) addr_for(curr)) + card_size)), (int) curr_val); } } @@ -682,7 +682,7 @@ void CardTableModRefBS::print_on(outputStream* st) const { st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT, - _byte_map, _byte_map + _byte_map_size, byte_map_base); + p2i(_byte_map), p2i(_byte_map + _byte_map_size), p2i(byte_map_base)); } bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/cardTableModRefBS.hpp --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,7 +155,7 @@ assert(_whole_heap.contains(p), err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of " " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", - p, _whole_heap.start(), _whole_heap.end())); + p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; assert(result >= _byte_map && result < _byte_map + _byte_map_size, "out of bounds accessor for card marking array"); @@ -431,7 +431,7 @@ assert(_whole_heap.contains(result), err_msg("Returning result = "PTR_FORMAT" out of bounds of " " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", - result, _whole_heap.start(), _whole_heap.end())); + p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); return result; } @@ -440,7 +440,7 @@ assert(_whole_heap.contains(p), err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of " " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", - p, _whole_heap.start(), _whole_heap.end())); + p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); return byte_for(p) - _byte_map; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/cardTableRS.cpp --- a/hotspot/src/share/vm/memory/cardTableRS.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -288,14 +288,14 @@ err_msg("Did you forget to call save_marks()? " "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " "[" PTR_FORMAT ", " PTR_FORMAT ")", - urasm.start(), urasm.end(), ur.start(), ur.end())); + p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()))); // In the case of CMS+ParNew, issue a warning if (!ur.contains(urasm)) { assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above"); warning("CMS+ParNew: Did you forget to call save_marks()? " "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " "[" PTR_FORMAT ", " PTR_FORMAT ")", - urasm.start(), urasm.end(), ur.start(), ur.end()); + p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())); MemRegion ur2 = sp->used_region(); MemRegion urasm2 = sp->used_region_at_save_marks(); if (!ur.equals(ur2)) { @@ -349,12 +349,12 @@ assert(jp >= _begin && jp < _end, err_msg("Error: jp " PTR_FORMAT " should be within " "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", - jp, _begin, _end)); + p2i(jp), p2i(_begin), p2i(_end))); oop obj = oopDesc::load_decode_heap_oop(p); guarantee(obj == NULL || (HeapWord*)obj >= _boundary, err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on " "clean card crosses boundary" PTR_FORMAT, - (HeapWord*)obj, jp, _boundary)); + p2i((HeapWord*)obj), p2i(jp), p2i(_boundary))); } public: @@ -362,10 +362,10 @@ _boundary(b), _begin(begin), _end(end) { assert(b <= begin, err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT, - b, begin)); + p2i(b), p2i(begin))); assert(begin <= end, err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT, - begin, end)); + p2i(begin), p2i(end))); } virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/collectorPolicy.cpp --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -736,7 +736,7 @@ if ((QueuedAllocationWarningCount > 0) && (try_count % QueuedAllocationWarningCount == 0)) { warning("TwoGenerationCollectorPolicy::mem_allocate_work retries %d times \n\t" - " size=%d %s", try_count, size, is_tlab ? "(TLAB)" : ""); + " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : ""); } } } @@ -903,7 +903,7 @@ if ((QueuedAllocationWarningCount > 0) && (loop_count % QueuedAllocationWarningCount == 0)) { warning("satisfy_failed_metadata_allocation() retries %d times \n\t" - " size=%d", loop_count, word_size); + " size=" SIZE_FORMAT, loop_count, word_size); } } while (true); // Until a GC is done } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/defNewGeneration.cpp --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/stack.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // // DefNewGeneration functions. diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/filemap.cpp --- a/hotspot/src/share/vm/memory/filemap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/filemap.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ #define O_BINARY 0 // otherwise do nothing. #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC extern address JVM_FunctionAtStart(); extern address JVM_FunctionAtEnd(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/gcLocker.cpp --- a/hotspot/src/share/vm/memory/gcLocker.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/gcLocker.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ tty->print_cr("critical counts don't match: %d != %d", _jni_lock_count, count); for (JavaThread* thr = Threads::first(); thr; thr = thr->next()) { if (thr->in_critical()) { - tty->print_cr(INTPTR_FORMAT " in_critical %d", thr, thr->in_critical()); + tty->print_cr(INTPTR_FORMAT " in_critical %d", p2i(thr), thr->in_critical()); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/genCollectedHeap.cpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -794,7 +794,7 @@ bool GenCollectedHeap::is_in_young(oop p) { bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start(); assert(result == _gens[0]->is_in_reserved(p), - err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p)); + err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p))); return result; } @@ -1067,7 +1067,7 @@ for (int i = _n_gens-1; i >= 0; i--) { Generation* g = _gens[i]; if (!silent) { - gclog_or_tty->print(g->name()); + gclog_or_tty->print("%s", g->name()); gclog_or_tty->print(" "); } g->verify(); @@ -1270,7 +1270,7 @@ // back a time later than 'now'. jlong retVal = now - tolgc_cl.time(); if (retVal < 0) { - NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);) + NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);) return 0; } return retVal; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/genOopClosures.hpp --- a/hotspot/src/share/vm/memory/genOopClosures.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/genOopClosures.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -193,7 +193,7 @@ protected: template inline void do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); - guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, (oopDesc*) obj)); + guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj))); } public: virtual void do_oop(oop* p); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/generation.cpp --- a/hotspot/src/share/vm/memory/generation.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/generation.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,8 @@ #include "utilities/copy.hpp" #include "utilities/events.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : _level(level), _ref_processor(NULL) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/generation.hpp --- a/hotspot/src/share/vm/memory/generation.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/generation.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -422,7 +422,7 @@ // have to guard against non-monotonicity. NOT_PRODUCT( if (now < _time_of_last_gc) { - warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now); + warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, (int64_t)_time_of_last_gc, (int64_t)now); } ) return _time_of_last_gc; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/heapInspection.cpp --- a/hotspot/src/share/vm/memory/heapInspection.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/heapInspection.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // HeapInspection int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) { @@ -270,6 +272,7 @@ return true; } +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void KlassInfoHisto::print_title(outputStream* st, bool csv_format, bool selected[], int width_table[], const char *name_table[]) { @@ -282,7 +285,10 @@ } else { st->print("Index Super"); for (int c=0; cprint(str_fmt(width_table[c]), name_table[c]);} +PRAGMA_DIAG_POP } st->print(" ClassName"); } @@ -395,12 +401,18 @@ case KlassSizeStats::_index_inst_size: case KlassSizeStats::_index_inst_count: case KlassSizeStats::_index_method_count: +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(str_fmt(width_table[c]), "-"); +PRAGMA_DIAG_POP break; default: { double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(perc_fmt(width_table[c]), perc); +PRAGMA_DIAG_POP } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/heapInspection.hpp --- a/hotspot/src/share/vm/memory/heapInspection.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/heapInspection.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -295,6 +295,9 @@ // returns a format string to print a julong with the given width. E.g, // printf(num_fmt(6), julong(10)) would print out the number 10 with 4 // leading spaces. +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED + static void print_julong(outputStream* st, int width, julong n) { int num_spaces = width - julong_width(n); if (num_spaces > 0) { @@ -302,6 +305,7 @@ } st->print(JULONG_FORMAT, n); } +PRAGMA_DIAG_POP static char* perc_fmt(int width) { static char buf[32]; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/metachunk.cpp --- a/hotspot/src/share/vm/memory/metachunk.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/metachunk.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ #include "utilities/copy.hpp" #include "utilities/debug.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class VirtualSpaceNode; const size_t metadata_chunk_initialize = 0xf7f7f7f7; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/metaspace.cpp --- a/hotspot/src/share/vm/memory/metaspace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/metaspace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,8 @@ #include "utilities/copy.hpp" #include "utilities/debug.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + typedef BinaryTreeDictionary > BlockTreeDictionary; typedef BinaryTreeDictionary > ChunkTreeDictionary; @@ -1961,7 +1963,7 @@ st->print_cr(" free " SIZE_FORMAT, chunk->free_word_size()); } else { - st->print_cr(""); + st->cr(); } } @@ -2245,7 +2247,7 @@ humongous_chunks = next_humongous_chunks; } if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("updated dictionary count %d %s", chunk_manager()->humongous_dictionary()->total_count(), chunk_size_name(HumongousIndex)); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/metaspaceShared.cpp --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ #include "runtime/vmThread.hpp" #include "utilities/hashtable.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC int MetaspaceShared::_max_alignment = 0; @@ -337,13 +338,14 @@ int all_rw_count = 0; int all_rw_bytes = 0; - const char *fmt = "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"; +// To make fmt_stats be a syntactic constant (for format warnings), use #define. +#define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f" const char *sep = "--------------------+---------------------------+---------------------------+--------------------------"; const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %"; tty->print_cr("Detailed metadata info (rw includes md and mc):"); - tty->print_cr(hdr); - tty->print_cr(sep); + tty->print_cr("%s", hdr); + tty->print_cr("%s", sep); for (int type = 0; type < int(_number_of_types); type ++) { const char *name = type_name((Type)type); int ro_count = _counts[RO][type]; @@ -357,7 +359,7 @@ double rw_perc = 100.0 * double(rw_bytes) / double(rw_all); double perc = 100.0 * double(bytes) / double(ro_all + rw_all); - tty->print_cr(fmt, name, + tty->print_cr(fmt_stats, name, ro_count, ro_bytes, ro_perc, rw_count, rw_bytes, rw_perc, count, bytes, perc); @@ -375,14 +377,15 @@ double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all); double all_perc = 100.0 * double(all_bytes) / double(ro_all + rw_all); - tty->print_cr(sep); - tty->print_cr(fmt, "Total", + tty->print_cr("%s", sep); + tty->print_cr(fmt_stats, "Total", all_ro_count, all_ro_bytes, all_ro_perc, all_rw_count, all_rw_bytes, all_rw_perc, all_count, all_bytes, all_perc); assert(all_ro_bytes == ro_all, "everything should have been counted"); assert(all_rw_bytes == rw_all, "everything should have been counted"); +#undef fmt_stats } // Populate the shared space. @@ -514,7 +517,8 @@ md_top = wc.get_top(); // Print shared spaces all the time - const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT; +// To make fmt_space be a syntactic constant (for format warnings), use #define. +#define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " INTPTR_FORMAT Metaspace* ro_space = _loader_data->ro_metaspace(); Metaspace* rw_space = _loader_data->rw_metaspace(); @@ -545,10 +549,10 @@ const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0; const double total_u_perc = total_bytes / double(total_alloced) * 100.0; - tty->print_cr(fmt, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom()); - tty->print_cr(fmt, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom()); - tty->print_cr(fmt, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low); - tty->print_cr(fmt, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low); + tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom()); + tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom()); + tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low); + tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low); tty->print_cr("total : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]", total_bytes, total_alloced, total_u_perc); @@ -603,6 +607,7 @@ dac.dump_stats(int(ro_bytes), int(rw_bytes), int(md_bytes), int(mc_bytes)); } +#undef fmt_space } static void link_shared_classes(Klass* obj, TRAPS) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/referenceProcessor.cpp --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include "runtime/java.hpp" #include "runtime/jniHandles.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; bool ReferenceProcessor::_pending_list_uses_discovered_field = false; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/sharedHeap.cpp --- a/hotspot/src/share/vm/memory/sharedHeap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ #include "utilities/copy.hpp" #include "utilities/workgroup.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + SharedHeap* SharedHeap::_sh; // The set of potentially parallel tasks in strong root scanning. diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/space.cpp --- a/hotspot/src/share/vm/memory/space.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/space.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top, HeapWord* top_obj) { if (top_obj != NULL) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ #include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Thread-Local Edens support // static member initialization diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,7 +98,7 @@ " obj: "SIZE_FORMAT " free: "SIZE_FORMAT " waste: "SIZE_FORMAT"\n", - "slow", thrd, thrd->osthread()->thread_id(), + "slow", p2i(thrd), thrd->osthread()->thread_id(), obj_size, free(), refill_waste_limit()); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/memory/universe.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,6 +78,8 @@ #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Known objects Klass* Universe::_boolArrayKlassObj = NULL; Klass* Universe::_byteArrayKlassObj = NULL; @@ -1348,7 +1350,7 @@ HandleMark hm; // Handles created during verification can be zapped _verify_count++; - if (!silent) gclog_or_tty->print(prefix); + if (!silent) gclog_or_tty->print("%s", prefix); if (!silent) gclog_or_tty->print("[Verifying "); if (!silent) gclog_or_tty->print("threads "); Threads::verify(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/annotations.cpp --- a/hotspot/src/share/vm/oops/annotations.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/annotations.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ void Annotations::print_value_on(outputStream* st) const { - st->print("Anotations(" INTPTR_FORMAT ")", this); + st->print("Anotations(" INTPTR_FORMAT ")", p2i(this)); } #if INCLUDE_SERVICES diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/constMethod.cpp --- a/hotspot/src/share/vm/oops/constMethod.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/constMethod.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -388,8 +388,8 @@ void ConstMethod::print_on(outputStream* st) const { ResourceMark rm; assert(is_constMethod(), "must be constMethod"); - st->print_cr(internal_name()); - st->print(" - method: " INTPTR_FORMAT " ", (address)method()); + st->print_cr("%s", internal_name()); + st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method())); method()->print_value_on(st); st->cr(); if (has_stackmap_table()) { st->print(" - stackmap data: "); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/constantPool.cpp --- a/hotspot/src/share/vm/oops/constantPool.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/constantPool.cpp Fri May 09 16:50:54 2014 -0400 @@ -42,6 +42,8 @@ #include "runtime/signature.hpp" #include "runtime/vframe.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) { // Tags are RW but comment below applies to tags also. Array* tags = MetadataFactory::new_writeable_array(loader_data, length, 0, CHECK_NULL); @@ -1892,7 +1894,7 @@ void ConstantPool::print_on(outputStream* st) const { assert(is_constantPool(), "must be constantPool"); - st->print_cr(internal_name()); + st->print_cr("%s", internal_name()); if (flags() != 0) { st->print(" - flags: 0x%x", flags()); if (has_preresolution()) st->print(" has_preresolution"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/cpCache.cpp --- a/hotspot/src/share/vm/oops/cpCache.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/cpCache.cpp Fri May 09 16:50:54 2014 -0400 @@ -39,8 +39,9 @@ # include "gc_implementation/parallelScavenge/psPromotionManager.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -// Implememtation of ConstantPoolCacheEntry +// Implementation of ConstantPoolCacheEntry void ConstantPoolCacheEntry::initialize_entry(int index) { assert(0 < index && index < 0x10000, "sanity check"); @@ -668,7 +669,7 @@ void ConstantPoolCache::print_on(outputStream* st) const { assert(is_constantPoolCache(), "obj must be constant pool cache"); - st->print_cr(internal_name()); + st->print_cr("%s", internal_name()); // print constant pool cache entries for (int i = 0; i < length(); i++) entry_at(i)->print(st, i); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/generateOopMap.hpp --- a/hotspot/src/share/vm/oops/generateOopMap.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/generateOopMap.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -412,9 +412,9 @@ int copy_cts (CellTypeState *dst, CellTypeState *src); // Error handling - void error_work (const char *format, va_list ap); - void report_error (const char *format, ...); - void verify_error (const char *format, ...); + void error_work (const char *format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void report_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3); + void verify_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3); bool got_error() { return _got_error; } // Create result set diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/instanceKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlass.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Fri May 09 16:50:54 2014 -0400 @@ -77,6 +77,8 @@ #include "c1/c1_Compiler.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef DTRACE_ENABLED @@ -2857,7 +2859,7 @@ st->print(BULLET"instance size: %d", size_helper()); st->cr(); st->print(BULLET"klass size: %d", size()); st->cr(); st->print(BULLET"access: "); access_flags().print_on(st); st->cr(); - st->print(BULLET"state: "); st->print_cr(state_names[_init_state]); + st->print(BULLET"state: "); st->print_cr("%s", state_names[_init_state]); st->print(BULLET"name: "); name()->print_value_on(st); st->cr(); st->print(BULLET"super: "); super()->print_value_on_maybe_null(st); st->cr(); st->print(BULLET"sub: "); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/instanceRefKlass.cpp --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,8 @@ #include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + template void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) { T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/klass.inline.hpp --- a/hotspot/src/share/vm/oops/klass.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/klass.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ assert(!is_null(v), "narrow klass value can never be zero"); int shift = Universe::narrow_klass_shift(); Klass* result = (Klass*)(void*)((uintptr_t)Universe::narrow_klass_base() + ((uintptr_t)v << shift)); - assert(check_klass_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result)); + assert(check_klass_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result))); return result; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/klassVtable.cpp --- a/hotspot/src/share/vm/oops/klassVtable.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/klassVtable.cpp Fri May 09 16:50:54 2014 -0400 @@ -39,6 +39,8 @@ #include "runtime/handles.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + inline InstanceKlass* klassVtable::ik() const { Klass* k = _klass(); assert(k->oop_is_instance(), "not an InstanceKlass"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/markOop.cpp --- a/hotspot/src/share/vm/oops/markOop.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/markOop.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,9 +26,11 @@ #include "oops/markOop.hpp" #include "runtime/thread.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void markOopDesc::print_on(outputStream* st) const { if (is_locked()) { - st->print("locked(0x%lx)->", value()); + st->print("locked(" INTPTR_FORMAT ")->", value()); markOop(*(markOop*)value())->print_on(st); } else { assert(is_unlocked() || has_bias_pattern(), "just checking"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/method.cpp --- a/hotspot/src/share/vm/oops/method.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/method.cpp Fri May 09 16:50:54 2014 -0400 @@ -56,6 +56,7 @@ #include "utilities/quickSort.hpp" #include "utilities/xmlstream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of Method @@ -1425,7 +1426,7 @@ void type_name(const char* name) { if (_use_separator) _st->print(", "); - _st->print(name); + _st->print("%s", name); _use_separator = true; } @@ -1898,7 +1899,7 @@ void Method::print_on(outputStream* st) const { ResourceMark rm; assert(is_method(), "must be method"); - st->print_cr(internal_name()); + st->print_cr("%s", internal_name()); // get the effect of PrintOopAddress, always, for methods: st->print_cr(" - this oop: "INTPTR_FORMAT, (intptr_t)this); st->print (" - method holder: "); method_holder()->print_value_on(st); st->cr(); @@ -1981,7 +1982,7 @@ void Method::print_value_on(outputStream* st) const { assert(is_method(), "must be method"); - st->print(internal_name()); + st->print("%s", internal_name()); print_address_on(st); st->print(" "); name()->print_value_on(st); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/methodData.cpp --- a/hotspot/src/share/vm/oops/methodData.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/methodData.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,8 @@ #include "runtime/handles.inline.hpp" #include "runtime/orderAccess.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // ================================================================== // DataLayout // @@ -127,7 +129,7 @@ st->print("trap(%s) ", Deoptimization::format_trap_state(buf, sizeof(buf), trap)); } if (extra != NULL) { - st->print(extra); + st->print("%s", extra); } int flags = data()->flags(); if (flags != 0) { @@ -635,7 +637,7 @@ } void ParametersTypeData::print_data_on(outputStream* st, const char* extra) const { - st->print("parameter types", extra); + st->print("parameter types"); // FIXME extra ignored? _parameters.print_data_on(st); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/oop.cpp --- a/hotspot/src/share/vm/oops/oop.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/oop.cpp Fri May 09 16:50:54 2014 -0400 @@ -30,6 +30,8 @@ #include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + bool always_do_update_barrier = false; BarrierSet* oopDesc::_bs = NULL; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/oops/oop.inline.hpp --- a/hotspot/src/share/vm/oops/oop.inline.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/oops/oop.inline.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,7 +211,7 @@ address base = Universe::narrow_oop_base(); int shift = Universe::narrow_oop_shift(); oop result = (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift)); - assert(check_obj_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result)); + assert(check_obj_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result))); return result; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/block.cpp --- a/hotspot/src/share/vm/opto/block.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/block.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -339,7 +339,7 @@ st->print(" FRegPressure: %d",_freg_pressure); st->print(" FHRP Index: %d",_fhrp_index); } - st->print_cr(""); + st->cr(); } void Block::dump() const { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/callnode.cpp --- a/hotspot/src/share/vm/opto/callnode.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/callnode.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -112,7 +112,7 @@ #ifndef PRODUCT void ParmNode::dump_spec(outputStream *st) const { if( _con < TypeFunc::Parms ) { - st->print(names[_con]); + st->print("%s", names[_con]); } else { st->print("Parm%d: ",_con-TypeFunc::Parms); // Verbose and WizardMode dump bottom_type for all nodes @@ -348,19 +348,19 @@ break; case Type::AryPtr: case Type::InstPtr: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->isa_oopptr()->const_oop()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->isa_oopptr()->const_oop())); break; case Type::KlassPtr: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_klassptr()->klass()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_klassptr()->klass())); break; case Type::MetadataPtr: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_metadataptr()->metadata()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_metadataptr()->metadata())); break; case Type::NarrowOop: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_oopptr()->const_oop()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_oopptr()->const_oop())); break; case Type::RawPtr: - st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,t->is_rawptr()); + st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,p2i(t->is_rawptr())); break; case Type::DoubleCon: st->print(" %s%d]=#%fD",msg,i,t->is_double_constant()->_d); @@ -369,7 +369,7 @@ st->print(" %s%d]=#%fF",msg,i,t->is_float_constant()->_f); break; case Type::Long: - st->print(" %s%d]=#"INT64_FORMAT,msg,i,t->is_long()->get_con()); + st->print(" %s%d]=#"INT64_FORMAT,msg,i,(int64_t)(t->is_long()->get_con())); break; case Type::Half: case Type::Top: @@ -428,7 +428,7 @@ for (i = 0; i < (uint)scobjs.length(); i++) { // Scalar replaced objects. - st->print_cr(""); + st->cr(); st->print(" # ScObj" INT32_FORMAT " ", i); SafePointScalarObjectNode* spobj = scobjs.at(i); ciKlass* cik = spobj->bottom_type()->is_oopptr()->klass(); @@ -485,7 +485,7 @@ st->print(" }"); } } - st->print_cr(""); + st->cr(); if (caller() != NULL) caller()->format(regalloc, n, st); } @@ -981,7 +981,7 @@ #ifndef PRODUCT void CallRuntimeNode::dump_spec(outputStream *st) const { st->print("# "); - st->print(_name); + st->print("%s", _name); CallNode::dump_spec(st); } #endif @@ -999,7 +999,7 @@ #ifndef PRODUCT void CallLeafNode::dump_spec(outputStream *st) const { st->print("# "); - st->print(_name); + st->print("%s", _name); CallNode::dump_spec(st); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/chaitin.cpp --- a/hotspot/src/share/vm/opto/chaitin.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/chaitin.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2020,25 +2020,25 @@ tty->print_cr("new LRG"); } } - tty->print_cr(""); + tty->cr(); // Dump lo-degree list tty->print("Lo degree: "); for(uint i3 = _lo_degree; i3; i3 = lrgs(i3)._next ) tty->print("L%d ",i3); - tty->print_cr(""); + tty->cr(); // Dump lo-stk-degree list tty->print("Lo stk degree: "); for(uint i4 = _lo_stk_degree; i4; i4 = lrgs(i4)._next ) tty->print("L%d ",i4); - tty->print_cr(""); + tty->cr(); // Dump lo-degree list tty->print("Hi degree: "); for(uint i5 = _hi_degree; i5; i5 = lrgs(i5)._next ) tty->print("L%d ",i5); - tty->print_cr(""); + tty->cr(); } void PhaseChaitin::dump_degree_lists() const { @@ -2046,26 +2046,26 @@ tty->print("Lo degree: "); for( uint i = _lo_degree; i; i = lrgs(i)._next ) tty->print("L%d ",i); - tty->print_cr(""); + tty->cr(); // Dump lo-stk-degree list tty->print("Lo stk degree: "); for(uint i2 = _lo_stk_degree; i2; i2 = lrgs(i2)._next ) tty->print("L%d ",i2); - tty->print_cr(""); + tty->cr(); // Dump lo-degree list tty->print("Hi degree: "); for(uint i3 = _hi_degree; i3; i3 = lrgs(i3)._next ) tty->print("L%d ",i3); - tty->print_cr(""); + tty->cr(); } void PhaseChaitin::dump_simplified() const { tty->print("Simplified: "); for( uint i = _simplified; i; i = lrgs(i)._next ) tty->print("L%d ",i); - tty->print_cr(""); + tty->cr(); } static char *print_reg( OptoReg::Name reg, const PhaseChaitin *pc, char *buf ) { @@ -2144,7 +2144,7 @@ } tty->print(" : parm %d: ", k); domain->field_at(k + TypeFunc::Parms)->dump(); - tty->print_cr(""); + tty->cr(); } } @@ -2166,7 +2166,7 @@ _matcher._parm_regs[j].second() == reg ) { tty->print("parm %d: ",j); domain->field_at(j + TypeFunc::Parms)->dump(); - tty->print_cr(""); + tty->cr(); break; } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/compile.cpp --- a/hotspot/src/share/vm/opto/compile.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/compile.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2424,7 +2424,7 @@ starts_bundle = ' '; tty->print("\t"); delay->format(_regalloc, tty); - tty->print_cr(""); + tty->cr(); delay = NULL; } @@ -2438,12 +2438,12 @@ if (pcs && n->_idx < pc_limit) tty->print_cr("%3.3x", pcs[n->_idx]); else - tty->print_cr(""); + tty->cr(); assert(cut_short || delay == NULL, "no unconditional delay branch"); } // End of per-block dump - tty->print_cr(""); + tty->cr(); if (cut_short) tty->print_cr("*** disassembly is cut short ***"); } @@ -3688,7 +3688,8 @@ default: ShouldNotReachHere(); } assert(constant_addr, "consts section too small"); - assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset())); + assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), + err_msg_res("must be: %d == %d", (int) (constant_addr - _masm.code()->consts()->start()), (int)(con.offset()))); } } @@ -3768,7 +3769,7 @@ for (uint i = 0; i < n->outcnt(); i++) { address* constant_addr = &jump_table_base[i]; - assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i))); + assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, p2i(*constant_addr), p2i(((address) n) + i))); *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr); cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); } @@ -3884,7 +3885,7 @@ } if (do_print_inlining) { for (int i = 0; i < _print_inlining_list->length(); i++) { - tty->print(_print_inlining_list->adr_at(i)->ss()->as_string()); + tty->print("%s", _print_inlining_list->adr_at(i)->ss()->as_string()); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/compile.hpp --- a/hotspot/src/share/vm/opto/compile.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/compile.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -459,7 +459,7 @@ void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) { stringStream ss; CompileTask::print_inlining(&ss, method, inline_level, bci, msg); - print_inlining_stream()->print(ss.as_string()); + print_inlining_stream()->print("%s", ss.as_string()); } void log_late_inline(CallGenerator* cg); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/doCall.cpp --- a/hotspot/src/share/vm/opto/doCall.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/doCall.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); stringStream ss; prof_klass->name()->print_symbol_on(&ss); - out->print(ss.as_string()); + out->print("%s", ss.as_string()); out->cr(); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/gcm.cpp --- a/hotspot/src/share/vm/opto/gcm.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/gcm.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2014,7 +2014,7 @@ tty->print("%s: %d trip_count: %6.0f freq: %6.0f\n", _depth == 0 ? "Method" : "Loop", _id, trip_count(), _freq); for (int i = 0; i < _depth; i++) tty->print(" "); - tty->print(" members:", _id); + tty->print(" members:"); int k = 0; for (int i = 0; i < _members.length(); i++) { if (k++ >= 6) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/idealGraphPrinter.cpp --- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,7 +155,7 @@ } else { // It would be nice if we could shut down cleanly but it should // be an error if we can't connect to the visualizer. - fatal(err_msg_res("Couldn't connect to visualizer at %s:%d", + fatal(err_msg_res("Couldn't connect to visualizer at %s:" INTX_FORMAT, PrintIdealGraphAddress, PrintIdealGraphPort)); } } @@ -195,7 +195,7 @@ void IdealGraphPrinter::begin_elem(const char *s) { - _xml->begin_elem(s); + _xml->begin_elem("%s", s); } void IdealGraphPrinter::end_elem() { @@ -203,7 +203,7 @@ } void IdealGraphPrinter::begin_head(const char *s) { - _xml->begin_head(s); + _xml->begin_head("%s", s); } void IdealGraphPrinter::end_head() { @@ -223,7 +223,7 @@ } void IdealGraphPrinter::head(const char *name) { - _xml->head(name); + _xml->head("%s", name); } void IdealGraphPrinter::tail(const char *name) { @@ -231,7 +231,7 @@ } void IdealGraphPrinter::text(const char *s) { - _xml->text(s); + _xml->text("%s", s); } void IdealGraphPrinter::print_prop(const char *name, int val) { @@ -359,7 +359,7 @@ void IdealGraphPrinter::print_indent() { tty->print_cr("printing ident %d", _depth); for (int i = 0; i < _depth; i++) { - _xml->print(INDENT); + _xml->print("%s", INDENT); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/ifg.cpp --- a/hotspot/src/share/vm/opto/ifg.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/ifg.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -256,7 +256,7 @@ for( i = 0; i < _maxlrg*2; i++ ) if( h_cnt[i] ) tty->print("%d/%d ",i,h_cnt[i]); - tty->print_cr(""); + tty->cr(); } void PhaseIFG::verify( const PhaseChaitin *pc ) const { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/loopPredicate.cpp --- a/hotspot/src/share/vm/opto/loopPredicate.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/loopPredicate.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -639,7 +639,7 @@ if (TraceLoopPredicate) { predString->print_cr("print(predString->as_string()); + tty->print("%s", predString->as_string()); } return bol; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/loopnode.cpp --- a/hotspot/src/share/vm/opto/loopnode.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/loopnode.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3569,7 +3569,7 @@ #ifdef ASSERT void PhaseIdealLoop::dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA) { - tty->print_cr(msg); + tty->print_cr("%s", msg); tty->print("n: "); n->dump(); tty->print("early(n): "); early->dump(); if (n->in(0) != NULL && !n->in(0)->is_top() && diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/matcher.cpp --- a/hotspot/src/share/vm/opto/matcher.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/matcher.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2622,7 +2622,7 @@ tty->print_cr("%s %d %s", ruleName[i], _cost[i], ruleName[_rule[i]] ); } - tty->print_cr(""); + tty->cr(); for( i=0; i<2; i++ ) if( _kids[i] ) diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/memnode.cpp --- a/hotspot/src/share/vm/opto/memnode.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/memnode.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3981,7 +3981,7 @@ intptr_t st_off = get_store_offset(st, phase); if (st_off < 0) continue; // ignore dead garbage if (last_off > st_off) { - tty->print_cr("*** bad store offset at %d: %d > %d", i, last_off, st_off); + tty->print_cr("*** bad store offset at %d: " INTX_FORMAT " > " INTX_FORMAT, i, last_off, st_off); this->dump(2); assert(false, "ascending store offsets"); return false; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/node.cpp --- a/hotspot/src/share/vm/opto/node.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/node.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1688,7 +1688,7 @@ } } } - if (suffix) st->print(suffix); + if (suffix) st->print("%s", suffix); C->_in_dump_cnt--; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/parse1.cpp --- a/hotspot/src/share/vm/opto/parse1.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/parse1.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -611,7 +611,7 @@ set_map(entry_map); do_exits(); - if (log) log->done("parse nodes='%d' live='%d' memory='%d'", + if (log) log->done("parse nodes='%d' live='%d' memory='" SIZE_FORMAT "'", C->unique(), C->live_nodes(), C->node_arena()->used()); } @@ -1395,7 +1395,7 @@ tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->rpo()); } if (b->is_loop_head()) tty->print(" lphd"); - tty->print_cr(""); + tty->cr(); } assert(block()->is_merged(), "must be merged before being parsed"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/parse2.cpp --- a/hotspot/src/share/vm/opto/parse2.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/parse2.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -628,7 +628,7 @@ _method->print_short_name(); tty->print_cr(" switch decision tree"); tty->print_cr(" %d ranges (%d singletons), max_depth=%d, est_depth=%d", - hi-lo+1, nsing, _max_switch_depth, _est_switch_depth); + (int) (hi-lo+1), nsing, _max_switch_depth, _est_switch_depth); if (_max_switch_depth > _est_switch_depth) { tty->print_cr("******** BAD SWITCH DEPTH ********"); } @@ -636,7 +636,7 @@ for( r = lo; r <= hi; r++ ) { r->print(); } - tty->print_cr(""); + tty->cr(); } #endif } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/phaseX.cpp --- a/hotspot/src/share/vm/opto/phaseX.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/phaseX.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -958,10 +958,10 @@ if (VerifyIterativeGVN && PrintOpto) { if (_verify_counter == _verify_full_passes) { tty->print_cr("VerifyIterativeGVN: %d transforms and verify passes", - _verify_full_passes); + (int) _verify_full_passes); } else { tty->print_cr("VerifyIterativeGVN: %d transforms, %d full verify passes", - _verify_counter, _verify_full_passes); + (int) _verify_counter, (int) _verify_full_passes); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/regmask.cpp --- a/hotspot/src/share/vm/opto/regmask.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/regmask.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,7 +116,7 @@ case Special: st->print("r---"); break; case Bad: st->print("rBAD"); break; default: - if (r < _last_Mach_Reg) st->print(Matcher::regName[r]); + if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]); else st->print("rS%d",r); break; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/runtime.cpp --- a/hotspot/src/share/vm/opto/runtime.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/runtime.cpp Fri May 09 16:50:54 2014 -0400 @@ -1393,7 +1393,7 @@ } else { tty->print(""); } - tty->print(" at " INTPTR_FORMAT, exception_pc); + tty->print(" at " INTPTR_FORMAT, p2i(exception_pc)); tty->print_cr("]"); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/subnode.cpp --- a/hotspot/src/share/vm/opto/subnode.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/subnode.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1065,7 +1065,7 @@ #ifndef PRODUCT void BoolTest::dump_on(outputStream *st) const { const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"}; - st->print(msg[_test]); + st->print("%s", msg[_test]); } #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/opto/type.cpp --- a/hotspot/src/share/vm/opto/type.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/opto/type.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,8 @@ #include "opto/opcodes.hpp" #include "opto/type.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Portions of code courtesy of Clifford Click // Optimization - Graph Style @@ -842,7 +844,7 @@ #ifndef PRODUCT //------------------------------dump2------------------------------------------ void Type::dump2( Dict &d, uint depth, outputStream *st ) const { - st->print(_type_info[_base].msg); + st->print("%s", _type_info[_base].msg); } //------------------------------dump------------------------------------------- diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/prims/jni.cpp Fri May 09 16:50:54 2014 -0400 @@ -275,7 +275,7 @@ class JNITraceWrapper : public StackObj { public: - JNITraceWrapper(const char* format, ...) { + JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { if (TraceJNICalls) { va_list ap; va_start(ap, format); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/prims/jniCheck.cpp --- a/hotspot/src/share/vm/prims/jniCheck.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/prims/jniCheck.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,7 +100,7 @@ result_type JNICALL header { \ JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\ if (thr == NULL || !thr->is_Java_thread()) { \ - tty->print_cr(fatal_using_jnienv_in_nonjava); \ + tty->print_cr("%s", fatal_using_jnienv_in_nonjava); \ os::abort(true); \ } \ JNIEnv* xenv = thr->jni_environment(); \ @@ -184,7 +184,7 @@ functionEnter(JavaThread* thr) { if (thr->in_critical()) { - tty->print_cr(warn_other_function_in_critical); + tty->print_cr("%s", warn_other_function_in_critical); } if (thr->has_pending_exception()) { NativeReportJNIWarning(thr, "JNI call made with exception pending"); @@ -195,7 +195,7 @@ functionEnterExceptionAllowed(JavaThread* thr) { if (thr->in_critical()) { - tty->print_cr(warn_other_function_in_critical); + tty->print_cr("%s", warn_other_function_in_critical); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/prims/jvm.cpp --- a/hotspot/src/share/vm/prims/jvm.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/prims/jvm.cpp Fri May 09 16:50:54 2014 -0400 @@ -215,7 +215,7 @@ #ifdef ASSERT class JVMTraceWrapper : public StackObj { public: - JVMTraceWrapper(const char* format, ...) { + JVMTraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { if (TraceJVMCalls) { va_list ap; va_start(ap, format); @@ -2736,14 +2736,14 @@ JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence)) - JVMWrapper4("JVM_Lseek (0x%x, %Ld, %d)", fd, offset, whence); + JVMWrapper4("JVM_Lseek (0x%x, " INT64_FORMAT ", %d)", fd, (int64_t) offset, whence); //%note jvm_r6 return os::lseek(fd, offset, whence); JVM_END JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length)) - JVMWrapper3("JVM_SetLength (0x%x, %Ld)", fd, length); + JVMWrapper3("JVM_SetLength (0x%x, " INT64_FORMAT ")", fd, (int64_t) length); return os::ftruncate(fd, length); JVM_END @@ -2758,13 +2758,14 @@ // Printing support ////////////////////////////////////////////////// extern "C" { +ATTRIBUTE_PRINTF(3, 0) int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) { // see bug 4399518, 4417214 if ((intptr_t)count <= 0) return -1; return vsnprintf(str, count, fmt, args); } - +ATTRIBUTE_PRINTF(3, 0) int jio_snprintf(char *str, size_t count, const char *fmt, ...) { va_list args; int len; @@ -2774,7 +2775,7 @@ return len; } - +ATTRIBUTE_PRINTF(2,3) int jio_fprintf(FILE* f, const char *fmt, ...) { int len; va_list args; @@ -2784,7 +2785,7 @@ return len; } - +ATTRIBUTE_PRINTF(2, 0) int jio_vfprintf(FILE* f, const char *fmt, va_list args) { if (Arguments::vfprintf_hook() != NULL) { return Arguments::vfprintf_hook()(f, fmt, args); @@ -2793,7 +2794,7 @@ } } - +ATTRIBUTE_PRINTF(1, 2) JNIEXPORT int jio_printf(const char *fmt, ...) { int len; va_list args; @@ -2930,7 +2931,7 @@ JavaThread* receiver = java_lang_Thread::thread(java_thread); Events::log_exception(JavaThread::current(), "JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]", - receiver, (address)java_thread, throwable); + p2i(receiver), p2i((address)java_thread), p2i(throwable)); // First check if thread is alive if (receiver != NULL) { // Check if exception is getting thrown at self (use oop equality, since the diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/prims/jvmtiEnter.xsl --- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl Fri May 09 16:50:54 2014 -0400 @@ -1,6 +1,6 @@ " INTPTR_FORMAT, first->top_method()->code()); + if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, p2i(first->top_method()->code())); } else { if (TimeCompilationPolicy) accumulated_time()->start(); GrowableArray* stack = new GrowableArray(50); @@ -640,7 +644,7 @@ if (TraceCompilationPolicy && Verbose) { tty->print("\n\t check caller: "); next_m->print_short_name(tty); - tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)next_m(), next_m->code_size()); + tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)next_m()), next_m->code_size()); } current = next; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/deoptimization.cpp --- a/hotspot/src/share/vm/runtime/deoptimization.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,6 +89,8 @@ #endif #endif // COMPILER2 +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + bool DeoptimizationMarker::_is_active = false; Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/fprofiler.cpp --- a/hotspot/src/share/vm/runtime/fprofiler.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/fprofiler.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,8 @@ #include "runtime/vframe.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Static fields of FlatProfiler int FlatProfiler::received_gc_ticks = 0; int FlatProfiler::vm_operation_ticks = 0; @@ -309,7 +311,7 @@ st->fill_to(col2); t->print_native(st); st->fill_to(col3); - st->print(msg); + st->print("%s", msg); st->cr(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/frame.cpp --- a/hotspot/src/share/vm/runtime/frame.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/frame.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,6 +62,8 @@ # include "nativeInst_ppc.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + RegisterMap::RegisterMap(JavaThread *thread, bool update_map) { _thread = thread; _update_map = update_map; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/globals.cpp --- a/hotspot/src/share/vm/runtime/globals.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/globals.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,8 @@ #include "shark/shark_globals.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ @@ -283,6 +285,7 @@ // Length of format string (e.g. "%.1234s") for printing ccstr below #define FORMAT_BUFFER_LEN 16 +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void Flag::print_on(outputStream* st, bool withComments) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { @@ -315,7 +318,10 @@ size_t llen = pointer_delta(eol, cp, sizeof(char)); jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, "%%." SIZE_FORMAT "s", llen); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format_buffer, cp); +PRAGMA_DIAG_POP st->cr(); cp = eol+1; st->print("%5s %-35s += ", "", _name); @@ -372,7 +378,7 @@ } else { st->print(" "); } - st->print(d.name); + st->print("%s", d.name); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/handles.cpp --- a/hotspot/src/share/vm/runtime/handles.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/handles.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,8 @@ # include "os_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef ASSERT oop* HandleArea::allocate_handle(oop obj) { assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/interfaceSupport.cpp --- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ #include "runtime/vframe.hpp" #include "utilities/preserveException.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of InterfaceSupport diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/java.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -97,6 +97,7 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC GrowableArray* collected_profiled_methods; @@ -366,7 +367,7 @@ BaselineTTYOutputer outputer(tty); MemTracker::print_memory_usage(outputer, K, false); } else { - tty->print_cr(MemTracker::reason()); + tty->print_cr("%s", MemTracker::reason()); } } } @@ -407,7 +408,7 @@ BaselineTTYOutputer outputer(tty); MemTracker::print_memory_usage(outputer, K, false); } else { - tty->print_cr(MemTracker::reason()); + tty->print_cr("%s", MemTracker::reason()); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/jniHandles.cpp --- a/hotspot/src/share/vm/runtime/jniHandles.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/jniHandles.cpp Fri May 09 16:50:54 2014 -0400 @@ -30,6 +30,7 @@ #include "runtime/mutexLocker.hpp" #include "runtime/thread.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC JNIHandleBlock* JNIHandles::_global_handles = NULL; JNIHandleBlock* JNIHandles::_weak_global_handles = NULL; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/mutex.cpp --- a/hotspot/src/share/vm/runtime/mutex.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/mutex.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,6 +1,6 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,8 @@ # include "mutex_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o // // Native Monitor-Mutex locking - theory of operations diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/os.cpp --- a/hotspot/src/share/vm/runtime/os.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/os.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,6 +65,8 @@ # include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + OSThread* os::_starting_thread = NULL; address os::_polling_page = NULL; volatile int32_t* os::_mem_serialize_page = NULL; @@ -909,9 +911,9 @@ for (int i = 0; env_list[i] != NULL; i++) { if (getenv(env_list[i], buffer, len)) { - st->print(env_list[i]); + st->print("%s", env_list[i]); st->print("="); - st->print_cr(buffer); + st->print_cr("%s", buffer); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/osThread.cpp --- a/hotspot/src/share/vm/runtime/osThread.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/osThread.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #include "oops/oop.inline.hpp" #include "runtime/osThread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC OSThread::OSThread(OSThreadStartFunc start_proc, void* start_parm) { pd_initialize(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/perfData.cpp --- a/hotspot/src/share/vm/runtime/perfData.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/perfData.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,8 @@ #include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PerfDataList* PerfDataManager::_all = NULL; PerfDataList* PerfDataManager::_sampled = NULL; PerfDataList* PerfDataManager::_constants = NULL; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/perfMemory.cpp --- a/hotspot/src/share/vm/runtime/perfMemory.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/perfMemory.cpp Fri May 09 16:50:54 2014 -0400 @@ -35,6 +35,8 @@ #include "runtime/statSampler.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Prefix of performance data file. const char PERFDATA_NAME[] = "hsperfdata"; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/safepoint.cpp --- a/hotspot/src/share/vm/runtime/safepoint.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/safepoint.cpp Fri May 09 16:50:54 2014 -0400 @@ -82,6 +82,8 @@ #include "c1/c1_globals.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // -------------------------------------------------------------------------------------------------- // Implementation of Safepoint begin/end @@ -787,7 +789,7 @@ old_sp += incr*32; new_sp += incr*32; was_oops += incr*32; for( int i2=0; i2<16; i2++ ) { tty->print("call %c%d |"PTR_FORMAT" ","LI"[i2>>3],i2&7,new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); } - tty->print_cr(""); + tty->cr(); } #endif // SPARC #endif // PRODUCT @@ -829,7 +831,7 @@ timeout_error_printed = true; // Print out the thread info which didn't reach the safepoint for debugging // purposes (useful when there are lots of threads in the debugger). - tty->print_cr(""); + tty->cr(); tty->print_cr("# SafepointSynchronize::begin: Timeout detected:"); if (reason == _spinning_timeout) { tty->print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint."); @@ -849,7 +851,7 @@ (reason == _blocking_timeout && !cur_state->has_called_back()))) { tty->print("# "); cur_thread->print(); - tty->print_cr(""); + tty->cr(); } } tty->print_cr("# SafepointSynchronize::begin: (End of list)"); @@ -1322,7 +1324,7 @@ spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) { print_statistics(); } - tty->print_cr(""); + tty->cr(); // Print out polling page sampling status. if (!need_to_track_page_armed_status) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/safepoint.hpp --- a/hotspot/src/share/vm/runtime/safepoint.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/safepoint.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,7 +174,7 @@ // Debugging static void print_state() PRODUCT_RETURN; - static void safepoint_msg(const char* format, ...) PRODUCT_RETURN; + static void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(1, 2) PRODUCT_RETURN; static void deferred_initialize_stat(); static void print_stat_on_exit(); @@ -240,7 +240,7 @@ static void create(JavaThread *thread); static void destroy(JavaThread *thread); - void safepoint_msg(const char* format, ...) { + void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { if (ShowSafepointMsgs) { va_list ap; va_start(ap, format); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/sharedRuntime.cpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Fri May 09 16:50:54 2014 -0400 @@ -82,6 +82,8 @@ #include "c1/c1_Runtime1.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Shared stub locations RuntimeStub* SharedRuntime::_wrong_method_blob; RuntimeStub* SharedRuntime::_wrong_method_abstract_blob; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/signature.cpp --- a/hotspot/src/share/vm/runtime/signature.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/signature.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ #include "oops/typeArrayKlass.hpp" #include "runtime/signature.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of SignatureIterator diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/stackValue.cpp --- a/hotspot/src/share/vm/runtime/stackValue.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/stackValue.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -196,7 +196,7 @@ case T_OBJECT: _o()->print_value_on(st); - st->print(" <" INTPTR_FORMAT ">", (address)_o()); + st->print(" <" INTPTR_FORMAT ">", p2i((address)_o())); break; case T_CONFLICT: diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/stackValueCollection.cpp --- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,8 @@ # include "jniTypes_ppc.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + jint StackValueCollection::int_at(int slot) const { intptr_t val = at(slot)->get_int(); jint ival = *((jint*) (&val)); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/stubCodeGenerator.cpp --- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,10 +60,10 @@ void StubCodeDesc::print_on(outputStream* st) const { - st->print(group()); + st->print("%s", group()); st->print("::"); - st->print(name()); - st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes()); + st->print("%s", name()); + st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", p2i(begin()), p2i(end()), size_in_bytes()); } // Implementation of StubCodeGenerator diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/sweeper.cpp --- a/hotspot/src/share/vm/runtime/sweeper.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/sweeper.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,8 @@ #include "utilities/ticks.inline.hpp" #include "utilities/xmlstream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef ASSERT #define SWEEP(nm) record_sweep(nm, __LINE__) @@ -627,7 +629,7 @@ tty->vprint(format, ap); va_end(ap); } - tty->print_cr(s.as_string()); + tty->print_cr("%s", s.as_string()); } if (LogCompilation && (xtty != NULL)) { @@ -644,7 +646,7 @@ xtty->vprint(format, ap); va_end(ap); } - xtty->print(s.as_string()); + xtty->print("%s", s.as_string()); xtty->stamp(); xtty->end_elem(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/sweeper.hpp --- a/hotspot/src/share/vm/runtime/sweeper.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/sweeper.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,7 +94,7 @@ static const Tickspan total_time_sweeping() { return _total_time_sweeping; } static const Tickspan peak_sweep_time() { return _peak_sweep_time; } static const Tickspan peak_sweep_fraction_time() { return _peak_sweep_fraction_time; } - static void log_sweep(const char* msg, const char* format = NULL, ...); + static void log_sweep(const char* msg, const char* format = NULL, ...) ATTRIBUTE_PRINTF(2, 3); #ifdef ASSERT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/synchronizer.cpp --- a/hotspot/src/share/vm/runtime/synchronizer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp Fri May 09 16:50:54 2014 -0400 @@ -60,6 +60,8 @@ #define ATTR #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // The "core" versions of monitor enter and exit reside in this file. // The interpreter and compilers contain specialized transliterated // variants of the enter-exit fast-path operations. See i486.ad fast_lock(), diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/thread.cpp Fri May 09 16:50:54 2014 -0400 @@ -112,6 +112,8 @@ #include "runtime/rtmLocking.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef DTRACE_ENABLED // Only bother with this argument setup if dtrace is available @@ -4273,7 +4275,7 @@ // Threads::print_on() is called at safepoint by VM_PrintThreads operation. void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks) { char buf[32]; - st->print_cr(os::local_time_string(buf, sizeof(buf))); + st->print_cr("%s", os::local_time_string(buf, sizeof(buf))); st->print_cr("Full thread dump %s (%s %s):", Abstract_VM_Version::vm_name(), diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/thread.hpp Fri May 09 16:50:54 2014 -0400 @@ -684,7 +684,7 @@ NamedThread(); ~NamedThread(); // May only be called once per thread. - void set_name(const char* format, ...); + void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); virtual bool is_Named_thread() const { return true; } virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; } JavaThread *processed_thread() { return _processed_thread; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/timer.cpp --- a/hotspot/src/share/vm/runtime/timer.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/timer.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -204,7 +204,7 @@ _logfile->print("[Error in TraceCPUTime]"); } if (_print_cr) { - _logfile->print_cr(""); + _logfile->cr(); } _logfile->flush(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/unhandledOops.cpp --- a/hotspot/src/share/vm/runtime/unhandledOops.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/unhandledOops.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ #include "runtime/unhandledOops.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef CHECK_UNHANDLED_OOPS const int free_list_size = 256; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/vframe.cpp --- a/hotspot/src/share/vm/runtime/vframe.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vframe.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,6 +46,8 @@ #include "runtime/vframeArray.hpp" #include "runtime/vframe_hp.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) : _reg_map(reg_map), _thread(thread) { assert(fr != NULL, "must have frame"); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/vframe.hpp --- a/hotspot/src/share/vm/runtime/vframe.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vframe.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -399,7 +399,7 @@ if (WizardMode) { tty->print_cr("Error in fill_from_frame: pc_desc for " INTPTR_FORMAT " not found or invalid at %d", - _frame.pc(), decode_offset); + p2i(_frame.pc()), decode_offset); nm()->print(); nm()->method()->print_codes(); nm()->print_code(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/vframeArray.cpp --- a/hotspot/src/share/vm/runtime/vframeArray.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vframeArray.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/virtualspace.cpp --- a/hotspot/src/share/vm/runtime/virtualspace.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/virtualspace.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ # include "os_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // ReservedSpace diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/vmThread.cpp --- a/hotspot/src/share/vm/runtime/vmThread.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vmThread.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,8 @@ #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Dummy VM operation to act as first element in our circular double-linked list class VM_Dummy: public VM_Operation { VMOp_Type type() const { return VMOp_Dummy; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/vm_operations.cpp --- a/hotspot/src/share/vm/runtime/vm_operations.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vm_operations.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ #include "services/threadService.hpp" #include "trace/tracing.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define VM_OP_NAME_INITIALIZE(name) #name, const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \ diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/runtime/vm_version.cpp --- a/hotspot/src/share/vm/runtime/vm_version.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/runtime/vm_version.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,7 +117,7 @@ set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version"); set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version"); int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0; - set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset, + set_version_field(&_vm_build_number, &JDK_BUILD_NUMBER[offset], "bad build number"); _initialized = true; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/attachListener.cpp --- a/hotspot/src/share/vm/services/attachListener.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/attachListener.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -284,15 +284,15 @@ } if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) { - out->print_cr(err_msg.buffer()); + out->print_cr("%s", err_msg.buffer()); return JNI_ERR; } } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) { - out->print_cr(err_msg.buffer()); + out->print_cr("%s", err_msg.buffer()); return JNI_ERR; } } @@ -381,7 +381,7 @@ Flag* f = Flag::find_flag((char*)name, strlen(name)); if (f) { f->print_as_flag(out); - out->print_cr(""); + out->cr(); } else { out->print_cr("no such flag '%s'", name); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/classLoadingService.cpp --- a/hotspot/src/share/vm/services/classLoadingService.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/classLoadingService.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -136,7 +136,7 @@ if (TraceClassUnloading) { ResourceMark rm; - tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), k); + tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), p2i(k)); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/diagnosticCommand.cpp --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ #include "services/management.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void DCmdRegistrant::register_dcmds(){ // Registration of the diagnostic commands // First argument specifies which interfaces will export the command @@ -101,7 +103,7 @@ if (factory != NULL) { output()->print_cr("%s%s", factory->name(), factory->is_enabled() ? "" : " [disabled]"); - output()->print_cr(factory->description()); + output()->print_cr("%s", factory->description()); output()->print_cr("\nImpact: %s", factory->impact()); JavaPermission p = factory->permission(); if(p._class != NULL) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/diagnosticFramework.cpp --- a/hotspot/src/share/vm/services/diagnosticFramework.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -259,7 +259,7 @@ } arg = arg->next(); } - out->print_cr(""); + out->cr(); if (_arguments_list != NULL) { out->print_cr("\nArguments:"); arg = _arguments_list; @@ -268,7 +268,7 @@ arg->is_mandatory() ? "" : "[optional]", arg->description(), arg->type()); if (arg->has_default()) { - out->print(arg->default_string()); + out->print("%s", arg->default_string()); } else { out->print("no default value"); } @@ -284,7 +284,7 @@ arg->is_mandatory() ? "" : "[optional]", arg->description(), arg->type()); if (arg->has_default()) { - out->print(arg->default_string()); + out->print("%s", arg->default_string()); } else { out->print("no default value"); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/heapDumper.cpp --- a/hotspot/src/share/vm/services/heapDumper.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/heapDumper.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1842,6 +1842,7 @@ } // dump the heap to given path. +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL int HeapDumper::dump(const char* path) { assert(path != NULL && strlen(path) > 0, "path missing"); @@ -1882,7 +1883,10 @@ char msg[256]; sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]", JLONG_FORMAT, timer()->seconds()); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL tty->print_cr(msg, writer.bytes_written()); +PRAGMA_DIAG_POP } else { tty->print_cr("Dump file is incomplete: %s", writer.error()); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/lowMemoryDetector.cpp --- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -353,7 +353,7 @@ #ifndef PRODUCT void SensorInfo::print() { - tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %ld pending_clears = %ld", + tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %d pending_clears = %d", (_sensor_on ? "on" : "off"), _sensor_count, _pending_trigger_count, _pending_clear_count); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/management.cpp --- a/hotspot/src/share/vm/services/management.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/management.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,6 +56,8 @@ #include "services/threadService.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PerfVariable* Management::_begin_vm_creation_time = NULL; PerfVariable* Management::_end_vm_creation_time = NULL; PerfVariable* Management::_vm_init_done_time = NULL; @@ -1839,12 +1841,12 @@ uintx uvalue = (uintx)new_value.j; if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MaxHeapFreeRatio(err_msg, uvalue)) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer()); } } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MinHeapFreeRatio(err_msg, uvalue)) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer()); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/memReporter.cpp --- a/hotspot/src/share/vm/services/memReporter.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/memReporter.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ #include "services/memPtrArray.hpp" #include "services/memTracker.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + const char* BaselineOutputer::memory_unit(size_t scale) { switch(scale) { case K: return "KB"; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/memSnapshot.cpp --- a/hotspot/src/share/vm/services/memSnapshot.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/memSnapshot.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ #include "services/memSnapshot.hpp" #include "services/memTracker.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef ASSERT void decode_pointer_record(MemPointerRecord* rec) { @@ -733,7 +735,7 @@ if (os::dll_address_to_function_name(ex->pc(), buf, sizeof(buf), NULL)) { tty->print_cr("\t%s", buf); } else { - tty->print_cr(""); + tty->cr(); } } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/memTrackWorker.cpp --- a/hotspot/src/share/vm/services/memTrackWorker.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/memTrackWorker.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ // create thread uses cgc thread type for now. We should revisit // the option, or create new thread type. _has_error = !os::create_thread(this, os::cgc_thread); - set_name("MemTrackWorker", 0); + set_name("MemTrackWorker"); // initial generation circuit buffer if (!has_error()) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/nmtDCmd.cpp --- a/hotspot/src/share/vm/services/nmtDCmd.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/nmtDCmd.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -128,7 +128,7 @@ // native memory tracking has to be on if (!MemTracker::is_on() || MemTracker::shutdown_in_progress()) { // if it is not on, what's the reason? - output()->print_cr(MemTracker::reason()); + output()->print_cr("%s", MemTracker::reason()); return; } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/services/threadService.cpp --- a/hotspot/src/share/vm/services/threadService.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/services/threadService.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,8 @@ #include "runtime/vm_operations.hpp" #include "services/threadService.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // TODO: we need to define a naming convention for perf counters // to distinguish counters for: // - standard JSR174 use diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/trace/traceStream.hpp --- a/hotspot/src/share/vm/trace/traceStream.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/trace/traceStream.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -113,7 +113,7 @@ } void print(const char* val) { - _st.print(val); + _st.print("%s", val); } }; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/array.hpp --- a/hotspot/src/share/vm/utilities/array.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/array.hpp Fri May 09 16:50:54 2014 -0400 @@ -376,7 +376,7 @@ // FIXME: How to handle this? void print_value_on(outputStream* st) const { - st->print("Array(" INTPTR_FORMAT ")", this); + st->print("Array(" INTPTR_FORMAT ")", p2i(this)); } #ifndef PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/bitMap.cpp --- a/hotspot/src/share/vm/utilities/bitMap.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/bitMap.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -522,13 +522,13 @@ void BitMap::print_on_error(outputStream* st, const char* prefix) const { st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")", - prefix, map(), (char*)map() + (size() >> LogBitsPerByte)); + prefix, p2i(map()), p2i((char*)map() + (size() >> LogBitsPerByte))); } #ifndef PRODUCT void BitMap::print_on(outputStream* st) const { - tty->print("Bitmap(%d):", size()); + tty->print("Bitmap(" SIZE_FORMAT "):", size()); for (idx_t index = 0; index < size(); index++) { tty->print("%c", at(index) ? '1' : '0'); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/constantTag.cpp --- a/hotspot/src/share/vm/utilities/constantTag.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/constantTag.cpp Fri May 09 16:50:54 2014 -0400 @@ -28,7 +28,7 @@ #ifndef PRODUCT void constantTag::print_on(outputStream* st) const { - st->print(internal_name()); + st->print("%s", internal_name()); } #endif // PRODUCT diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/debug.cpp --- a/hotspot/src/share/vm/utilities/debug.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/debug.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,6 +88,8 @@ # endif #endif // PRODUCT +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + FormatBufferResource::FormatBufferResource(const char * format, ...) : FormatBufferBase((char*)resource_allocate_bytes(RES_BUFSZ)) { va_list argp; @@ -96,6 +98,7 @@ va_end(argp); } +ATTRIBUTE_PRINTF(1, 2) void warning(const char* format, ...) { if (PrintWarnings) { FILE* const err = defaultStream::error_stream(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/debug.hpp --- a/hotspot/src/share/vm/utilities/debug.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/debug.hpp Fri May 09 16:50:54 2014 -0400 @@ -43,17 +43,17 @@ #define RES_BUFSZ 256 class FormatBufferResource : public FormatBufferBase { public: - FormatBufferResource(const char * format, ...); + FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); }; // Use stack for buffer template class FormatBuffer : public FormatBufferBase { public: - inline FormatBuffer(const char * format, ...); - inline void append(const char* format, ...); - inline void print(const char* format, ...); - inline void printv(const char* format, va_list ap); + inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); + inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); char* buffer() { return _buf; } int size() { return bufsz; } @@ -223,7 +223,7 @@ void report_unimplemented(const char* file, int line); void report_untested(const char* file, int line, const char* message); -void warning(const char* format, ...); +void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2); #ifdef ASSERT // Compile-time asserts. diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/events.cpp --- a/hotspot/src/share/vm/utilities/events.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/events.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,7 @@ va_start(ap, format); // Save a copy of begin message and log it. _buffer.printv(format, ap); - Events::log(NULL, _buffer); + Events::log(NULL, "%s", _buffer.buffer()); va_end(ap); } } @@ -91,6 +91,6 @@ if (LogEvents) { // Append " done" to the begin message and log it _buffer.append(" done"); - Events::log(NULL, _buffer); + Events::log(NULL, "%s", _buffer.buffer()); } } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/events.hpp --- a/hotspot/src/share/vm/utilities/events.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/events.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -128,7 +128,7 @@ void print(outputStream* out, EventRecord& e) { out->print("Event: %.3f ", e.timestamp); if (e.thread != NULL) { - out->print("Thread " INTPTR_FORMAT " ", e.thread); + out->print("Thread " INTPTR_FORMAT " ", p2i(e.thread)); } print(out, e.data); } @@ -148,7 +148,7 @@ public: StringEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase(name, count) {} - void logv(Thread* thread, const char* format, va_list ap) { + void logv(Thread* thread, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0) { if (!should_log()) return; double timestamp = fetch_timestamp(); @@ -159,7 +159,7 @@ _records[index].data.printv(format, ap); } - void log(Thread* thread, const char* format, ...) { + void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(3, 4) { va_list ap; va_start(ap, format); logv(thread, format, ap); @@ -193,18 +193,17 @@ static void print(); // Logs a generic message with timestamp and format as printf. - static void log(Thread* thread, const char* format, ...); + static void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // Log exception related message - static void log_exception(Thread* thread, const char* format, ...); + static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); - static void log_deopt_message(Thread* thread, const char* format, ...); + static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // Register default loggers static void init(); }; - inline void Events::log(Thread* thread, const char* format, ...) { if (LogEvents) { va_list ap; @@ -283,7 +282,7 @@ public: // log a begin event, format as printf - EventMark(const char* format, ...); + EventMark(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // log an end event ~EventMark(); }; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/exceptions.cpp --- a/hotspot/src/share/vm/utilities/exceptions.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/exceptions.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ #include "utilities/events.hpp" #include "utilities/exceptions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of ThreadShadow void check_ThreadShadow() { @@ -237,6 +238,7 @@ _throw_msg(thread, file, line, h_name, msg); } + // Creates an exception oop, calls the method with the given signature. // and returns a Handle Handle Exceptions::new_exception(Thread *thread, Symbol* name, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/exceptions.hpp --- a/hotspot/src/share/vm/utilities/exceptions.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/exceptions.hpp Fri May 09 16:50:54 2014 -0400 @@ -132,7 +132,7 @@ // There is no THROW... macro for this method. Caller should remember // to do a return after calling it. static void fthrow(Thread* thread, const char* file, int line, Symbol* name, - const char* format, ...); + const char* format, ...) ATTRIBUTE_PRINTF(5, 6); // Create and initialize a new exception static Handle new_exception(Thread* thread, Symbol* name, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/globalDefinitions.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,32 @@ # include "utilities/globalDefinitions_xlc.hpp" #endif +#ifndef PRAGMA_DIAG_PUSH +#define PRAGMA_DIAG_PUSH +#endif +#ifndef PRAGMA_DIAG_POP +#define PRAGMA_DIAG_POP +#endif +#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED +#define PRAGMA_FORMAT_NONLITERAL_IGNORED +#endif +#ifndef PRAGMA_FORMAT_IGNORED +#define PRAGMA_FORMAT_IGNORED +#endif +#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL +#endif +#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL +#endif +#ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC +#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC +#endif +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(fmt, vargs) +#endif + + #include "utilities/macros.hpp" // This file holds all globally used constants & types, class (forward) @@ -1284,6 +1310,11 @@ return ((int)((unsigned int)high << 16) | (unsigned int)low); } +// Convert pointer to intptr_t, for use in printing pointers. +inline intptr_t p2i(const void * p) { + return (intptr_t) p; +} + // Printf-style formatters for fixed- and variable-width types as pointers and // integers. These are derived from the definitions in inttypes.h. If the platform // doesn't provide appropriate definitions, they should be provided in @@ -1302,6 +1333,7 @@ // Format 64-bit quantities. #define INT64_FORMAT "%" PRId64 #define UINT64_FORMAT "%" PRIu64 +#define UINT64_FORMAT_X "%" PRIx64 #define INT64_FORMAT_W(width) "%" #width PRId64 #define UINT64_FORMAT_W(width) "%" #width PRIu64 @@ -1324,6 +1356,8 @@ #define PTR_FORMAT "0x%08" PRIxPTR #endif // _LP64 +#define INTPTR_FORMAT_W(width) "%" #width PRIxPTR + #define SSIZE_FORMAT "%" PRIdPTR #define SIZE_FORMAT "%" PRIuPTR #define SIZE_FORMAT_HEX "0x%" PRIxPTR @@ -1355,7 +1389,6 @@ return *(void**)addr; } - #ifndef PRODUCT // For unit testing only diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp --- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -282,6 +282,35 @@ #define PRAGMA_IMPLEMENTATION #pragma implementation #define VALUE_OBJ_CLASS_SPEC +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs))) +#endif + +#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic ignored \"-Wformat-security\"") +#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"") + +#if defined(__clang_major__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 1)) || (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6) +// Tested to work with clang version 3.1 and better. +#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") +#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED + +// Hack to deal with gcc yammering about non-security format stuff +#else +// Old versions of gcc don't do push/pop, also do not cope with this pragma within a function +// One method does so much varied printing that it is decorated with both internal and external +// versions of the macro-pragma to obtain better checking with newer compilers. +#define PRAGMA_DIAG_PUSH +#define PRAGMA_DIAG_POP +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL +#endif + +#ifndef __clang_major__ +#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC _Pragma("GCC diagnostic ignored \"-Wformat\"") _Pragma("GCC diagnostic error \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic error \"-Wformat-security\"") +#endif + #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) #define TEMPLATE_TABLE_BUG #endif diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/numberSeq.cpp --- a/hotspot/src/share/vm/utilities/numberSeq.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/numberSeq.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -258,5 +258,5 @@ } s->print("\t[%d]=%7.3f", i, _sequence[i]); } - s->print_cr(""); + s->cr(); } diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/ostream.cpp --- a/hotspot/src/share/vm/utilities/ostream.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/ostream.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -268,7 +268,7 @@ size_t limit = (len + 16) / 16 * 16; for (size_t i = 0; i < limit; ++i) { if (i % 16 == 0) { - indent().print("%07x:", i); + indent().print(INTPTR_FORMAT_W(07)":", i); } if (i % 2 == 0) { print(" "); @@ -289,7 +289,7 @@ } } } - print_cr(""); + cr(); } } } @@ -606,7 +606,7 @@ // memory usage and command line flags into header void gcLogFileStream::dump_loggc_header() { if (is_open()) { - print_cr(Abstract_VM_Version::internal_vm_info_string()); + print_cr("%s", Abstract_VM_Version::internal_vm_info_string()); os::print_memory_info(this); print("CommandLine flags: "); CommandLineFlags::printSetFlags(this); @@ -687,7 +687,7 @@ write(time_msg, strlen(time_msg)); if (out != NULL) { - out->print(time_msg); + out->print("%s", time_msg); } dump_loggc_header(); @@ -720,7 +720,7 @@ write(time_msg, strlen(time_msg)); if (out != NULL) { - out->print(time_msg); + out->print("%s", time_msg); } fclose(_file); @@ -765,7 +765,7 @@ write(time_msg, strlen(time_msg)); if (out != NULL) { - out->print(time_msg); + out->print("%s", time_msg); } dump_loggc_header(); @@ -845,7 +845,7 @@ xs->head("hotspot_log version='%d %d'" " process='%d' time_ms='"INT64_FORMAT"'", LOG_MAJOR_VERSION, LOG_MINOR_VERSION, - os::current_process_id(), time_ms); + os::current_process_id(), (int64_t)time_ms); // Write VM version header immediately. xs->head("vm_version"); xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr(); diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/ostream.hpp --- a/hotspot/src/share/vm/utilities/ostream.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/ostream.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ static const char* do_vsnprintf(char* buffer, size_t buflen, const char* format, va_list ap, bool add_cr, - size_t& result_len); + size_t& result_len) ATTRIBUTE_PRINTF(3, 0); public: // creation @@ -80,10 +80,10 @@ void set_position(int pos) { _position = pos; } // printing - void print(const char* format, ...); - void print_cr(const char* format, ...); - void vprint(const char *format, va_list argptr); - void vprint_cr(const char* format, va_list argptr); + void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); + void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); void print_raw(const char* str) { write(str, strlen(str)); } void print_raw(const char* str, int len) { write(str, len); } void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); } @@ -274,10 +274,10 @@ ~staticBufferStream() {}; virtual void write(const char* c, size_t len); void flush(); - void print(const char* format, ...); - void print_cr(const char* format, ...); - void vprint(const char *format, va_list argptr); - void vprint_cr(const char* format, va_list argptr); + void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); + void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); }; // In the non-fixed buffer case an underlying buffer will be created and diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/quickSort.cpp --- a/hotspot/src/share/vm/utilities/quickSort.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/quickSort.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,7 +77,7 @@ for (int i = 0; i < length; i++) { tty->print(" %d", array[i]); } - tty->print_cr(""); + tty->cr(); } bool QuickSort::compare_arrays(int* actual, int* expected, int length) { diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/taskqueue.cpp --- a/hotspot/src/share/vm/utilities/taskqueue.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/taskqueue.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ #include "utilities/stack.inline.hpp" #include "utilities/taskqueue.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef TRACESPINNING uint ParallelTaskTerminator::_total_yields = 0; uint ParallelTaskTerminator::_total_spins = 0; diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,8 @@ #include "utilities/top.hpp" #include "utilities/vmError.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // List of environment variables that should be reported in error log file. const char *env_list[] = { // All platforms @@ -358,17 +360,17 @@ st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : "(mmap) failed to map "); jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); - st->print(buf); + st->print("%s", buf); st->print(" bytes"); if (_message != NULL) { st->print(" for "); - st->print(_message); + st->print("%s", _message); } st->cr(); } else { if (_message != NULL) st->print("# "); - st->print_cr(_message); + st->print_cr("%s", _message); } // In error file give some solutions if (_verbose) { @@ -485,7 +487,7 @@ } else { st->print("Failed to write core dump. %s", coredump_message); } - st->print_cr(""); + st->cr(); st->print_cr("#"); STEP(65, "(printing bug submit message)") diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/workgroup.cpp --- a/hotspot/src/share/vm/utilities/workgroup.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/workgroup.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ #include "runtime/os.hpp" #include "utilities/workgroup.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Definitions of WorkGang methods. AbstractWorkGang::AbstractWorkGang(const char* name, diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/xmlstream.cpp --- a/hotspot/src/share/vm/utilities/xmlstream.cpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/xmlstream.cpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -336,6 +336,8 @@ print_raw_cr(">"); } +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED // ------------------------------------------------------------------ void xmlStream::va_done(const char* format, va_list ap) { char buffer[200]; @@ -354,6 +356,7 @@ buffer[kind_len] = 0; tail(buffer); } +PRAGMA_DIAG_POP // Output a timestamp attribute. void xmlStream::stamp() { @@ -399,7 +402,7 @@ ResourceMark rm; assert_if_no_error(inside_attrs(), "printing attributes"); if (method.is_null()) return; - text()->print(method->method_holder()->external_name()); + text()->print("%s", method->method_holder()->external_name()); print_raw(" "); // " " is easier for tools to parse than "::" method->name()->print_symbol_on(text()); print_raw(" "); // separator diff -r 8528b67f6562 -r 2658d7834c6e hotspot/src/share/vm/utilities/xmlstream.hpp --- a/hotspot/src/share/vm/utilities/xmlstream.hpp Fri May 09 08:34:22 2014 -0700 +++ b/hotspot/src/share/vm/utilities/xmlstream.hpp Fri May 09 16:50:54 2014 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,7 +80,7 @@ outputStream* out() { return _out; } // helpers for writing XML elements - void va_tag(bool push, const char* format, va_list ap); + void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0); virtual void see_tag(const char* tag, bool push) NOT_DEBUG({}); virtual void pop_tag(const char* tag) NOT_DEBUG({}); @@ -109,29 +109,29 @@ int unflushed_count() { return (int)(out()->count() - _last_flush); } // writing complete XML elements - void elem(const char* format, ...); - void begin_elem(const char* format, ...); - void end_elem(const char* format, ...); + void elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void begin_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void end_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void end_elem(); - void head(const char* format, ...); - void begin_head(const char* format, ...); - void end_head(const char* format, ...); + void head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void begin_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void end_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void end_head(); - void done(const char* format, ...); // xxx_done event, plus tail + void done(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // xxx_done event, plus tail void done_raw(const char * kind); void tail(const char* kind); // va_list versions - void va_elem(const char* format, va_list ap); - void va_begin_elem(const char* format, va_list ap); - void va_head(const char* format, va_list ap); - void va_begin_head(const char* format, va_list ap); - void va_done(const char* format, va_list ap); + void va_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_begin_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_begin_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_done(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); // write text (with quoting of special XML characters <>&'" etc.) outputStream* text() { return _text; } - void text(const char* format, ...); - void va_text(const char* format, va_list ap) { + void text(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void va_text(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) { text()->vprint(format, ap); }