From c61b229a213ac1f1cc50c6c4af53131578a91d53 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 28 Sep 2021 16:52:59 +0200 Subject: Fix -Wextra warnings from gcc. --- uunit.cc | 2 ++ uunit.h | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/uunit.cc b/uunit.cc index 609310a..ba894cb 100644 --- a/uunit.cc +++ b/uunit.cc @@ -10,6 +10,8 @@ int main(int argc, char* argv[]) { + (void)argc; + (void)argv; std::ofstream xmlfile; xmlfile.open("result_" OUTPUT ".xml"); return uUnit::runTests(xmlfile); diff --git a/uunit.h b/uunit.h index 4532ef8..92feb8d 100644 --- a/uunit.h +++ b/uunit.h @@ -50,7 +50,7 @@ public: std::size_t line; std::string msg; std::string failure_type; - int id; + std::size_t id; }; //! Run test @@ -118,7 +118,7 @@ public: continue; } status_cb(test.name, test.file, true); - test_result result{test.name}; + test_result result{test.name, {}, {}, {}, {}, {}}; result.id = test_num; successful_tests.push_back(result); } @@ -176,7 +176,7 @@ public: std::ostringstream ss; ss << "assertion failed" << std::endl << "- Expression: " << expr << "" << std::endl; - throw test_result{"", file, line, ss.str()}; + throw test_result{"", file, line, ss.str(), {}, {}}; } } //! Convenience macro to pass along filename and linenumber @@ -193,7 +193,7 @@ public: ss << "equality assertion failed" << std::endl << "- Expected: " << expected << "" << std::endl << "- Actual : " << value << "" << std::endl; - throw test_result{"", file, line, ss.str()}; + throw test_result{"", file, line, ss.str(), {}, {}}; } } @@ -207,7 +207,7 @@ public: ss << "equality assertion failed" << std::endl << "- Expected: " << expected << "" << std::endl << "- Actual : " << value << "" << std::endl; - throw test_result{"", file, line, ss.str()}; + throw test_result{"", file, line, ss.str(), {}, {}}; } } //! Convenience macro to pass along filename and linenumber @@ -226,7 +226,7 @@ public: ss << "throws assertion failed" << std::endl << "- Expected: " << expected << " to be thrown" << std::endl << "- Actual : no exception was thrown" << std::endl; - throw test_result{"", file, line, ss.str()}; + throw test_result{"", file, line, ss.str(), {}, {}}; } catch(const T& t) { @@ -238,7 +238,7 @@ public: ss << "throws assertion failed" << std::endl << "- Expected: " << expected << " to be thrown" << std::endl << "- Actual : unexpected exception was thrown" << std::endl; - throw test_result{"", file, line, ss.str()}; + throw test_result{"", file, line, ss.str(), {}, {}}; } } #define uUNIT_ASSERT_THROWS(expected, expr) \ @@ -307,6 +307,8 @@ namespace //! function pointer to a function with the same signature. void report_result(const char* name, const char* file, bool success) { + (void)name; + (void)file; if(success) { std::cout << "."; -- cgit v1.2.3