changeset 5819:39f4affc6564

8143245: Zero build requires disabled warnings 8022956: Clang: enable return type warnings on BSD Summary: Based on work of Severin Gehwolf <sgehwolf@redhat.com> & Christian Thalinger <cthalinger@twitter.com> with additions for 7-only cases Reviewed-by: dholmes, coleenp, sla
author andrew
date Tue, 13 Feb 2018 06:42:27 +0000
parents 2b8e71792895
children d07df83bf575
files src/cpu/zero/vm/assembler_zero.cpp src/cpu/zero/vm/assembler_zero.hpp src/cpu/zero/vm/cppInterpreter_zero.cpp src/cpu/zero/vm/frame_zero.cpp src/cpu/zero/vm/frame_zero.inline.hpp src/cpu/zero/vm/icBuffer_zero.cpp src/cpu/zero/vm/interp_masm_zero.hpp src/cpu/zero/vm/interpreterRT_zero.cpp src/cpu/zero/vm/interpreter_zero.cpp src/cpu/zero/vm/nativeInst_zero.hpp src/cpu/zero/vm/register_zero.cpp src/cpu/zero/vm/relocInfo_zero.cpp src/cpu/zero/vm/sharedRuntime_zero.cpp src/cpu/zero/vm/vtableStubs_zero.cpp src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp src/os_cpu/linux_zero/vm/os_linux_zero.cpp src/os_cpu/linux_zero/vm/thread_linux_zero.hpp
diffstat 19 files changed, 71 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/zero/vm/assembler_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/assembler_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -73,6 +73,7 @@
 RegisterOrConstant MacroAssembler::delayed_value_impl(
   intptr_t* delayed_value_addr, Register tmpl, int offset) {
   ShouldNotCallThis();
+  return RegisterOrConstant();
 }
 
 void MacroAssembler::store_oop(jobject obj) {
--- a/src/cpu/zero/vm/assembler_zero.hpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/assembler_zero.hpp	Tue Feb 13 06:42:27 2018 +0000
@@ -60,6 +60,7 @@
 #ifdef ASSERT
 inline bool AbstractAssembler::pd_check_instruction_mark() {
   ShouldNotCallThis();
+  return false; // Mute compiler warning
 }
 #endif
 
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -98,7 +98,7 @@
     case T_DOUBLE:
     case T_VOID:
       return result;
-    default  : ShouldNotReachHere();
+    default  : ShouldNotReachHere(); return 0;
   }
 }
 
@@ -1028,6 +1028,7 @@
 
 address CppInterpreter::return_entry(TosState state, int length) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 address CppInterpreter::deopt_entry(TosState state, int length) {
@@ -1045,9 +1046,8 @@
 bool CppInterpreter::contains(address pc) {
 #ifdef PRODUCT
   ShouldNotCallThis();
-#else
+#endif // !PRODUCT
   return false; // make frame::print_value_on work
-#endif // !PRODUCT
 }
 
 // Result handlers and convertors
--- a/src/cpu/zero/vm/frame_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/frame_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -106,6 +106,7 @@
 
 bool frame::safe_for_sender(JavaThread *thread) {
   ShouldNotCallThis();
+  return false;
 }
 
 void frame::pd_gc_epilog() {
@@ -113,6 +114,7 @@
 
 bool frame::is_interpreted_frame_valid(JavaThread *thread) const {
   ShouldNotCallThis();
+  return false;
 }
 
 BasicType frame::interpreter_frame_result(oop* oop_result,
@@ -174,9 +176,8 @@
 int frame::frame_size(RegisterMap* map) const {
 #ifdef PRODUCT
   ShouldNotCallThis();
-#else
+#endif // PRODUCT
   return 0; // make javaVFrame::print_value work
-#endif // PRODUCT
 }
 
 intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
--- a/src/cpu/zero/vm/frame_zero.inline.hpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/frame_zero.inline.hpp	Tue Feb 13 06:42:27 2018 +0000
@@ -36,7 +36,7 @@
   _deopt_state = unknown;
 }
 
-inline address  frame::sender_pc()           const { ShouldNotCallThis();  }
+inline address  frame::sender_pc()           const { ShouldNotCallThis(); return NULL; }
 
 inline frame::frame(ZeroFrame* zf, intptr_t* sp) {
   _zeroframe = zf;
@@ -80,6 +80,7 @@
 
 inline intptr_t* frame::link() const {
   ShouldNotCallThis();
+  return NULL;
 }
 
 #ifdef CC_INTERP
@@ -142,14 +143,17 @@
 
 inline oop frame::saved_oop_result(RegisterMap* map) const {
   ShouldNotCallThis();
+  return NULL;
 }
 
 inline bool frame::is_older(intptr_t* id) const {
   ShouldNotCallThis();
+  return false;
 }
 
 inline intptr_t* frame::entry_frame_argument_at(int offset) const {
   ShouldNotCallThis();
+  return NULL;
 }
 
 inline intptr_t* frame::unextended_sp() const {
--- a/src/cpu/zero/vm/icBuffer_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/icBuffer_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -49,9 +49,11 @@
 address InlineCacheBuffer::ic_buffer_entry_point(address code_begin) {
   // NB ic_stub_code_size() must return the size of the code we generate
   ShouldNotCallThis();
+  return NULL;
 }
 
 oop InlineCacheBuffer::ic_buffer_cached_oop(address code_begin) {
   // NB ic_stub_code_size() must return the size of the code we generate
   ShouldNotCallThis();
+  return NULL;
 }
--- a/src/cpu/zero/vm/interp_masm_zero.hpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/interp_masm_zero.hpp	Tue Feb 13 06:42:27 2018 +0000
@@ -40,6 +40,7 @@
                                         Register  tmp,
                                         int       offset) {
     ShouldNotCallThis();
+    return RegisterOrConstant();
   }
 };
 
--- a/src/cpu/zero/vm/interpreterRT_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/interpreterRT_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2010 Red Hat, Inc.
+ * Copyright 2016 Red Hat, Inc.
  * 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,7 +62,7 @@
 }
 
 void InterpreterRuntime::SignatureHandlerGeneratorBase::push(BasicType type) {
-  ffi_type *ftype;
+  ffi_type *ftype = NULL;
   switch (type) {
   case T_VOID:
     ftype = &ffi_type_void;
--- a/src/cpu/zero/vm/interpreter_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/interpreter_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -64,6 +64,7 @@
     return NULL;
 
   Unimplemented();
+  return NULL;
 }
 
 address InterpreterGenerator::generate_abstract_entry() {
--- a/src/cpu/zero/vm/nativeInst_zero.hpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/nativeInst_zero.hpp	Tue Feb 13 06:42:27 2018 +0000
@@ -51,15 +51,18 @@
  public:
   bool is_jump() {
     ShouldNotCallThis();
+    return false;
   }
 
   bool is_safepoint_poll() {
     ShouldNotCallThis();
+    return false;
   }
 };
 
 inline NativeInstruction* nativeInstruction_at(address address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 class NativeCall : public NativeInstruction {
@@ -70,18 +73,22 @@
 
   address instruction_address() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   address next_instruction_address() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   address return_address() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   address destination() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   void set_destination_mt_safe(address dest) {
@@ -98,25 +105,30 @@
 
   static bool is_call_before(address return_address) {
     ShouldNotCallThis();
+    return false;
   }
 };
 
 inline NativeCall* nativeCall_before(address return_address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 inline NativeCall* nativeCall_at(address address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 class NativeMovConstReg : public NativeInstruction {
  public:
   address next_instruction_address() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   intptr_t data() const {
     ShouldNotCallThis();
+    return 0;
   }
 
   void set_data(intptr_t x) {
@@ -126,12 +138,14 @@
 
 inline NativeMovConstReg* nativeMovConstReg_at(address address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 class NativeMovRegMem : public NativeInstruction {
  public:
   int offset() const {
     ShouldNotCallThis();
+    return 0;
   }
 
   void set_offset(intptr_t x) {
@@ -145,6 +159,7 @@
 
 inline NativeMovRegMem* nativeMovRegMem_at(address address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 class NativeJump : public NativeInstruction {
@@ -155,6 +170,7 @@
 
   address jump_destination() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   void set_jump_destination(address dest) {
@@ -172,12 +188,14 @@
 
 inline NativeJump* nativeJump_at(address address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 class NativeGeneralJump : public NativeInstruction {
  public:
   address jump_destination() const {
     ShouldNotCallThis();
+    return NULL;
   }
 
   static void insert_unconditional(address code_pos, address entry) {
@@ -191,6 +209,7 @@
 
 inline NativeGeneralJump* nativeGeneralJump_at(address address) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 #endif // CPU_ZERO_VM_NATIVEINST_ZERO_HPP
--- a/src/cpu/zero/vm/register_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/register_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -32,8 +32,10 @@
 
 const char* RegisterImpl::name() const {
   ShouldNotCallThis();
+  return NULL;
 }
 
 const char* FloatRegisterImpl::name() const {
   ShouldNotCallThis();
+  return NULL;
 }
--- a/src/cpu/zero/vm/relocInfo_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/relocInfo_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -37,6 +37,7 @@
 
 address Relocation::pd_call_destination(address orig_addr) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 void Relocation::pd_set_call_destination(address x) {
@@ -45,6 +46,7 @@
 
 address Relocation::pd_get_address_from_code() {
   ShouldNotCallThis();
+  return NULL;
 }
 
 address* Relocation::pd_address_in_code() {
@@ -54,6 +56,7 @@
 
 int Relocation::pd_breakpoint_size() {
   ShouldNotCallThis();
+  return 0;
 }
 
 void Relocation::pd_swap_in_breakpoint(address x,
--- a/src/cpu/zero/vm/sharedRuntime_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/sharedRuntime_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -89,6 +89,7 @@
                                                             ret_type);
 #else
   ShouldNotCallThis();
+  return NULL;
 #endif // SHARK
 }
 
@@ -99,6 +100,7 @@
 
 uint SharedRuntime::out_preserve_stack_slots() {
   ShouldNotCallThis();
+  return 0;
 }
 
 JRT_LEAF(void, zero_stub())
@@ -138,9 +140,11 @@
                                          VMRegPair *regs2,
                                          int total_args_passed) {
   ShouldNotCallThis();
+  return 0;
 }
 
 // Do we need to convert ints to longs for c calls?
 bool SharedRuntime::c_calling_convention_requires_ints_as_longs() {
   ShouldNotCallThis();
+  return false;
 }
--- a/src/cpu/zero/vm/vtableStubs_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/cpu/zero/vm/vtableStubs_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -39,16 +39,20 @@
 
 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 VtableStub* VtableStubs::create_itable_stub(int vtable_index) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
   ShouldNotCallThis();
+  return 0;
 }
 
 int VtableStub::pd_code_alignment() {
   ShouldNotCallThis();
+  return 0;
 }
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -746,6 +746,7 @@
   err.report_and_die();
 
   ShouldNotReachHere();
+  return false;
 }
 
 #ifdef _ALLBSD_SOURCE
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -66,6 +66,7 @@
 
 frame os::get_sender_for_C_frame(frame* fr) {
   ShouldNotCallThis();
+  return frame();
 }
 
 frame os::current_frame() {
@@ -103,16 +104,19 @@
 
 address os::Bsd::ucontext_get_pc(ucontext_t* uc) {
   ShouldNotCallThis();
+  return NULL;
 }
 
 ExtendedPC os::fetch_frame_from_context(void* ucVoid,
                                         intptr_t** ret_sp,
                                         intptr_t** ret_fp) {
   ShouldNotCallThis();
+  return ExtendedPC();
 }
 
 frame os::fetch_frame_from_context(void* ucVoid) {
   ShouldNotCallThis();
+  return frame();
 }
 
 extern "C" JNIEXPORT int
@@ -260,6 +264,7 @@
 
   sprintf(buf, fmt, sig, info->si_addr);
   fatal(buf);
+  return false;
 }
 
 void os::Bsd::init_thread_fpu_state(void) {
@@ -464,17 +469,7 @@
 
 extern "C" {
   int SpinPause() {
-  }
-
-  int SafeFetch32(int *adr, int errValue) {
-    int value = errValue;
-    value = *adr;
-    return value;
-  }
-  intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) {
-    intptr_t value = errValue;
-    value = *adr;
-    return value;
+    return 1;
   }
 
   void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
--- a/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp	Tue Feb 13 06:42:27 2018 +0000
@@ -110,6 +110,7 @@
                                            void* ucontext,
                                            bool isInJava) {
     ShouldNotCallThis();
+    return false;
   }
 
   // These routines are only used on cpu architectures that
--- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Tue Feb 13 06:42:27 2018 +0000
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2016 Red Hat, Inc.
  * 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,6 +61,7 @@
 
 frame os::get_sender_for_C_frame(frame* fr) {
   ShouldNotCallThis();
+  return frame(NULL, NULL); // silence compile warning.
 }
 
 frame os::current_frame() {
@@ -98,16 +99,19 @@
 
 address os::Linux::ucontext_get_pc(ucontext_t* uc) {
   ShouldNotCallThis();
+  return NULL; // silence compile warnings
 }
 
 ExtendedPC os::fetch_frame_from_context(void* ucVoid,
                                         intptr_t** ret_sp,
                                         intptr_t** ret_fp) {
   ShouldNotCallThis();
+  return NULL; // silence compile warnings
 }
 
 frame os::fetch_frame_from_context(void* ucVoid) {
   ShouldNotCallThis();
+  return frame(NULL, NULL); // silence compile warnings
 }
 
 extern "C" JNIEXPORT int
@@ -247,11 +251,12 @@
   }
 #endif // !PRODUCT
 
-  const char *fmt = "caught unhandled signal %d";
   char buf[64];
 
-  sprintf(buf, fmt, sig);
+  sprintf(buf, "caught unhandled signal %d", sig);
+
   fatal(buf);
+  return true; // silence compiler warnings
 }
 
 void os::Linux::init_thread_fpu_state(void) {
@@ -260,6 +265,7 @@
 
 int os::Linux::get_fpu_control_word() {
   ShouldNotCallThis();
+  return -1; // silence compile warnings
 }
 
 void os::Linux::set_fpu_control_word(int fpu) {
@@ -408,6 +414,7 @@
 
 extern "C" {
   int SpinPause() {
+      return -1; // silence compile warnings
   }
 
   int SafeFetch32(int *adr, int errValue) {
--- a/src/os_cpu/linux_zero/vm/thread_linux_zero.hpp	Tue Feb 13 05:26:46 2018 +0000
+++ b/src/os_cpu/linux_zero/vm/thread_linux_zero.hpp	Tue Feb 13 06:42:27 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -110,6 +110,7 @@
                                            void* ucontext,
                                            bool isInJava) {
     ShouldNotCallThis();
+    return false; // silence compile warning
   }
 
   // These routines are only used on cpu architectures that