Mercurial > hg > graal-jvmci-8
diff src/os/linux/vm/os_linux.cpp @ 17937:78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | 6048424d3865 |
children | f73af4455d7d ce8f6bb717c9 |
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp Thu May 15 18:23:26 2014 -0400 +++ b/src/os/linux/vm/os_linux.cpp Thu May 22 15:52:41 2014 -0400 @@ -101,6 +101,8 @@ # include <inttypes.h> # include <sys/ioctl.h> +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 @@ -2137,7 +2139,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); @@ -2198,8 +2200,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"); } @@ -3415,7 +3417,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; } @@ -3433,7 +3435,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; } @@ -3453,7 +3455,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); } } @@ -5392,6 +5394,8 @@ // -1 on error. // +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { static bool proc_task_unchecked = true; static const char *proc_stat_path = "/proc/%d/stat"; @@ -5453,6 +5457,7 @@ return (jlong)user_time * (1000000000 / clock_tics_per_sec); } } +PRAGMA_DIAG_POP void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) { info_ptr->max_value = ALL_64_BITS; // will not wrap in less than 64 bits