aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-06-27 16:13:58 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:32 +0200
commit5bb7ee28bc4f5a0ee119de46165c507d6db995a3 (patch)
tree42f0c8751dcff69e27f5698f703c0f253d361fa6
parent02eb206cb76c9efd6cecf9f9493eecfa410d4da3 (diff)
Only show warnings in main project. TODO: Add option to show for dependencies
-rw-r--r--backend/ninja/Ninja.cpp22
-rw-r--r--include/Conf.hpp6
-rw-r--r--src/main.cpp2
3 files changed, 21 insertions, 9 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index ec6a237..59e8486 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -219,7 +219,7 @@ namespace backend
if(filepath && !containsSourceFile(filePathStr))
{
sourceFiles.emplace_back(filePathStr);
- printf("Adding source file: %s\n", filepath);
+ //printf("Adding source file: %s\n", filepath);
}
}
@@ -229,7 +229,7 @@ namespace backend
if(dir && !containsTestSourceDir(dirStr))
{
testSourceDirs.emplace_back(dirStr);
- printf("Adding test source directory: %s\n", dir);
+ //printf("Using test source directory: %s\n", dir);
}
}
@@ -361,7 +361,6 @@ namespace backend
if(!buildResult)
return buildResult;
}
-
return Result<bool>::Ok(true);
}
@@ -715,11 +714,14 @@ namespace backend
// -Werror
// TODO: Find equivalent -MMD -MP for other compilers than gcc. MMD is used to create "dependency files" -> if headers are modified then source files will be recompiled
// when compiling next time...
- result += " -fpie -MMD -MP '-I" + config.getPackageName() + "@exe' " + cflags + " '-I..' -Wall -Wextra -Werror=return-type -fdiagnostics-show-option '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Winvalid-pch' -fstack-protector " + optimizationFlags;
+ result += " -fpie -MMD -MP '-I" + config.getPackageName() + "@exe' " + cflags + " '-I..'";
+ if(config.showWarnings)
+ result += " -Wall -Wextra -Werror=return-type";
+ else
+ result += " -w";
+ result += " -fdiagnostics-show-option '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Winvalid-pch' -fstack-protector " + optimizationFlags;
if(sourceFileLanguage == SourceFileLanguage::CPP)
- {
result += " -fexceptions -Wnon-virtual-dtor";
- }
switch (config.getOptimizationLevel())
{
@@ -741,7 +743,11 @@ namespace backend
{
result += " ";
result += optimizationFlags;
- result += " /EHsc /W3 ";
+ result += " /EHs";
+ if(config.showWarnings)
+ result += "/Wall ";
+ else
+ result += "/w ";
result += cflags;
switch (config.getOptimizationLevel())
{
@@ -903,7 +909,7 @@ namespace backend
if (fileOverwriteResult.isErr())
return fileOverwriteResult;
- nprintf(TINYDIR_STRING("Created ninja build file: %s\n"), ninjaBuildFilePath.c_str());
+ //nprintf(TINYDIR_STRING("Created ninja build file: %s\n"), ninjaBuildFilePath.c_str());
Result<bool> buildResult = compile(savePath);
if (!buildResult)
diff --git a/include/Conf.hpp b/include/Conf.hpp
index c8c22e1..7117087 100644
--- a/include/Conf.hpp
+++ b/include/Conf.hpp
@@ -214,7 +214,8 @@ namespace sibs
cVersion(CVersion::C11),
cppVersion(CPPVersion::CPP14),
mainProject(false),
- sanitize(false)
+ sanitize(false),
+ showWarnings(false)
{
cmakeDirGlobal = projectPath;
cmakeDirStatic = cmakeDirGlobal;
@@ -406,6 +407,8 @@ namespace sibs
// Get define value by name.
// Return empty string if the value is empty or if the defined value doesn't exist
const std::string& getDefinedValue(const std::string &name) const;
+
+ bool showWarnings;
protected:
virtual void processObject(StringView name) override;
virtual void processField(StringView name, const ConfigValue &value) override;
@@ -460,6 +463,7 @@ namespace sibs
SibsTestConfig(Compiler _compiler, const FileString &_projectPath, OptimizationLevel _optimizationLevel) : SibsConfig(_compiler, _projectPath, _optimizationLevel, true)
{
packageName = "test";
+ showWarnings = true;
}
virtual ~SibsTestConfig(){}
diff --git a/src/main.cpp b/src/main.cpp
index 14e9a73..2dc1364 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -381,6 +381,7 @@ int buildProject(int argc, const _tinydir_char_t **argv)
#endif
SibsConfig sibsConfig(compiler, projectPath, optimizationLevel, false);
+ sibsConfig.showWarnings = true;
sibsConfig.setSanitize(sanitize);
return buildProject(projectPath, projectConfFilePath, sibsConfig);
}
@@ -445,6 +446,7 @@ int testProject(int argc, const _tinydir_char_t **argv)
#endif
SibsConfig sibsConfig(compiler, projectPath, OPT_LEV_DEBUG, true);
+ sibsConfig.showWarnings = true;
sibsConfig.setSanitize(sanitize);
return buildProject(projectPath, projectConfFilePath, sibsConfig);
}