Avoid bogus MSVC warning about unreachable code

The compiler somehow gives a warning about the loop line in this test
being unreachable, even though it clearly is.

Restructure the code to avoid returning from the loop to avoid it.
This commit is contained in:
Vadim Zeitlin
2025-06-07 17:16:02 +02:00
parent 6e4a327cd1
commit 2128706be4

View File

@@ -180,6 +180,7 @@ TEST_CASE("MS SQL table records count", "[odbc][mssql][count]")
soci::rowset<soci::row> rs = (sql.prepare << sql_query);
// Check that we can access the results.
bool hasTables = false;
for (soci::row const& row : rs)
{
std::string instance_name = row.get<std::string>(0);
@@ -193,10 +194,10 @@ TEST_CASE("MS SQL table records count", "[odbc][mssql][count]")
INFO("Table " << instance_name << "." << table_name <<
" has " << number_of_records << " records");
CHECK( database_name == "master" );
return;
hasTables = true;
}
FAIL("No tables found in the master database");
CHECK(hasTables);
}
// DDL Creation objects for common tests