Add -Werror=missing-noreturn (GCC, clang)

May be useful to diagnose functions which fail assertions unconditionally.
This commit is contained in:
Nekotekina 2021-04-08 00:52:18 +03:00
parent 94c62b1eec
commit 95725bf7fc
20 changed files with 55 additions and 36 deletions

View file

@ -35,12 +35,14 @@ namespace cfg
bool _base::from_string(const std::string&, bool) bool _base::from_string(const std::string&, bool)
{ {
fmt::throw_exception("from_string() purecall"); cfg_log.fatal("cfg::_base::from_string() purecall");
return false;
} }
bool _base::from_list(std::vector<std::string>&&) bool _base::from_list(std::vector<std::string>&&)
{ {
fmt::throw_exception("from_list() purecall"); cfg_log.fatal("cfg::_base::from_list() purecall");
return false;
} }
// Emit YAML // Emit YAML

View file

@ -230,7 +230,7 @@ namespace fs
{ {
} }
stat_t file_base::stat() [[noreturn]] stat_t file_base::stat()
{ {
fmt::throw_exception("fs::file::stat() not supported."); fmt::throw_exception("fs::file::stat() not supported.");
} }

View file

@ -81,7 +81,7 @@ namespace fs
{ {
virtual ~file_base(); virtual ~file_base();
virtual stat_t stat(); [[noreturn]] virtual stat_t stat();
virtual void sync(); virtual void sync();
virtual bool trunc(u64 length) = 0; virtual bool trunc(u64 length) = 0;
virtual u64 read(void* buffer, u64 size) = 0; virtual u64 read(void* buffer, u64 size) = 0;

View file

@ -289,6 +289,7 @@ asmjit::Runtime& asmjit::get_global_runtime()
#pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wredundant-decls" #pragma GCC diagnostic ignored "-Wredundant-decls"
#pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif #endif
#include "llvm/Support/TargetSelect.h" #include "llvm/Support/TargetSelect.h"
#include "llvm/Support/FormattedStream.h" #include "llvm/Support/FormattedStream.h"

View file

@ -189,6 +189,7 @@ inline FT build_function_asm(F&& builder)
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic ignored "-Winconsistent-missing-override" #pragma clang diagnostic ignored "-Winconsistent-missing-override"
#endif #endif

View file

@ -12,6 +12,7 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif #endif
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"

View file

@ -945,7 +945,7 @@ s32 cellFsAioInit(vm::cptr<char> mount_point)
cellFs.warning("cellFsAioInit(mount_point=%s)", mount_point); cellFs.warning("cellFsAioInit(mount_point=%s)", mount_point);
// TODO: create AIO thread (if not exists) for specified mount point // TODO: create AIO thread (if not exists) for specified mount point
fmt::throw_exception("cellFsAio disabled, use LLE."); cellFs.fatal("cellFsAio disabled, use LLE.");
return CELL_OK; return CELL_OK;
} }

View file

@ -1009,7 +1009,8 @@ error_code cellMicGetStatus(s32 dev_num, vm::ptr<CellMicStatus> status)
error_code cellMicStopEx() error_code cellMicStopEx()
{ {
fmt::throw_exception("Unexpected function"); cellMic.fatal("cellMicStopEx: unexpected function");
return CELL_OK;
} }
error_code cellMicSysShareClose() error_code cellMicSysShareClose()

View file

@ -175,7 +175,7 @@ void pngDecEndCallback(png_structp png_ptr, png_infop info)
} }
// Custom error handler for libpng // Custom error handler for libpng
void pngDecError(png_structp png_ptr, png_const_charp error_message) [[noreturn]] void pngDecError(png_structp png_ptr, png_const_charp error_message)
{ {
cellPngDec.error("%s", error_message); cellPngDec.error("%s", error_message);
// we can't return here or libpng blows up // we can't return here or libpng blows up

View file

@ -489,22 +489,26 @@ error_code cellSailSourceNotifyMediaStateChanged()
error_code cellSailSourceNotifyOpenCompleted() error_code cellSailSourceNotifyOpenCompleted()
{ {
fmt::throw_exception("Unexpected function"); cellSail.fatal("cellSailSourceNotifyOpenCompleted: unexpected function");
return CELL_OK;
} }
error_code cellSailSourceNotifyStartCompleted() error_code cellSailSourceNotifyStartCompleted()
{ {
fmt::throw_exception("Unexpected function"); cellSail.fatal("cellSailSourceNotifyStartCompleted: unexpected function");
return CELL_OK;
} }
error_code cellSailSourceNotifyStopCompleted() error_code cellSailSourceNotifyStopCompleted()
{ {
fmt::throw_exception("Unexpected function"); cellSail.fatal("cellSailSourceNotifyStopCompleted: unexpected function");
return CELL_OK;
} }
error_code cellSailSourceNotifyReadCompleted() error_code cellSailSourceNotifyReadCompleted()
{ {
fmt::throw_exception("Unexpected function"); cellSail.fatal("cellSailSourceNotifyReadCompleted: unexpected function");
return CELL_OK;
} }
error_code cellSailSourceSetDiagHandler() error_code cellSailSourceSetDiagHandler()
@ -515,7 +519,8 @@ error_code cellSailSourceSetDiagHandler()
error_code cellSailSourceNotifyCloseCompleted() error_code cellSailSourceNotifyCloseCompleted()
{ {
fmt::throw_exception("Unexpected function"); cellSail.fatal("cellSailSourceNotifyCloseCompleted: unexpected function");
return CELL_OK;
} }
error_code cellSailMp4MovieGetBrand() error_code cellSailMp4MovieGetBrand()

View file

@ -669,20 +669,20 @@ void cellSurMixerBeep(u32 arg)
f32 cellSurMixerUtilGetLevelFromDB(f32 dB) f32 cellSurMixerUtilGetLevelFromDB(f32 dB)
{ {
libmixer.todo("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB); libmixer.fatal("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB);
fmt::throw_exception("TODO"); return 0;
} }
f32 cellSurMixerUtilGetLevelFromDBIndex(s32 index) f32 cellSurMixerUtilGetLevelFromDBIndex(s32 index)
{ {
libmixer.todo("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index); libmixer.fatal("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index);
fmt::throw_exception("TODO"); return 0;
} }
f32 cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) f32 cellSurMixerUtilNoteToRatio(u8 refNote, u8 note)
{ {
libmixer.todo("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note); libmixer.fatal("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note);
fmt::throw_exception("TODO"); return 0;
} }
DECLARE(ppu_module_manager::libmixer)("libmixer", []() DECLARE(ppu_module_manager::libmixer)("libmixer", []()

View file

@ -140,7 +140,8 @@ error_code cellSysconfPs1emu_EFDDAF6C()
error_code sys_lv2coredump_D725F320() error_code sys_lv2coredump_D725F320()
{ {
fmt::throw_exception("Unknown, unimplemented."); sysPrxForUser.fatal("sys_lv2coredump_D725F320");
return CELL_OK;
} }
error_code sys_get_bd_media_id() error_code sys_get_bd_media_id()

View file

@ -3896,7 +3896,8 @@ bool ppu_interpreter::EQV(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::ECIWX(ppu_thread&, ppu_opcode_t) bool ppu_interpreter::ECIWX(ppu_thread&, ppu_opcode_t)
{ {
fmt::throw_exception("ECIWX"); ppu_log.fatal("ECIWX");
return false;
} }
bool ppu_interpreter::LHZUX(ppu_thread& ppu, ppu_opcode_t op) bool ppu_interpreter::LHZUX(ppu_thread& ppu, ppu_opcode_t op)
@ -4010,7 +4011,8 @@ bool ppu_interpreter::ORC(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::ECOWX(ppu_thread&, ppu_opcode_t) bool ppu_interpreter::ECOWX(ppu_thread&, ppu_opcode_t)
{ {
fmt::throw_exception("ECOWX"); ppu_log.fatal("ECOWX");
return false;
} }
bool ppu_interpreter::STHUX(ppu_thread& ppu, ppu_opcode_t op) bool ppu_interpreter::STHUX(ppu_thread& ppu, ppu_opcode_t op)

View file

@ -34,6 +34,7 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif #endif
#include "llvm/Support/FormattedStream.h" #include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"

View file

@ -95,7 +95,8 @@ namespace asmjit
bool spu_interpreter::UNK(spu_thread&, spu_opcode_t op) bool spu_interpreter::UNK(spu_thread&, spu_opcode_t op)
{ {
fmt::throw_exception("Unknown/Illegal instruction (0x%08x)", op.opcode); spu_log.fatal("Unknown/Illegal instruction (0x%08x)", op.opcode);
return false;
} }
@ -992,8 +993,8 @@ bool spu_interpreter_fast::FCGT(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCGT(spu_thread&, spu_opcode_t) bool spu_interpreter::DFCGT(spu_thread&, spu_opcode_t)
{ {
fmt::throw_exception("Unexpected instruction"); spu_log.fatal("DFCGT");
return true; return false;
} }
bool spu_interpreter_fast::FA(spu_thread& spu, spu_opcode_t op) bool spu_interpreter_fast::FA(spu_thread& spu, spu_opcode_t op)
@ -1079,8 +1080,8 @@ bool spu_interpreter_fast::FCMGT(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCMGT(spu_thread&, spu_opcode_t) bool spu_interpreter::DFCMGT(spu_thread&, spu_opcode_t)
{ {
fmt::throw_exception("Unexpected Instruction"); spu_log.fatal("DFCMGT");
return true; return false;
} }
bool spu_interpreter_fast::DFA(spu_thread& spu, spu_opcode_t op) bool spu_interpreter_fast::DFA(spu_thread& spu, spu_opcode_t op)
@ -1227,8 +1228,8 @@ bool spu_interpreter_fast::FSCRWR(spu_thread&, spu_opcode_t)
bool spu_interpreter::DFTSV(spu_thread&, spu_opcode_t) bool spu_interpreter::DFTSV(spu_thread&, spu_opcode_t)
{ {
fmt::throw_exception("Unexpected instruction"); spu_log.fatal("DFTSV");
return true; return false;
} }
bool spu_interpreter_fast::FCEQ(spu_thread& spu, spu_opcode_t op) bool spu_interpreter_fast::FCEQ(spu_thread& spu, spu_opcode_t op)
@ -1239,8 +1240,8 @@ bool spu_interpreter_fast::FCEQ(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCEQ(spu_thread&, spu_opcode_t) bool spu_interpreter::DFCEQ(spu_thread&, spu_opcode_t)
{ {
fmt::throw_exception("Unexpected instruction"); spu_log.fatal("DFCEQ");
return true; return false;
} }
bool spu_interpreter::MPY(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::MPY(spu_thread& spu, spu_opcode_t op)
@ -1283,8 +1284,8 @@ bool spu_interpreter_fast::FCMEQ(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCMEQ(spu_thread&, spu_opcode_t) bool spu_interpreter::DFCMEQ(spu_thread&, spu_opcode_t)
{ {
fmt::throw_exception("Unexpected instruction"); spu_log.fatal("DFCMEQ");
return true; return false;
} }
bool spu_interpreter::MPYU(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::MPYU(spu_thread& spu, spu_opcode_t op)

View file

@ -3220,6 +3220,7 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wstrict-aliasing" #pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Weffc++" #pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif #endif
#include "llvm/ADT/Triple.h" #include "llvm/ADT/Triple.h"
#include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManager.h"
@ -5311,7 +5312,7 @@ public:
call(name, &exec_fall<F>, m_thread, m_ir->getInt32(op.opcode)); call(name, &exec_fall<F>, m_thread, m_ir->getInt32(op.opcode));
} }
static void exec_unk(spu_thread*, u32 op) [[noreturn]] static void exec_unk(spu_thread*, u32 op)
{ {
fmt::throw_exception("Unknown/Illegal instruction (0x%08x)", op); fmt::throw_exception("Unknown/Illegal instruction (0x%08x)", op);
} }

View file

@ -4675,7 +4675,8 @@ void spu_thread::halt()
spu_runtime::g_escape(this); spu_runtime::g_escape(this);
} }
fmt::throw_exception("Halt"); spu_log.fatal("Halt");
spu_runtime::g_escape(this);
} }
void spu_thread::fast_call(u32 ls_addr) void spu_thread::fast_call(u32 ls_addr)

View file

@ -631,7 +631,7 @@ namespace vm
}); });
} }
void reservation_escape_internal() [[noreturn]] void reservation_escape_internal()
{ {
const auto _cpu = get_current_cpu_thread(); const auto _cpu = get_current_cpu_thread();

View file

@ -324,7 +324,7 @@ namespace vm
} }
// For internal usage // For internal usage
void reservation_escape_internal(); [[noreturn]] void reservation_escape_internal();
// Read memory value in pseudo-atomic manner // Read memory value in pseudo-atomic manner
template <typename CPU, typename T, typename AT = u32, typename F> template <typename CPU, typename T, typename AT = u32, typename F>

View file

@ -32,6 +32,7 @@ else()
add_compile_options(-Werror=reorder) add_compile_options(-Werror=reorder)
add_compile_options(-Werror=return-type) add_compile_options(-Werror=return-type)
add_compile_options(-Werror=overloaded-virtual) add_compile_options(-Werror=overloaded-virtual)
add_compile_options(-Werror=missing-noreturn)
add_compile_options(-Wunused-parameter) add_compile_options(-Wunused-parameter)
add_compile_options(-Wignored-qualifiers) add_compile_options(-Wignored-qualifiers)
add_compile_options(-Wredundant-move) add_compile_options(-Wredundant-move)