8138733: Fix build: gcc < 4.8 doesn't grok -Wno-format-zero-length added in 8080775

Also fix one problematic format on ppc.

Reviewed-by: david, simonis
This commit is contained in:
Goetz Lindenmaier 2015-10-02 11:46:42 +02:00
parent 462756ad41
commit 56d0ec1e1a
3 changed files with 13 additions and 2 deletions
hotspot
make/linux/makefiles
src
cpu/ppc/vm
share/vm/utilities

@ -207,18 +207,22 @@ ifeq ($(USE_CLANG), true)
WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
endif
WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual -Wno-format-zero-length
WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual
ifeq ($(USE_CLANG),)
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
# conversions which might affect the values. Only enable it in earlier versions.
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
# GCC < 4.3
WARNING_FLAGS += -Wconversion
endif
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# GCC >= 4.8
# This flag is only known since GCC 4.3. Gcc 4.8 contains a fix so that with templates no
# warnings are issued: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11856
WARNING_FLAGS += -Wtype-limits
# GCC < 4.8 don't accept this flag for C++.
WARNING_FLAGS += -Wno-format-zero-length
endif
endif

@ -841,7 +841,7 @@ class StubGenerator: public StubCodeGenerator {
// Only called by MacroAssembler::verify_oop
static void verify_oop_helper(const char* message, oop o) {
if (!o->is_oop_or_null()) {
fatal(message);
fatal("%s", message);
}
++ StubRoutines::_verify_oop_count;
}

@ -200,8 +200,15 @@ enum VMErrorType {
// error reporting helper functions
void report_vm_error(const char* file, int line, const char* error_msg);
#if !defined(__GNUC__) || defined (__clang_major__) || (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || __GNUC__ > 4)
// ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler.
void report_vm_error(const char* file, int line, const char* error_msg,
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
#else
// GCC < 4.8 warns because of empty format string. Warning can not be switched off selectively.
void report_vm_error(const char* file, int line, const char* error_msg,
const char* detail_fmt, ...);
#endif
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type,
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6);