test: exception: suppress scan-build errors
We have a testcase that purposefully accesses a moved-from object
and 'scan-build' complains about it. Suppress the warning.
Also remove a check on the moved-from string, because the std library is
not required to reset a moved-from string.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0307c82d38733e9b0b7ff30fc8167310ba49a429
diff --git a/test/exception/sdbus_error.cpp b/test/exception/sdbus_error.cpp
index c7ab862..6183d77 100644
--- a/test/exception/sdbus_error.cpp
+++ b/test/exception/sdbus_error.cpp
@@ -91,11 +91,14 @@
// Move our SdBusError to a new one
SdBusError errNew(std::move(err));
+ // We are purposefully calling functions on a moved-from object,
+ // so we need to suppress the clang warnings.
+#ifndef __clang_analyzer__
// Ensure the old object was cleaned up
EXPECT_EQ(0, err.get_errno());
EXPECT_EQ(nullptr, err.name());
EXPECT_EQ(nullptr, err.description());
- EXPECT_EQ(std::string{}, err.what());
+#endif
// Ensure our new object has the same data but moved
EXPECT_EQ(errorVal, errNew.get_errno());
@@ -106,11 +109,14 @@
// Move our SdBusError using the operator=()
errFinal = std::move(errNew);
+ // We are purposefully calling functions on a moved-from object,
+ // so we need to suppress the clang warnings.
+#ifndef __clang_analyzer__
// Ensure the old object was cleaned up
EXPECT_EQ(0, errNew.get_errno());
EXPECT_EQ(nullptr, errNew.name());
EXPECT_EQ(nullptr, errNew.description());
- EXPECT_EQ(std::string{}, errNew.what());
+#endif
}
// Ensure our new object has the same data but moved