diff --git a/CMakeLists.txt b/CMakeLists.txt index 505b0ccb64e8c..c8a74260c2b57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,11 +222,12 @@ ELSE() SET(CATA_WARNINGS "-Werror -Wall -Wextra \ -Wmissing-declarations \ + -Wmissing-noreturn \ -Wold-style-cast \ -Woverloaded-virtual \ -Wsuggest-override \ - -Wno-unknown-warning-option \ - -Wpedantic") + -Wpedantic \ + -Wno-unknown-warning-option") # Compact the whitespace in the warning string string(REGEX REPLACE "[\t ]+" " " CATA_WARNINGS "${CATA_WARNINGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CATA_WARNINGS}") diff --git a/Makefile b/Makefile index 91a67a3bfdb47..eafe5a32f0e83 100644 --- a/Makefile +++ b/Makefile @@ -90,11 +90,12 @@ RELEASE_FLAGS = WARNINGS = \ -Werror -Wall -Wextra \ -Wmissing-declarations \ + -Wmissing-noreturn \ -Wold-style-cast \ -Woverloaded-virtual \ + -Wpedantic \ -Wsuggest-override \ - -Wno-unknown-warning-option \ - -Wpedantic + -Wno-unknown-warning-option # Uncomment below to disable warnings #WARNINGS = -w DEBUGSYMS = -g diff --git a/src/json.h b/src/json.h index ad989ba533c35..4556268e3ee90 100644 --- a/src/json.h +++ b/src/json.h @@ -224,7 +224,6 @@ class JsonIn } catch( const io::InvalidEnumString & ) { seek( old_offset ); // so the error message points to the correct place. error( "invalid enumeration value" ); - throw; // ^^ error already throws, but the compiler doesn't know that )-: } } @@ -1013,8 +1012,8 @@ class JsonArray size_t size() const; bool empty(); std::string str(); // copy array json as string - void throw_error( std::string err ); - void throw_error( std::string err, int idx ); + [[noreturn]] void throw_error( std::string err ); + [[noreturn]] void throw_error( std::string err, int idx ); // iterative access bool next_bool(); @@ -1138,7 +1137,7 @@ class JsonValue return seek().test_array(); } - void throw_error( const std::string &err ) const { + [[noreturn]] void throw_error( const std::string &err ) const { seek().error( err ); } diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index c9ee7420a7d51..9540f4f7ce363 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -3409,7 +3409,7 @@ static void init_term_size_and_scaling_factor() int max_width, max_height; - int current_display_id = get_option( "DISPLAY" ); + int current_display_id = std::stoi( get_option( "DISPLAY" ) ); SDL_DisplayMode current_display; if( SDL_GetDesktopDisplayMode( current_display_id, ¤t_display ) == 0 ) {