From fb18bd235bc716963c72c1dd6358176cb50516ae Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 2 Jan 2018 20:08:48 +0100 Subject: Add missing return statement causing segfault Added compile flags to give error when missing return statement --- backend/ninja/Ninja.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'backend/ninja') diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 4eecd6d..3a46af5 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -64,6 +64,9 @@ namespace backend case PackageType::DYNAMIC: case PackageType::LIBRARY: return Ninja::LibraryType::DYNAMIC; + default: + assert(false); + return (Ninja::LibraryType)-1; } } @@ -163,6 +166,7 @@ namespace backend { case Compiler::GCC: return ".o"; case Compiler::MSVC: return ".obj"; + default: return nullptr; } } @@ -620,7 +624,8 @@ namespace backend { case Compiler::GCC: { - result += " '-I" + config.getPackageName() + "@exe' '-I..' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' " + optimizationFlags + " '-g'"; + // -Werror + result += " '-I" + config.getPackageName() + "@exe' '-I..' -Wall -Wextra -Werror=return-type -fexceptions -fdiagnostics-show-option '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Winvalid-pch' '-Wnon-virtual-dtor' " + optimizationFlags + " '-g'"; break; } case Compiler::MSVC: -- cgit v1.2.3