From a16efaee1ae4aed8a526fb4db2710595fcecd0bc Mon Sep 17 00:00:00 2001 From: Ryohei Tokuda Date: Tue, 18 Dec 2018 22:49:14 +0900 Subject: [PATCH] Fix: surpress warnings for TestVC4C --- include/tools.h | 2 +- src/main.cpp | 2 +- src/tools/options.cpp | 18 ++++++++++++------ test/test.cpp | 9 ++++----- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/include/tools.h b/include/tools.h index 5c51f3a8..4026ae2f 100644 --- a/include/tools.h +++ b/include/tools.h @@ -173,7 +173,7 @@ namespace vc4c * * @return whether the parameter was successfully parsed and applied to the configuration */ - bool parseConfigurationParameter(Configuration& config, const std::string& arg); + bool parseConfigurationParameter(Configuration& config, bool, const std::string& arg); } /* namespace tools */ } /* namespace vc4c */ diff --git a/src/main.cpp b/src/main.cpp index 575334bf..b6992558 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -214,7 +214,7 @@ int main(int argc, char** argv) // increment `i` more than usual, because argv[i + 1] is already consumed i += 1; } - else if(!vc4c::tools::parseConfigurationParameter(config, argv[i]) || strstr(argv[i], "-cl") == argv[i]) + else if(!vc4c::tools::parseConfigurationParameter(config, true, argv[i]) || strstr(argv[i], "-cl") == argv[i]) // pass every not understood option to the pre-compiler, as well as every OpenCL compiler option options.append(argv[i]).append(" "); } diff --git a/src/tools/options.cpp b/src/tools/options.cpp index 990a838e..617f5539 100644 --- a/src/tools/options.cpp +++ b/src/tools/options.cpp @@ -25,7 +25,7 @@ static std::set createAvailableOptimizations() return opts; } -bool tools::parseConfigurationParameter(Configuration& config, const std::string& arg) +bool tools::parseConfigurationParameter(Configuration& config, bool printFlag, const std::string& arg) { static auto availableOptimizations = createAvailableOptimizations(); if(arg == "-cl-opt-disable") @@ -151,7 +151,8 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string return true; } - std::cerr << "Cannot disable unknown optimization: " << passName << std::endl; + if(printFlag) + std::cerr << "Cannot disable unknown optimization: " << passName << std::endl; return false; } else if(arg.find("--f") == 0) @@ -169,8 +170,9 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string } catch(std::exception& e) { - std::cerr << "Error converting optimization parameter for '" << paramName << ": " << e.what() - << std::endl; + if(printFlag) + std::cerr << "Error converting optimization parameter for '" << paramName << ": " << e.what() + << std::endl; return false; } if(paramName == "combine-load-threshold") @@ -189,7 +191,9 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string config.additionalOptions.maxCommonExpressionDinstance = static_cast(intValue); else { - std::cerr << "Cannot set unknown optimization parameter: " << paramName << " to " << value << std::endl; + if(printFlag) + std::cerr << "Cannot set unknown optimization parameter: " << paramName << " to " << value + << std::endl; return false; } return true; @@ -200,7 +204,9 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string logging::debug() << "Enabling optimization: " << passName << logging::endl; return true; } - std::cerr << "Cannot enable unknown optimization: " << passName << std::endl; + + if(printFlag) + std::cerr << "Cannot enable unknown optimization: " << passName << std::endl; return false; } return false; diff --git a/test/test.cpp b/test/test.cpp index 19592a95..ecf2a7a8 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -108,7 +108,7 @@ static Test::Suite* newConversionFunctionsTest() } /* - * + * */ int main(int argc, char** argv) { @@ -126,7 +126,7 @@ int main(int argc, char** argv) Test::registerSuite(newLLVMCompilationTest, "test-compilation-llvm", "Runs all the compilation tests using the LLVM-IR front-end", false); Test::registerSuite(newSPIRVCompiltionTest, "test-compilation-spirv", "Runs all the compilation tests using the SPIR-V front-end", false); Test::registerSuite(newFastRegressionTest, "fast-regressions", "Runs regression test-cases marked as fast", false); - + Test::registerSuite(newEmulatorTest, "test-emulator", "Runs selected code-samples through the emulator"); Test::registerSuite(newMathFunctionsTest, "emulate-math", "Runs emulation tests for the OpenCL standard-library math functions"); Test::registerSuite(Test::newInstance, "test-graph", "Runs basic test for the graph data structure"); @@ -142,8 +142,8 @@ int main(int argc, char** argv) auto args = std::vector(); for(auto i = 1; i < argc; ++i) - { - if (!vc4c::tools::parseConfigurationParameter(config, argv[i])) + { + if (!vc4c::tools::parseConfigurationParameter(config, false, argv[i])) args.push_back(argv[i]); //TODO rewrite, actually print same help (parts of it) as VC4C @@ -153,4 +153,3 @@ int main(int argc, char** argv) return Test::runSuites(int(args.size()), args.data()); } -