Skip to content

Commit 044fb02

Browse files
committed
Fix: surpress warnings for TestVC4C
1 parent 7968f67 commit 044fb02

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

include/tools.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ namespace vc4c
173173
*
174174
* @return whether the parameter was successfully parsed and applied to the configuration
175175
*/
176-
bool parseConfigurationParameter(Configuration& config, const std::string& arg);
176+
bool parseConfigurationParameter(Configuration& config, bool, const std::string& arg);
177177

178178
} /* namespace tools */
179179
} /* namespace vc4c */

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ int main(int argc, char** argv)
214214
// increment `i` more than usual, because argv[i + 1] is already consumed
215215
i += 1;
216216
}
217-
else if(!vc4c::tools::parseConfigurationParameter(config, argv[i]) || strstr(argv[i], "-cl") == argv[i])
217+
else if(!vc4c::tools::parseConfigurationParameter(config, true, argv[i]) || strstr(argv[i], "-cl") == argv[i])
218218
// pass every not understood option to the pre-compiler, as well as every OpenCL compiler option
219219
options.append(argv[i]).append(" ");
220220
}

src/tools/options.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static std::set<std::string> createAvailableOptimizations()
2525
return opts;
2626
}
2727

28-
bool tools::parseConfigurationParameter(Configuration& config, const std::string& arg)
28+
bool tools::parseConfigurationParameter(Configuration& config, bool printFlag, const std::string& arg)
2929
{
3030
static auto availableOptimizations = createAvailableOptimizations();
3131
if(arg == "-cl-opt-disable")
@@ -151,7 +151,8 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string
151151
return true;
152152
}
153153

154-
std::cerr << "Cannot disable unknown optimization: " << passName << std::endl;
154+
if (printFlag)
155+
std::cerr << "Cannot disable unknown optimization: " << passName << std::endl;
155156
return false;
156157
}
157158
else if(arg.find("--f") == 0)
@@ -169,8 +170,9 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string
169170
}
170171
catch(std::exception& e)
171172
{
172-
std::cerr << "Error converting optimization parameter for '" << paramName << ": " << e.what()
173-
<< std::endl;
173+
if (printFlag)
174+
std::cerr << "Error converting optimization parameter for '" << paramName << ": " << e.what()
175+
<< std::endl;
174176
return false;
175177
}
176178
if(paramName == "combine-load-threshold")
@@ -189,7 +191,8 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string
189191
config.additionalOptions.maxCommonExpressionDinstance = static_cast<unsigned>(intValue);
190192
else
191193
{
192-
std::cerr << "Cannot set unknown optimization parameter: " << paramName << " to " << value << std::endl;
194+
if (printFlag)
195+
std::cerr << "Cannot set unknown optimization parameter: " << paramName << " to " << value << std::endl;
193196
return false;
194197
}
195198
return true;
@@ -200,7 +203,9 @@ bool tools::parseConfigurationParameter(Configuration& config, const std::string
200203
logging::debug() << "Enabling optimization: " << passName << logging::endl;
201204
return true;
202205
}
203-
std::cerr << "Cannot enable unknown optimization: " << passName << std::endl;
206+
207+
if (printFlag)
208+
std::cerr << "Cannot enable unknown optimization: " << passName << std::endl;
204209
return false;
205210
}
206211
return false;

test/test.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static Test::Suite* newConversionFunctionsTest()
108108
}
109109

110110
/*
111-
*
111+
*
112112
*/
113113
int main(int argc, char** argv)
114114
{
@@ -126,7 +126,7 @@ int main(int argc, char** argv)
126126
Test::registerSuite(newLLVMCompilationTest<false>, "test-compilation-llvm", "Runs all the compilation tests using the LLVM-IR front-end", false);
127127
Test::registerSuite(newSPIRVCompiltionTest<false>, "test-compilation-spirv", "Runs all the compilation tests using the SPIR-V front-end", false);
128128
Test::registerSuite(newFastRegressionTest, "fast-regressions", "Runs regression test-cases marked as fast", false);
129-
129+
130130
Test::registerSuite(newEmulatorTest, "test-emulator", "Runs selected code-samples through the emulator");
131131
Test::registerSuite(newMathFunctionsTest, "emulate-math", "Runs emulation tests for the OpenCL standard-library math functions");
132132
Test::registerSuite(Test::newInstance<TestGraph>, "test-graph", "Runs basic test for the graph data structure");
@@ -142,8 +142,8 @@ int main(int argc, char** argv)
142142
auto args = std::vector<char*>();
143143

144144
for(auto i = 1; i < argc; ++i)
145-
{
146-
if (!vc4c::tools::parseConfigurationParameter(config, argv[i]))
145+
{
146+
if (!vc4c::tools::parseConfigurationParameter(config, false, argv[i]))
147147
args.push_back(argv[i]);
148148

149149
//TODO rewrite, actually print same help (parts of it) as VC4C
@@ -153,4 +153,3 @@ int main(int argc, char** argv)
153153

154154
return Test::runSuites(int(args.size()), args.data());
155155
}
156-

0 commit comments

Comments
 (0)