summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jamroot.jam4
-rw-r--r--libdbpp/connection.cpp9
-rw-r--r--libdbpp/tablepatch.cpp3
-rw-r--r--libdbpp/unittests/Jamfile.jam2
m---------libdbpp/unittests/libdbpp-postgresql0
-rw-r--r--libdbpp/unittests/testUtils.cpp3
6 files changed, 16 insertions, 5 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index c480c8a..c9d6c33 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -15,6 +15,10 @@ project
<variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
<variant>coverage:<cxxflags>"--coverage"
<variant>coverage:<linkflags>"--coverage"
+ <toolset>tidy:<checkxx>boost-*
+ <toolset>tidy:<checkxx>bugprone-*
+ <toolset>tidy:<checkxx>clang-*
+ <toolset>tidy:<checkxx>misc-*
;
build-project libdbpp ;
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp
index 69e1e92..a3ae615 100644
--- a/libdbpp/connection.cpp
+++ b/libdbpp/connection.cpp
@@ -189,10 +189,17 @@ DB::TransactionScope::TransactionScope(DB::Connection & c) :
conn.beginTx();
}
+// It is acceptable for a commit to fail
+// NOLINTNEXTLINE(bugprone-exception-escape)
DB::TransactionScope::~TransactionScope()
{
if (std::uncaught_exceptions()) {
- conn.rollbackTx();
+ try {
+ conn.rollbackTx();
+ }
+ catch (...) {
+ // Nothing we can do here
+ }
}
else {
conn.commitTx();
diff --git a/libdbpp/tablepatch.cpp b/libdbpp/tablepatch.cpp
index 3c3796d..5df2aca 100644
--- a/libdbpp/tablepatch.cpp
+++ b/libdbpp/tablepatch.cpp
@@ -92,8 +92,7 @@ self(const typename Container::const_iterator & i)
return *i;
}
#define selfCols self<decltype(DB::TablePatch::cols)>
-#define isKey(tp) [tp](auto i){ return AdHoc::containerContains(tp->pk, *i); }
-#define isNotKey(tp) [tp](auto i){ return !AdHoc::containerContains(tp->pk, *i); }
+#define isNotKey(tp) [tp](auto i){ return !AdHoc::containerContains((tp)->pk, *i); }
static
void
diff --git a/libdbpp/unittests/Jamfile.jam b/libdbpp/unittests/Jamfile.jam
index a8fca66..95921cd 100644
--- a/libdbpp/unittests/Jamfile.jam
+++ b/libdbpp/unittests/Jamfile.jam
@@ -6,7 +6,7 @@ lib pq ;
lib mysqlclient : : : : <include>/usr/include/mysql ;
lib boost_date_time ;
lib boost_system ;
-lib boost_utf : : <name>boost_unit_test_framework ;
+lib boost_utf : : <name>boost_unit_test_framework : : <toolset>tidy:<xcheckxx>hicpp-* ;
lib Ice++11 ;
run
diff --git a/libdbpp/unittests/libdbpp-postgresql b/libdbpp/unittests/libdbpp-postgresql
-Subproject 283047d0db99da4579c54ac50bbc71ff358360d
+Subproject 6b913137275cacde9f938058f961d4cbb64f584
diff --git a/libdbpp/unittests/testUtils.cpp b/libdbpp/unittests/testUtils.cpp
index 4c28538..092140b 100644
--- a/libdbpp/unittests/testUtils.cpp
+++ b/libdbpp/unittests/testUtils.cpp
@@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE( bindIntPtr )
ins->execute();
delete is2;
auto sel = db->select("SELECT a, b FROM forEachRow");
- unsigned int total = 0;
+ double total = 0;
for (const auto & row : sel->as<std::optional<int64_t>, std::optional<double>>()) {
BOOST_REQUIRE(row[0].isNull());
BOOST_REQUIRE(!row[1].isNull());
@@ -381,6 +381,7 @@ testExtractT(DB::SelectCommandPtr sel) {
#ifdef __clang__
// Clang cannot compile this for reasons largely todo with ambiguousness in the spec
// Fixed when we move to std::chrono
+ // NOLINTNEXTLINE(bugprone-suspicious-semicolon)
if constexpr (!std::is_same<T, boost::posix_time::time_duration>::value) {
#else
if constexpr (true) {