summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jamroot.jam1
-rw-r--r--lib/compileTimeFormatter.h22
-rw-r--r--lib/mysql_types.cpp36
-rw-r--r--lib/rawDataReader.cpp8
-rw-r--r--test/test-bitset.cpp2
-rw-r--r--test/test-counters.cpp4
-rw-r--r--test/test-e2e.cpp34
-rw-r--r--test/test-postgresql.cpp4
-rw-r--r--test/test-streams.cpp4
9 files changed, 59 insertions, 56 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index edceeb1..7b58e75 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -25,6 +25,7 @@ project : requirements
<variant>debug:<cflags>-Wcast-align
<variant>debug:<cflags>-Wunused
<variant>debug:<cflags>-Woverloaded-virtual
+ <variant>debug:<cflags>-Wpedantic
<variant>debug:<cflags>-Wconversion
<variant>debug:<cflags>-Wsign-conversion
<variant>debug:<cflags>-Wnull-dereference
diff --git a/lib/compileTimeFormatter.h b/lib/compileTimeFormatter.h
index 7d69d4b..341e229 100644
--- a/lib/compileTimeFormatter.h
+++ b/lib/compileTimeFormatter.h
@@ -99,15 +99,15 @@ namespace MyGrate {
}
};
-#define StreamWriterT(C...) \
+#define StreamWriterT(...) \
template<const auto S, auto L, auto pos, typename stream, auto... sn> \
- struct StreamWriter<S, L, pos, stream, void, '%', C, sn...> : \
- public StreamWriterBase<S, L, BOOST_PP_VARIADIC_SIZE(C) + pos, stream>
+ struct StreamWriter<S, L, pos, stream, void, '%', __VA_ARGS__, sn...> : \
+ public StreamWriterBase<S, L, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__) + pos, stream>
-#define StreamWriterTP(P, C...) \
+#define StreamWriterTP(P, ...) \
template<const auto S, auto L, auto pos, typename stream, auto P, auto... sn> \
- struct StreamWriter<S, L, pos, stream, void, '%', C, sn...> : \
- public StreamWriterBase<S, L, BOOST_PP_VARIADIC_SIZE(C) + pos, stream>
+ struct StreamWriter<S, L, pos, stream, void, '%', __VA_ARGS__, sn...> : \
+ public StreamWriterBase<S, L, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__) + pos, stream>
// Default stream writer formatter
StreamWriterT('?') {
@@ -300,7 +300,7 @@ namespace MyGrate {
BASICCONV(BASE, OP, CONV); \
BASICCONV(short BASE, OP, 'h', CONV); \
BASICCONV(long BASE, OP, 'l', CONV); \
- BASICCONV(long long BASE, OP, 'l', 'l', CONV);
+ BASICCONV(long long BASE, OP, 'l', 'l', CONV)
INTCONV(int, s << std::dec << p, 'i');
INTCONV(int, s << std::dec << p, 'd');
INTCONV(unsigned int, s << std::oct << p, 'o');
@@ -323,7 +323,7 @@ namespace MyGrate {
// Floating point (a, A, e, E, f, F, g, G)
#define FPCONV(BASE, OP, CONV) \
BASICCONV(BASE, OP, CONV); \
- BASICCONV(long BASE, OP, 'L', CONV);
+ BASICCONV(long BASE, OP, 'L', CONV)
FPCONV(double, s << std::nouppercase << std::hexfloat << p, 'a');
FPCONV(double, s << std::uppercase << std::hexfloat << p, 'A');
FPCONV(double, s << std::nouppercase << std::scientific << p, 'e');
@@ -415,7 +415,7 @@ namespace MyGrate {
StreamWriter<S, L, pos + BOOST_PP_ADD(d, 1), stream, void, '%', nn, sn...>::write(s, pn...); \
} \
};
- BOOST_PP_REPEAT(6, FMTWIDTH, void);
+ BOOST_PP_REPEAT(6, FMTWIDTH, void)
#define FMTPRECISION(unused, d, data) \
template<const auto S, auto L, auto pos, typename stream, BOOST_PP_REPEAT(BOOST_PP_ADD(d, 1), AUTON, n), auto nn, \
auto... sn> \
@@ -431,7 +431,7 @@ namespace MyGrate {
StreamWriter<S, L, pos + BOOST_PP_ADD(d, 2), stream, void, '%', nn, sn...>::write(s, pn...); \
} \
};
- BOOST_PP_REPEAT(6, FMTPRECISION, void);
+ BOOST_PP_REPEAT(6, FMTPRECISION, void)
#undef AUTON
#undef NS
#undef ISDIGIT
@@ -467,7 +467,7 @@ namespace MyGrate {
OP; \
StreamWriter<S, L, pos + 1, stream, void, '%', sn...>::write(s, pn...); \
} \
- };
+ }
FLAGCONV(s << std::showbase, '#');
FLAGCONV(s << std::setfill('0'), '0');
FLAGCONV(s << std::left, '-');
diff --git a/lib/mysql_types.cpp b/lib/mysql_types.cpp
index 4480d23..626e789 100644
--- a/lib/mysql_types.cpp
+++ b/lib/mysql_types.cpp
@@ -15,8 +15,8 @@ namespace MyGrate::MySQL {
x = bswap_##B(x); \
return x; \
}
- NTOH(32);
- NTOH(64);
+ NTOH(32)
+ NTOH(64)
typename Type<MYSQL_TYPE_NULL, false>::C
Type<MYSQL_TYPE_NULL, false>::read(RawDataReader &, RawDataReader &)
@@ -33,10 +33,10 @@ namespace MyGrate::MySQL {
{ \
return data.readValue<typename Type<ET, true>::C>(); \
}
- INTEGER_TYPE(MYSQL_TYPE_TINY);
- INTEGER_TYPE(MYSQL_TYPE_SHORT);
- INTEGER_TYPE(MYSQL_TYPE_LONG);
- INTEGER_TYPE(MYSQL_TYPE_LONGLONG);
+ INTEGER_TYPE(MYSQL_TYPE_TINY)
+ INTEGER_TYPE(MYSQL_TYPE_SHORT)
+ INTEGER_TYPE(MYSQL_TYPE_LONG)
+ INTEGER_TYPE(MYSQL_TYPE_LONGLONG)
#undef INTEGER_TYPE
#define FLOAT_TYPE(ET) \
@@ -45,8 +45,8 @@ namespace MyGrate::MySQL {
verify<std::length_error>(sizeof(typename Type<ET>::C) == md.readValue<uint8_t>(), "Invalid " #ET " size"); \
return data.readValue<typename Type<ET>::C>(); \
}
- FLOAT_TYPE(MYSQL_TYPE_FLOAT);
- FLOAT_TYPE(MYSQL_TYPE_DOUBLE);
+ FLOAT_TYPE(MYSQL_TYPE_FLOAT)
+ FLOAT_TYPE(MYSQL_TYPE_DOUBLE)
#undef FLOAT_TYPE
typename Type<MYSQL_TYPE_DECIMAL>::C
@@ -66,8 +66,8 @@ namespace MyGrate::MySQL {
{ \
return data.readValue<typename Type<ET, s>::C, l>(); \
}
- INTEGER_TYPE(MYSQL_TYPE_INT24, false, 3);
- INTEGER_TYPE(MYSQL_TYPE_INT24, true, 3);
+ INTEGER_TYPE(MYSQL_TYPE_INT24, false, 3)
+ INTEGER_TYPE(MYSQL_TYPE_INT24, true, 3)
#undef INTEGER_TYPE
typename Type<MYSQL_TYPE_YEAR, false>::C
@@ -92,10 +92,10 @@ namespace MyGrate::MySQL {
{ \
return readBlob(md, data); \
}
- BLOB_TYPE(MYSQL_TYPE_TINY_BLOB);
- BLOB_TYPE(MYSQL_TYPE_MEDIUM_BLOB);
- BLOB_TYPE(MYSQL_TYPE_LONG_BLOB);
- BLOB_TYPE(MYSQL_TYPE_GEOMETRY); // Ummm, pass this to the target to handle?
+ BLOB_TYPE(MYSQL_TYPE_TINY_BLOB)
+ BLOB_TYPE(MYSQL_TYPE_MEDIUM_BLOB)
+ BLOB_TYPE(MYSQL_TYPE_LONG_BLOB)
+ BLOB_TYPE(MYSQL_TYPE_GEOMETRY) // Ummm, pass this to the target to handle?
#undef BLOB_TYPE
typename Type<MYSQL_TYPE_BLOB, false>::C
@@ -126,10 +126,10 @@ namespace MyGrate::MySQL {
} \
throw std::logic_error("Didn't return a value: " + std::to_string(realtype)); \
}
- STRING_TYPE(MYSQL_TYPE_STRING);
- STRING_TYPE(MYSQL_TYPE_JSON);
- STRING_TYPE(MYSQL_TYPE_SET);
- STRING_TYPE(MYSQL_TYPE_ENUM);
+ STRING_TYPE(MYSQL_TYPE_STRING)
+ STRING_TYPE(MYSQL_TYPE_JSON)
+ STRING_TYPE(MYSQL_TYPE_SET)
+ STRING_TYPE(MYSQL_TYPE_ENUM)
#undef STRING_TYPE
typename Type<MYSQL_TYPE_VARCHAR>::C
diff --git a/lib/rawDataReader.cpp b/lib/rawDataReader.cpp
index 90e227a..c0f32b5 100644
--- a/lib/rawDataReader.cpp
+++ b/lib/rawDataReader.cpp
@@ -26,9 +26,11 @@ namespace MyGrate {
uint64_t
RawDataReader::readValue<PackedInteger>()
{
- switch (const auto byte1 {readValue<uint8_t>()}) {
- case 0 ... 250: // The value as-is
- return byte1;
+ const auto byte1 {readValue<uint8_t>()};
+ if (byte1 <= 250) {
+ return byte1;
+ }
+ switch (byte1) {
case 252: // 2 bytes
return readValue<uint16_t, 2>();
case 253: // 3 bytes
diff --git a/test/test-bitset.cpp b/test/test-bitset.cpp
index 02b3893..c750b48 100644
--- a/test/test-bitset.cpp
+++ b/test/test-bitset.cpp
@@ -11,7 +11,7 @@
using namespace MyGrate;
// LCOV_EXCL_START
-BOOST_TEST_DONT_PRINT_LOG_VALUE(BitSet::Iterator);
+BOOST_TEST_DONT_PRINT_LOG_VALUE(BitSet::Iterator)
// LCOV_EXCL_STOP
BOOST_AUTO_TEST_CASE(bitset)
diff --git a/test/test-counters.cpp b/test/test-counters.cpp
index 1bc30dc..3f9740f 100644
--- a/test/test-counters.cpp
+++ b/test/test-counters.cpp
@@ -3,7 +3,7 @@
#include "helpers.h"
-BOOST_FIXTURE_TEST_SUITE(ec, EventCounterTarget);
+BOOST_FIXTURE_TEST_SUITE(ec, EventCounterTarget)
BOOST_AUTO_TEST_CASE(zero)
{
@@ -81,4 +81,4 @@ BOOST_AUTO_TEST_CASE(compare_many)
BOOST_CHECK(other >= *this);
}
-BOOST_AUTO_TEST_SUITE_END();
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/test-e2e.cpp b/test/test-e2e.cpp
index 8d9afb9..ca65e34 100644
--- a/test/test-e2e.cpp
+++ b/test/test-e2e.cpp
@@ -136,7 +136,7 @@ public:
std::optional<std::thread> repl;
};
-BOOST_FIXTURE_TEST_SUITE(setup, MockSetup);
+BOOST_FIXTURE_TEST_SUITE(setup, MockSetup)
BOOST_AUTO_TEST_CASE(e2e, *boost::unit_test::timeout(15))
{
@@ -330,20 +330,20 @@ replication_data_type_impl(Test * test)
replication_data_type_impl<T>(this); \
}
-TEST_MYSQL_TYPE(MYSQL_TYPE_STRING);
-TEST_MYSQL_TYPE(MYSQL_TYPE_VARCHAR);
-TEST_MYSQL_TYPE(MYSQL_TYPE_JSON);
+TEST_MYSQL_TYPE(MYSQL_TYPE_STRING)
+TEST_MYSQL_TYPE(MYSQL_TYPE_VARCHAR)
+TEST_MYSQL_TYPE(MYSQL_TYPE_JSON)
// TEST_MYSQL_TYPE(MYSQL_TYPE_ENUM); // we don't have sufficient data available to support this
-TEST_MYSQL_TYPE(MYSQL_TYPE_TINY);
-TEST_MYSQL_TYPE(MYSQL_TYPE_SHORT);
-TEST_MYSQL_TYPE(MYSQL_TYPE_LONG);
-TEST_MYSQL_TYPE(MYSQL_TYPE_INT24);
-TEST_MYSQL_TYPE(MYSQL_TYPE_LONGLONG);
-TEST_MYSQL_TYPE(MYSQL_TYPE_FLOAT);
-TEST_MYSQL_TYPE(MYSQL_TYPE_DOUBLE);
-TEST_MYSQL_TYPE(MYSQL_TYPE_YEAR);
-TEST_MYSQL_TYPE(MYSQL_TYPE_DATETIME);
-TEST_MYSQL_TYPE(MYSQL_TYPE_DATE);
-TEST_MYSQL_TYPE(MYSQL_TYPE_TIME);
-
-BOOST_AUTO_TEST_SUITE_END();
+TEST_MYSQL_TYPE(MYSQL_TYPE_TINY)
+TEST_MYSQL_TYPE(MYSQL_TYPE_SHORT)
+TEST_MYSQL_TYPE(MYSQL_TYPE_LONG)
+TEST_MYSQL_TYPE(MYSQL_TYPE_INT24)
+TEST_MYSQL_TYPE(MYSQL_TYPE_LONGLONG)
+TEST_MYSQL_TYPE(MYSQL_TYPE_FLOAT)
+TEST_MYSQL_TYPE(MYSQL_TYPE_DOUBLE)
+TEST_MYSQL_TYPE(MYSQL_TYPE_YEAR)
+TEST_MYSQL_TYPE(MYSQL_TYPE_DATETIME)
+TEST_MYSQL_TYPE(MYSQL_TYPE_DATE)
+TEST_MYSQL_TYPE(MYSQL_TYPE_TIME)
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/test-postgresql.cpp b/test/test-postgresql.cpp
index dda05ca..f1c7990 100644
--- a/test/test-postgresql.cpp
+++ b/test/test-postgresql.cpp
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(mock_schema)
BOOST_CHECK_EQUAL(rs->at(0, 0).operator unsigned int(), 0);
}
-BOOST_FIXTURE_TEST_SUITE(ms, MemStream);
+BOOST_FIXTURE_TEST_SUITE(ms, MemStream)
BOOST_DATA_TEST_CASE(write_strings,
boost::unit_test::data::make({
@@ -154,4 +154,4 @@ BOOST_AUTO_TEST_CASE(write_blob)
BOOST_CHECK_EQUAL(out, R"B(\\x0010123090AAFF000000)B");
}
-BOOST_AUTO_TEST_SUITE_END();
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/test-streams.cpp b/test/test-streams.cpp
index a4ff1a5..f037cc0 100644
--- a/test/test-streams.cpp
+++ b/test/test-streams.cpp
@@ -18,7 +18,7 @@ struct timespec;
struct tm;
#include <streamSupport.h>
-BOOST_FIXTURE_TEST_SUITE(stream, std::stringstream);
+BOOST_FIXTURE_TEST_SUITE(stream, std::stringstream)
template<typename In> using ToStream = std::tuple<In, std::string_view>;
BOOST_DATA_TEST_CASE(bytes,
@@ -102,4 +102,4 @@ BOOST_AUTO_TEST_CASE(vector)
BOOST_CHECK_EQUAL(this->str(), "[1,123456,-78910]");
}
-BOOST_AUTO_TEST_SUITE_END();
+BOOST_AUTO_TEST_SUITE_END()