aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-01-02 20:08:48 +0100
committerdec05eba <dec05eba@protonmail.com>2018-01-02 20:10:53 +0100
commitfb18bd235bc716963c72c1dd6358176cb50516ae (patch)
treecda9e38546c0d2a738dd9e2adc7f984d431e6beb
parent8ac9ddf460cc4c1b2972df1069128fb615b31042 (diff)
Add missing return statement causing segfault
Added compile flags to give error when missing return statement
-rw-r--r--CMakeLists.txt1
-rw-r--r--README.md2
-rw-r--r--backend/ninja/Ninja.cpp7
-rw-r--r--src/Conf.cpp2
-rw-r--r--src/GlobalLib.cpp4
5 files changed, 12 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 567d534..704b4c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,3 +23,4 @@ add_executable(sibs ${SOURCE_FILES})
include_directories(${CURL_INCLUDE_DIR} ${LibArchive_INCLUDE_DIR})
target_link_libraries(sibs ${CURL_LIBRARIES} ${LibArchive_LIBRARIES})
+target_compile_options(sibs PRIVATE -Wall -Wextra -Werror=return-type -fdiagnostics-show-option -fexceptions)
diff --git a/README.md b/README.md
index f328152..29a1685 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
Sibs is still in very early testing phase, should only be used if you want to toy around with it. Every new release currently has changes that break backwards compatibility since the design has not been decided yet.
Sibs is inspired by [Cargo](https://github.com/rust-lang/cargo/), you can think of it like a C/C++ version of Cargo.
+
+The CMakeLists.txt is only for development purpose and only compiles on linux.
# Installation
Newest version of sibs builds itself. If you don't already have sibs installed, you need to download latest release first: https://github.com/DEC05EBA/sibs/releases
After you've download the latest release, you can install it by running install.sh (or use sibs.exe if you are on windows).
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:
diff --git a/src/Conf.cpp b/src/Conf.cpp
index 852fcd4..3b0e246 100644
--- a/src/Conf.cpp
+++ b/src/Conf.cpp
@@ -383,6 +383,7 @@ namespace sibs
case PLATFORM_LINUX64: return "linux64";
case PLATFORM_WIN32: return "win32";
case PLATFORM_WIN64: return "win64";
+ default: return nullptr;
}
}
@@ -393,6 +394,7 @@ namespace sibs
case OPT_LEV_NONE: return "none";
case OPT_LEV_DEBUG: return "debug";
case OPT_LEV_RELEASE: return "release";
+ default: return nullptr;
}
}
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index 3334655..9083354 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -183,9 +183,7 @@ namespace sibs
if(sibsConfig.shouldUseCmake())
{
CmakeModule cmakeModule;
- Result<bool> cmakeCompileResult = cmakeModule.compile(sibsConfig, buildPath, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
- if(!cmakeCompileResult)
- return cmakeCompileResult;
+ return cmakeModule.compile(sibsConfig, buildPath, staticLinkerFlagCallbackFunc, dynamicLinkerFlagCallbackFunc, globalIncludeDirCallback);
}
else
{