diff options
-rw-r--r-- | Jamroot.jam | 1 | ||||
-rw-r--r-- | libadhocutil/compileTimeFormatter.h | 15 | ||||
-rw-r--r-- | libadhocutil/ctf-impl/printf-compat.h | 10 | ||||
-rw-r--r-- | libadhocutil/globalStatic.impl.h | 2 | ||||
-rw-r--r-- | libadhocutil/lexer-regex.h | 2 | ||||
-rw-r--r-- | libadhocutil/unittests/testCaseLess.cpp | 2 | ||||
-rw-r--r-- | libadhocutil/unittests/testCompileTimeFormatter.cpp | 160 | ||||
-rw-r--r-- | libadhocutil/unittests/testFactory.cpp | 10 | ||||
-rw-r--r-- | libadhocutil/unittests/testLazyPointer.cpp | 4 | ||||
-rw-r--r-- | libadhocutil/unittests/testMemStream.cpp | 4 | ||||
-rw-r--r-- | libadhocutil/unittests/testNvpParse.cpp | 2 | ||||
-rw-r--r-- | libadhocutil/unittests/utilTestClasses.cpp | 4 |
12 files changed, 110 insertions, 106 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index c528089..e3d0edc 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -22,6 +22,7 @@ project <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/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h index de7376b..2524043 100644 --- a/libadhocutil/compileTimeFormatter.h +++ b/libadhocutil/compileTimeFormatter.h @@ -106,15 +106,15 @@ namespace AdHoc { } }; -#define StreamWriterT(C...) \ +#define StreamWriterT(...) \ template<CtfString 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<CtfString 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('?') { @@ -317,6 +317,8 @@ namespace AdHoc { return AdHoc::FormatterDetail<Str, Str.size()>(); } #else +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" # ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template" @@ -335,6 +337,7 @@ namespace AdHoc { #ifdef __clang__ # pragma clang diagnostic pop #endif +#pragma GCC diagnostic pop } } diff --git a/libadhocutil/ctf-impl/printf-compat.h b/libadhocutil/ctf-impl/printf-compat.h index 872f9af..aa0ead9 100644 --- a/libadhocutil/ctf-impl/printf-compat.h +++ b/libadhocutil/ctf-impl/printf-compat.h @@ -29,7 +29,7 @@ namespace AdHoc { 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'); @@ -52,7 +52,7 @@ namespace AdHoc { // 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'); @@ -144,7 +144,7 @@ namespace AdHoc { 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<CtfString S, auto L, auto pos, typename stream, BOOST_PP_REPEAT(BOOST_PP_ADD(d, 1), AUTON, n), auto nn, \ auto... sn> \ @@ -160,7 +160,7 @@ namespace AdHoc { 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 @@ -202,7 +202,7 @@ namespace AdHoc { 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/libadhocutil/globalStatic.impl.h b/libadhocutil/globalStatic.impl.h index fd611c3..ba12da8 100644 --- a/libadhocutil/globalStatic.impl.h +++ b/libadhocutil/globalStatic.impl.h @@ -33,6 +33,6 @@ namespace AdHoc { static Ptr _instance; return _instance; } -}; +} #endif diff --git a/libadhocutil/lexer-regex.h b/libadhocutil/lexer-regex.h index a469987..0673458 100644 --- a/libadhocutil/lexer-regex.h +++ b/libadhocutil/lexer-regex.h @@ -22,6 +22,6 @@ namespace AdHoc { DLL_PUBLIC Lexer::PatternPtr regex(const Glib::ustring & regex, GRegexCompileFlags compile = GRegexCompileFlags {}, GRegexMatchFlags match = GRegexMatchFlags {}); } -}; +} #endif diff --git a/libadhocutil/unittests/testCaseLess.cpp b/libadhocutil/unittests/testCaseLess.cpp index 90d06de..e92f8af 100644 --- a/libadhocutil/unittests/testCaseLess.cpp +++ b/libadhocutil/unittests/testCaseLess.cpp @@ -5,7 +5,7 @@ #include <string> #include <string_view> -BOOST_FIXTURE_TEST_SUITE(l, AdHoc::case_less); +BOOST_FIXTURE_TEST_SUITE(l, AdHoc::case_less) BOOST_AUTO_TEST_CASE(case_less_test) { diff --git a/libadhocutil/unittests/testCompileTimeFormatter.cpp b/libadhocutil/unittests/testCompileTimeFormatter.cpp index a6968c4..877f3e8 100644 --- a/libadhocutil/unittests/testCompileTimeFormatter.cpp +++ b/libadhocutil/unittests/testCompileTimeFormatter.cpp @@ -132,7 +132,7 @@ static_assert(strchrnul<formatStringLiteral, 'e'>() == 3); static_assert(strchrnul<formatStringLiteral, 'f'>() == 7); #endif -BOOST_FIXTURE_TEST_SUITE(TestStreamWrite, std::stringstream); +BOOST_FIXTURE_TEST_SUITE(TestStreamWrite, std::stringstream) BOOST_AUTO_TEST_CASE(empty) { @@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(longFormatString) BOOST_CHECK_EQUAL(this->str().length(), 246); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_CASE(customMultiArgRightAlign) { @@ -361,86 +361,86 @@ static_assert(419 == decdigits<'0', '4', '1', '9'>()); } \ } -GLIBC_FMT_TEST(s1, "in %s.", "string"); -GLIBC_FMT_TEST(s2, "in %s %s.", "string", "other"); -GLIBC_FMT_TEST(s3, "in %.*s.", 3, "other"); -GLIBC_FMT_TEST(s4, "in %.*s.", 5, "other"); -GLIBC_FMT_TEST(s5, "in %.*s.", 7, "other"); -GLIBC_FMT_TEST(s35, "in %3s.", "other"); -GLIBC_FMT_TEST(s55, "in %5s.", "other"); -GLIBC_FMT_TEST(s115, "in %11s.", "other"); +GLIBC_FMT_TEST(s1, "in %s.", "string") +GLIBC_FMT_TEST(s2, "in %s %s.", "string", "other") +GLIBC_FMT_TEST(s3, "in %.*s.", 3, "other") +GLIBC_FMT_TEST(s4, "in %.*s.", 5, "other") +GLIBC_FMT_TEST(s5, "in %.*s.", 7, "other") +GLIBC_FMT_TEST(s35, "in %3s.", "other") +GLIBC_FMT_TEST(s55, "in %5s.", "other") +GLIBC_FMT_TEST(s115, "in %11s.", "other") // std::setw does not truncate strings -// GLIBC_FMT_TEST(sd35, "in %.3s.", "other"); -GLIBC_FMT_TEST(sd55, "in %.5s.", "other"); -GLIBC_FMT_TEST(sd115, "in %.11s.", "other"); - -GLIBC_FMT_TEST(c1, "in %c.", 'b'); -GLIBC_FMT_TEST(c2, "in %c.", 'B'); - -GLIBC_FMT_TEST(d1, "in %d.", 123); -GLIBC_FMT_TEST(d01, "in %0d.", 123); -GLIBC_FMT_TEST(d051, "in %05d.", 123); -GLIBC_FMT_TEST(d0511, "in % 50d.", 123); -GLIBC_FMT_TEST(d05121, "in %0510d.", 123); -GLIBC_FMT_TEST(d2, "in %d.", 123456); -GLIBC_FMT_TEST(d3, "in %hd.", static_cast<int16_t>(-12345)); -GLIBC_FMT_TEST(d4, "in %hhd.", static_cast<int8_t>(-123)); -GLIBC_FMT_TEST(d5, "in %ld.", -123456L); -GLIBC_FMT_TEST(d6, "in %lld.", -123456LL); -GLIBC_FMT_TEST(i1, "in %i.", 123); -GLIBC_FMT_TEST(i2, "in %i.", -123); - -GLIBC_FMT_TEST(x1, "in %x.", 123U); -GLIBC_FMT_TEST(x2, "in %x %d.", 123U, 256); -GLIBC_FMT_TEST(x3, "in %d %x.", 123, 1024U); -GLIBC_FMT_TEST(x4, "in %X %x.", 123U, 13U); -GLIBC_FMT_TEST(x5, "in %X %s.", 123U, "miXED case after UPPER X"); -GLIBC_FMT_TEST(x6, "in %#x.", 123U); -GLIBC_FMT_TEST(x7, "in %#X.", 123U); -GLIBC_FMT_TEST(x8, "in %#X %x.", 123U, 150U); - -GLIBC_FMT_TEST(o1, "in %o.", 123U); -GLIBC_FMT_TEST(o2, "in %o %d.", 123U, 256); -GLIBC_FMT_TEST(o3, "in %d %o.", 123, 1024U); - -GLIBC_FMT_TEST(a1, "in %a.", 123.456789); -GLIBC_FMT_TEST(a2, "in %a.", -123.456789); -GLIBC_FMT_TEST(a3, "in %a.", .123456789); -GLIBC_FMT_TEST(a4, "in %a.", -.123456789); -GLIBC_FMT_TEST(a5, "in %A.", -.123456789); -GLIBC_FMT_TEST(a6, "in %A.", -123.456789); -GLIBC_FMT_TEST(a7, "in %a.", 123456789.123); -GLIBC_FMT_TEST(a8, "in %a.", -123456789.123); - -GLIBC_FMT_TEST(e1, "in %e.", 123.456789); -GLIBC_FMT_TEST(e2, "in %e.", -123.456789); -GLIBC_FMT_TEST(e3, "in %e.", .123456789); -GLIBC_FMT_TEST(e4, "in %e.", -.123456789); -GLIBC_FMT_TEST(e5, "in %E.", -.123456789); -GLIBC_FMT_TEST(e6, "in %E.", -123.456789); -GLIBC_FMT_TEST(e7, "in %e.", 123456789.123); -GLIBC_FMT_TEST(e8, "in %e.", -123456789.123); - -GLIBC_FMT_TEST(f1, "in %f.", 123.456789); -GLIBC_FMT_TEST(f2, "in %f.", -123.456789); -GLIBC_FMT_TEST(f3, "in %f.", .123456789); -GLIBC_FMT_TEST(f4, "in %f.", -.123456789); -GLIBC_FMT_TEST(f5, "in %F.", -.123456789); -GLIBC_FMT_TEST(f6, "in %F.", -123.456789); -GLIBC_FMT_TEST(f7, "in %f.", 123456789.123); -GLIBC_FMT_TEST(f8, "in %f.", -123456789.123); - -GLIBC_FMT_TEST(g1, "in %g.", 123.456789); -GLIBC_FMT_TEST(g2, "in %g.", -123.456789); -GLIBC_FMT_TEST(g3, "in %g.", .123456789); -GLIBC_FMT_TEST(g4, "in %g.", -.123456789); -GLIBC_FMT_TEST(g5, "in %G.", -.123456789); -GLIBC_FMT_TEST(g6, "in %G.", -123.456789); -GLIBC_FMT_TEST(g7, "in %g.", 123456789.123); -GLIBC_FMT_TEST(g8, "in %g.", -123456789.123); +// GLIBC_FMT_TEST(sd35, "in %.3s.", "other") +GLIBC_FMT_TEST(sd55, "in %.5s.", "other") +GLIBC_FMT_TEST(sd115, "in %.11s.", "other") + +GLIBC_FMT_TEST(c1, "in %c.", 'b') +GLIBC_FMT_TEST(c2, "in %c.", 'B') + +GLIBC_FMT_TEST(d1, "in %d.", 123) +GLIBC_FMT_TEST(d01, "in %0d.", 123) +GLIBC_FMT_TEST(d051, "in %05d.", 123) +GLIBC_FMT_TEST(d0511, "in % 50d.", 123) +GLIBC_FMT_TEST(d05121, "in %0510d.", 123) +GLIBC_FMT_TEST(d2, "in %d.", 123456) +GLIBC_FMT_TEST(d3, "in %hd.", static_cast<int16_t>(-12345)) +GLIBC_FMT_TEST(d4, "in %hhd.", static_cast<int8_t>(-123)) +GLIBC_FMT_TEST(d5, "in %ld.", -123456L) +GLIBC_FMT_TEST(d6, "in %lld.", -123456LL) +GLIBC_FMT_TEST(i1, "in %i.", 123) +GLIBC_FMT_TEST(i2, "in %i.", -123) + +GLIBC_FMT_TEST(x1, "in %x.", 123U) +GLIBC_FMT_TEST(x2, "in %x %d.", 123U, 256) +GLIBC_FMT_TEST(x3, "in %d %x.", 123, 1024U) +GLIBC_FMT_TEST(x4, "in %X %x.", 123U, 13U) +GLIBC_FMT_TEST(x5, "in %X %s.", 123U, "miXED case after UPPER X") +GLIBC_FMT_TEST(x6, "in %#x.", 123U) +GLIBC_FMT_TEST(x7, "in %#X.", 123U) +GLIBC_FMT_TEST(x8, "in %#X %x.", 123U, 150U) + +GLIBC_FMT_TEST(o1, "in %o.", 123U) +GLIBC_FMT_TEST(o2, "in %o %d.", 123U, 256) +GLIBC_FMT_TEST(o3, "in %d %o.", 123, 1024U) + +GLIBC_FMT_TEST(a1, "in %a.", 123.456789) +GLIBC_FMT_TEST(a2, "in %a.", -123.456789) +GLIBC_FMT_TEST(a3, "in %a.", .123456789) +GLIBC_FMT_TEST(a4, "in %a.", -.123456789) +GLIBC_FMT_TEST(a5, "in %A.", -.123456789) +GLIBC_FMT_TEST(a6, "in %A.", -123.456789) +GLIBC_FMT_TEST(a7, "in %a.", 123456789.123) +GLIBC_FMT_TEST(a8, "in %a.", -123456789.123) + +GLIBC_FMT_TEST(e1, "in %e.", 123.456789) +GLIBC_FMT_TEST(e2, "in %e.", -123.456789) +GLIBC_FMT_TEST(e3, "in %e.", .123456789) +GLIBC_FMT_TEST(e4, "in %e.", -.123456789) +GLIBC_FMT_TEST(e5, "in %E.", -.123456789) +GLIBC_FMT_TEST(e6, "in %E.", -123.456789) +GLIBC_FMT_TEST(e7, "in %e.", 123456789.123) +GLIBC_FMT_TEST(e8, "in %e.", -123456789.123) + +GLIBC_FMT_TEST(f1, "in %f.", 123.456789) +GLIBC_FMT_TEST(f2, "in %f.", -123.456789) +GLIBC_FMT_TEST(f3, "in %f.", .123456789) +GLIBC_FMT_TEST(f4, "in %f.", -.123456789) +GLIBC_FMT_TEST(f5, "in %F.", -.123456789) +GLIBC_FMT_TEST(f6, "in %F.", -123.456789) +GLIBC_FMT_TEST(f7, "in %f.", 123456789.123) +GLIBC_FMT_TEST(f8, "in %f.", -123456789.123) + +GLIBC_FMT_TEST(g1, "in %g.", 123.456789) +GLIBC_FMT_TEST(g2, "in %g.", -123.456789) +GLIBC_FMT_TEST(g3, "in %g.", .123456789) +GLIBC_FMT_TEST(g4, "in %g.", -.123456789) +GLIBC_FMT_TEST(g5, "in %G.", -.123456789) +GLIBC_FMT_TEST(g6, "in %G.", -123.456789) +GLIBC_FMT_TEST(g7, "in %g.", 123456789.123) +GLIBC_FMT_TEST(g8, "in %g.", -123456789.123) GLIBC_FMT_TEST( - fmtlibt_fmt, "%0.10f:%04d:%+g:%s:%p:%c:%%\n", 1.234, 42, 3.13, "str", reinterpret_cast<void *>(1000), 'X'); + fmtlibt_fmt, "%0.10f:%04d:%+g:%s:%p:%c:%%\n", 1.234, 42, 3.13, "str", reinterpret_cast<void *>(1000), 'X') AdHocFormatter(chars_written_fmt, "%n %s %n %d %n"); BOOST_AUTO_TEST_CASE(chars_written) @@ -453,7 +453,7 @@ BOOST_AUTO_TEST_CASE(chars_written) BOOST_CHECK_EQUAL(c, s.length()); } -GLIBC_FMT_TEST(p2, "in %p.", this); +GLIBC_FMT_TEST(p2, "in %p.", static_cast<void *>(this)) AdHocFormatter(smartptr_fmt, "Address is %p."); BOOST_AUTO_TEST_CASE(smartptr) diff --git a/libadhocutil/unittests/testFactory.cpp b/libadhocutil/unittests/testFactory.cpp index 17b220e..dbd4eb8 100644 --- a/libadhocutil/unittests/testFactory.cpp +++ b/libadhocutil/unittests/testFactory.cpp @@ -44,14 +44,14 @@ public: using BaseThingFactory = AdHoc::Factory<BaseThing, int, std::string *>; -NAMEDFACTORY("a", ImplOfThing, BaseThingFactory); -FACTORY(OtherImplOfThing, BaseThingFactory); +NAMEDFACTORY("a", ImplOfThing, BaseThingFactory) +FACTORY(OtherImplOfThing, BaseThingFactory) -INSTANTIATEFACTORY(BaseThing, int, std::string *); +INSTANTIATEFACTORY(BaseThing, int, std::string *) // Multiple factories in one compilation unit -INSTANTIATEFACTORY(BaseThing, std::string, std::string); +INSTANTIATEFACTORY(BaseThing, std::string, std::string) // Factories of things with commas -INSTANTIATEFACTORY(BaseThing, std::map<std::string, std::string>); +INSTANTIATEFACTORY(BaseThing, std::map<std::string, std::string>) BOOST_AUTO_TEST_CASE(ready) { diff --git a/libadhocutil/unittests/testLazyPointer.cpp b/libadhocutil/unittests/testLazyPointer.cpp index c3bbbfe..0c8067b 100644 --- a/libadhocutil/unittests/testLazyPointer.cpp +++ b/libadhocutil/unittests/testLazyPointer.cpp @@ -17,8 +17,8 @@ using TestLazyPointer = LazyPointer<Test>; using RawLazyPointer = LazyPointer<int, int *>; /// LCOV_EXCL_START (diagnostics) -BOOST_TEST_DONT_PRINT_LOG_VALUE(TestLazyPointer); -BOOST_TEST_DONT_PRINT_LOG_VALUE(RawLazyPointer); +BOOST_TEST_DONT_PRINT_LOG_VALUE(TestLazyPointer) +BOOST_TEST_DONT_PRINT_LOG_VALUE(RawLazyPointer) /// LCOV_EXCL_STOP static TestLazyPointer::pointer_type diff --git a/libadhocutil/unittests/testMemStream.cpp b/libadhocutil/unittests/testMemStream.cpp index 0432067..3f8a160 100644 --- a/libadhocutil/unittests/testMemStream.cpp +++ b/libadhocutil/unittests/testMemStream.cpp @@ -9,7 +9,7 @@ using namespace AdHoc; -BOOST_FIXTURE_TEST_SUITE(s, MemStream); +BOOST_FIXTURE_TEST_SUITE(s, MemStream) BOOST_AUTO_TEST_CASE(empty) { @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(simple) BOOST_CHECK_EQUAL(len, this->length()); } -BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_CASE(move_construct) { diff --git a/libadhocutil/unittests/testNvpParse.cpp b/libadhocutil/unittests/testNvpParse.cpp index ef148f5..7fd500d 100644 --- a/libadhocutil/unittests/testNvpParse.cpp +++ b/libadhocutil/unittests/testNvpParse.cpp @@ -26,7 +26,7 @@ NvpTarget(TestTarget) TestTargetMap { }; /// LCOV_EXCL_START (diagnostics) -BOOST_TEST_DONT_PRINT_LOG_VALUE(decltype(TestTargetMap.find(""))); +BOOST_TEST_DONT_PRINT_LOG_VALUE(decltype(TestTargetMap.find(""))) /// LCOV_EXCL_STOP BOOST_AUTO_TEST_CASE(targetmap) diff --git a/libadhocutil/unittests/utilTestClasses.cpp b/libadhocutil/unittests/utilTestClasses.cpp index d42b9aa..b193bd1 100644 --- a/libadhocutil/unittests/utilTestClasses.cpp +++ b/libadhocutil/unittests/utilTestClasses.cpp @@ -1,5 +1,5 @@ #include "utilTestClasses.h" #include "plugins.impl.h" -PLUGIN(ImplOfThing, BaseThing); -INSTANTIATEPLUGINOF(BaseThing); +PLUGIN(ImplOfThing, BaseThing) +INSTANTIATEPLUGINOF(BaseThing) |