From 1e653e1b10f19454cd2dac621fd5bb1f19a7aeac Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 23 Apr 2024 06:12:20 +0200 Subject: Suppress bunch of unused/uninitialized warnings --- libodb-pgsql/odb/pgsql/statement.cxx | 3 +++ libodb-sqlite/odb/sqlite/statement.hxx | 2 ++ libodb/odb/nullable.hxx | 8 ++++---- libodb/odb/transaction.cxx | 2 ++ odb-tests/common/wrapper/test.hxx | 2 +- odb/odb/relational/source.cxx | 2 ++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libodb-pgsql/odb/pgsql/statement.cxx b/libodb-pgsql/odb/pgsql/statement.cxx index 8574c37..03d58cd 100644 --- a/libodb-pgsql/odb/pgsql/statement.cxx +++ b/libodb-pgsql/odb/pgsql/statement.cxx @@ -24,6 +24,8 @@ #include +#include + #include #include #include @@ -871,6 +873,7 @@ namespace odb // { PGresult* end (PQgetResult (ch)); + ODB_POTENTIALLY_UNUSED (end); assert (end == 0); } } diff --git a/libodb-sqlite/odb/sqlite/statement.hxx b/libodb-sqlite/odb/sqlite/statement.hxx index 9eeea7b..9228103 100644 --- a/libodb-sqlite/odb/sqlite/statement.hxx +++ b/libodb-sqlite/odb/sqlite/statement.hxx @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -139,6 +140,7 @@ namespace odb void active (bool active) { + ODB_POTENTIALLY_UNUSED (active); assert (active); if (!active_) diff --git a/libodb/odb/nullable.hxx b/libodb/odb/nullable.hxx index 75f5892..faa55c4 100644 --- a/libodb/odb/nullable.hxx +++ b/libodb/odb/nullable.hxx @@ -197,7 +197,7 @@ namespace odb nullable (const nullable& y) : null_ (y.null_) { - if (!null_) + if (!y.null_) new (&value_) T (y.value_); } @@ -206,7 +206,7 @@ namespace odb nullable (nullable&& y) : null_ (y.null_) { - if (!null_) + if (!y.null_) new (&value_) T (std::move (y.value_)); } @@ -216,7 +216,7 @@ namespace odb nullable (const nullable& y) : null_ (y.null_) { - if (!null_) + if (!y.null_) new (&value_) T (y.value_); } @@ -226,7 +226,7 @@ namespace odb nullable (nullable&& y) : null_ (y.null_) { - if (!null_) + if (!y.null_) new (&value_) T (std::move (y.value_)); } diff --git a/libodb/odb/transaction.cxx b/libodb/odb/transaction.cxx index f75cf32..03810a1 100644 --- a/libodb/odb/transaction.cxx +++ b/libodb/odb/transaction.cxx @@ -5,6 +5,7 @@ #include #include +#include using namespace std; @@ -335,6 +336,7 @@ namespace odb connection& transaction_impl:: connection (database_type* db) { + ODB_POTENTIALLY_UNUSED (db); assert (db == 0 || db == &database_); return *connection_; } diff --git a/odb-tests/common/wrapper/test.hxx b/odb-tests/common/wrapper/test.hxx index 3ae4151..91f5758 100644 --- a/odb-tests/common/wrapper/test.hxx +++ b/odb-tests/common/wrapper/test.hxx @@ -60,7 +60,7 @@ namespace test1 #pragma db value struct comp1 { - comp1 () {} + comp1 (): num (0) {} comp1 (const std::string& s, int n): str (s), num (n) {} std::string str; diff --git a/odb/odb/relational/source.cxx b/odb/odb/relational/source.cxx index e00626a..abc0a46 100644 --- a/odb/odb/relational/source.cxx +++ b/odb/odb/relational/source.cxx @@ -4383,6 +4383,7 @@ traverse_object (type& c) << endl; os << db << "::transaction& tr (" << db << "::transaction::current ());" + << "ODB_POTENTIALLY_UNUSED (tr);" << endl << "// The connection used by the current transaction and the" << endl << "// one used to prepare this statement must be the same." << endl @@ -5683,6 +5684,7 @@ traverse_view (type& c) << endl; os << db << "::transaction& tr (" << db << "::transaction::current ());" + << "ODB_POTENTIALLY_UNUSED (tr);" << endl << "// The connection used by the current transaction and the" << endl << "// one used to prepare this statement must be the same." << endl -- cgit v1.1