From 6c7222e071ffe7d20c138faac0da1d708e0a7779 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 29 Aug 2021 15:12:57 +0100 Subject: Add -Wold-style-cast --- Jamroot.jam | 1 + lib/compileTimeFormatter.h | 2 +- lib/input/mysqlBindings.cpp | 3 +-- lib/output/pq/pqConn.cpp | 7 ++++--- lib/output/pq/pqRecordSet.cpp | 8 ++++---- lib/output/pq/pqStmt.cpp | 6 +++--- lib/output/pq/writePqCopyStrm.cpp | 2 +- lib/row.cpp | 3 ++- lib/streamSupport.cpp | 3 ++- test/test-e2e.cpp | 16 ++++++++-------- test/test-misc.cpp | 24 ++++++++++++------------ test/testdb-mysql.cpp | 3 ++- 12 files changed, 41 insertions(+), 37 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index c32fb4a..edceeb1 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -21,6 +21,7 @@ project : requirements debug:extra debug:on debug:-Wnon-virtual-dtor + debug:-Wold-style-cast debug:-Wcast-align debug:-Wunused debug:-Woverloaded-virtual diff --git a/lib/compileTimeFormatter.h b/lib/compileTimeFormatter.h index 647fb30..7d69d4b 100644 --- a/lib/compileTimeFormatter.h +++ b/lib/compileTimeFormatter.h @@ -344,7 +344,7 @@ namespace MyGrate { static inline void write(stream & s, Obj * const ptr, const Pn &... pn) { - s << std::showbase << std::hex << (long unsigned int)ptr; + s << std::showbase << std::hex << static_cast(ptr); s.copyfmt(std::ios(nullptr)); StreamWriter::next(s, pn...); } diff --git a/lib/input/mysqlBindings.cpp b/lib/input/mysqlBindings.cpp index 3895821..089ced5 100644 --- a/lib/input/mysqlBindings.cpp +++ b/lib/input/mysqlBindings.cpp @@ -22,7 +22,6 @@ namespace MyGrate::Input { MYSQL_TIME & operator<<(MYSQL_TIME & t, const DateTime & dt) { - return t << (Date)dt << (Time)dt; + return t << static_cast(dt) << static_cast