From 96c654f66c3c23bd4b80ec3960cba69f66e6a108 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 15 Apr 2025 23:40:14 +0200 Subject: [PATCH] Upgrade: address further warnings - conversion from pointer to bool now counts as ''narrowing conversion'' - constructor names must not include template arguments (enforced with C++20) - better use std::array for some dummy test code Several further warnings are due to known obsoleted or questionable constructs and were left as-is (e.g. for ScopedHolder) or just commented for later referral --- src/common/advice.hpp | 4 +- src/lib/format-obj.cpp | 4 +- src/lib/nobug-resource-handle-context.hpp | 1 - src/lib/polymorphic-value.hpp | 2 +- src/lib/scoped-holder.hpp | 4 +- src/lib/util-quant.hpp | 6 +- .../interact/drag-relocate-controller.hpp | 2 +- src/stage/model/w-link.hpp | 2 +- src/steam/mobject/session/session-impl.hpp | 4 +- src/vault/gear/scheduler-invocation.hpp | 2 +- .../steam/control/command-argument-test.cpp | 7 +- .../steam/engine/scheduler-interface-test.cpp | 2 +- tests/library/search-path-splitter-test.cpp | 2 +- tests/library/stat/data-csv-test.cpp | 4 +- wiki/thinkPad.ichthyo.mm | 425 ++++++++++++++++-- 15 files changed, 407 insertions(+), 64 deletions(-) diff --git a/src/common/advice.hpp b/src/common/advice.hpp index 7070d42b5..5016d02f7 100644 --- a/src/common/advice.hpp +++ b/src/common/advice.hpp @@ -285,7 +285,7 @@ namespace advice { bool isGiven() const { - return bool{this->getSolution()}; + return bool(this->getSolution()); } void @@ -474,7 +474,7 @@ namespace advice { bool isMatched() const { - return bool{this->getSolution()}; + return bool(this->getSolution()); } diff --git a/src/lib/format-obj.cpp b/src/lib/format-obj.cpp index 23080781b..3b04b2faf 100644 --- a/src/lib/format-obj.cpp +++ b/src/lib/format-obj.cpp @@ -69,11 +69,11 @@ namespace { // hard-wired configuration for debugging output.... const size_t DIAGNOSTICS_ADDRESS_SUFFIX_LEN = 4; - /** maximum decimal digits able to pass through a round trip without value change */ + /** maximum decimal digits able to pass through a round trip without value change */ template constexpr size_t PRECISION_DECIMAL = std::numeric_limits::digits10; - /** decimal digits require tod represent each different floating-point value */ + /** decimal digits required to represent each different floating-point value completely */ template constexpr size_t PRECISION_COMPLETE = std::numeric_limits::max_digits10; } diff --git a/src/lib/nobug-resource-handle-context.hpp b/src/lib/nobug-resource-handle-context.hpp index 3d1d70188..e4365a753 100644 --- a/src/lib/nobug-resource-handle-context.hpp +++ b/src/lib/nobug-resource-handle-context.hpp @@ -37,7 +37,6 @@ #include "lib/error.hpp" #include "lib/diagnostic-context.hpp" -#include "lib/thread-local.hpp" #include diff --git a/src/lib/polymorphic-value.hpp b/src/lib/polymorphic-value.hpp index 9f8fa2061..1e31bf176 100644 --- a/src/lib/polymorphic-value.hpp +++ b/src/lib/polymorphic-value.hpp @@ -326,7 +326,7 @@ namespace lib { static CopyAPI& accessCopyHandlingInterface (IFA& bufferContents) { - REQUIRE (INSTANCEOF (CopyAPI, &bufferContents)); + REQUIRE (INSTANCEOF (CopyAPI, &bufferContents)); //////////////////////////////////////////////TICKET #1197 : GCC-14 warns here this is always true -- when used from verb-visitor.hpp ; I'd say again, the design is unsatisfactory return static_cast (bufferContents); } }; diff --git a/src/lib/scoped-holder.hpp b/src/lib/scoped-holder.hpp index 7ea390110..6a547c4c8 100644 --- a/src/lib/scoped-holder.hpp +++ b/src/lib/scoped-holder.hpp @@ -37,7 +37,7 @@ ** holder instances. This is the purpose of the \c transfer_control ** friend function. ** - ** @deprecated this is a pre C++11 concept and superseded by rvalue references + ** @deprecated this is a pre C++11 concept and superseded by rvalue references /////////////////////////////TICKET #958 ** ** @see scoped-holder-test.cpp ** @see scoped-holder-transfer.hpp use in std::vector @@ -198,7 +198,7 @@ namespace lib { operator* () const { ASSERT (created_); - return (TY&) content_; + return (TY&) content_; //////////////////////////////////////////////////////////////////TICKET #958 : GCC-14 warns here -- really time to get rid of this class alltogether } TY* diff --git a/src/lib/util-quant.hpp b/src/lib/util-quant.hpp index 0324ca395..f0be6c5c6 100644 --- a/src/lib/util-quant.hpp +++ b/src/lib/util-quant.hpp @@ -54,7 +54,7 @@ namespace util { struct IDiv : div_t { - IDiv (int num, int den) + IDiv (int num, int den) : div_t(div (num,den)) { } }; @@ -63,7 +63,7 @@ namespace util { struct IDiv : ldiv_t { - IDiv (long num, long den) + IDiv (long num, long den) : ldiv_t(ldiv (num,den)) { } }; @@ -72,7 +72,7 @@ namespace util { struct IDiv : lldiv_t { - IDiv (llong num, llong den) + IDiv (llong num, llong den) : lldiv_t(lldiv (num,den)) { } }; diff --git a/src/stage/interact/drag-relocate-controller.hpp b/src/stage/interact/drag-relocate-controller.hpp index dbb8d31c1..f03bfcdb6 100644 --- a/src/stage/interact/drag-relocate-controller.hpp +++ b/src/stage/interact/drag-relocate-controller.hpp @@ -182,7 +182,7 @@ namespace interact { bool isAnchored() { - return bool{subject_}; + return bool(subject_); } void diff --git a/src/stage/model/w-link.hpp b/src/stage/model/w-link.hpp index 005855f40..bf793d351 100644 --- a/src/stage/model/w-link.hpp +++ b/src/stage/model/w-link.hpp @@ -140,7 +140,7 @@ namespace model { explicit operator bool() const { - return bool{widget_}; + return bool(widget_); } TAR& diff --git a/src/steam/mobject/session/session-impl.hpp b/src/steam/mobject/session/session-impl.hpp index 5577612d9..e0dc357ea 100644 --- a/src/steam/mobject/session/session-impl.hpp +++ b/src/steam/mobject/session/session-impl.hpp @@ -206,7 +206,7 @@ namespace session { }; protected: - ServiceAccessPoint() + ServiceAccessPoint() : resolvingWrapper_(AccessCurrentIndex (*this)) { } }; @@ -235,7 +235,7 @@ namespace session { } protected: - ServiceAccessPoint() + ServiceAccessPoint() : mockIndex_(0) { } diff --git a/src/vault/gear/scheduler-invocation.hpp b/src/vault/gear/scheduler-invocation.hpp index 6f181e6a0..c379bcc13 100644 --- a/src/vault/gear/scheduler-invocation.hpp +++ b/src/vault/gear/scheduler-invocation.hpp @@ -118,7 +118,7 @@ namespace gear { return starting > o.starting; } - operator bool() const { return bool{activity}; } + operator bool() const { return bool(activity); } operator Activity*() const { return activity; } Time startTime() const { return Time{TimeValue{starting}};} diff --git a/tests/core/steam/control/command-argument-test.cpp b/tests/core/steam/control/command-argument-test.cpp index 07af7f721..863028335 100644 --- a/tests/core/steam/control/command-argument-test.cpp +++ b/tests/core/steam/control/command-argument-test.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using util::_Fmt; using util::isnil; @@ -113,12 +114,12 @@ namespace test { */ struct Sint5 { - int i[5]; + std::array i5i; friend bool operator== (Sint5 const& i1, Sint5 const& i2) { - return i1.i == i2.i; + return i1.i5i == i2.i5i; } }; @@ -265,7 +266,7 @@ namespace test { CHECK (arg5->canUndo()); CHECK (*arg5->memento() == "destruction"); - VERIFY_ERROR(MISSING_MEMENTO, arg4->memento().i[3] = 513 ); + VERIFY_ERROR(MISSING_MEMENTO, arg4->memento().i5i[3] = 513 ); for_each (tup, showIt); } diff --git a/tests/core/steam/engine/scheduler-interface-test.cpp b/tests/core/steam/engine/scheduler-interface-test.cpp index 3a5c099fe..359e2ab6e 100644 --- a/tests/core/steam/engine/scheduler-interface-test.cpp +++ b/tests/core/steam/engine/scheduler-interface-test.cpp @@ -176,7 +176,7 @@ namespace test { Time nominalTime(dummyFrameStart(frameNr)); Time deadline(TEST_START_TIME + nominalTime); - MockJob job{nominalTime, frameNr}; + MockJob job{nominalTime, int(frameNr)}; currentTx.addJob (deadline, job); diff --git a/tests/library/search-path-splitter-test.cpp b/tests/library/search-path-splitter-test.cpp index fc19a5be3..dae7e481a 100644 --- a/tests/library/search-path-splitter-test.cpp +++ b/tests/library/search-path-splitter-test.cpp @@ -75,7 +75,7 @@ namespace test { resolveEmbeddedOriginToken () { fsys::path exePath (findExePath()); - string expected = (exePath.remove_leaf() / "modules").string(); + string expected = (exePath.remove_leaf() / "modules").string(); ////////OOO warning by GCC-14 : `path::remove_leaf()` is deprecated: Use `path::remove_filename()` instead SearchPathSplitter sp("xyz:$ORIGIN/modules:abc"); CHECK ("xyz" == sp.next()); diff --git a/tests/library/stat/data-csv-test.cpp b/tests/library/stat/data-csv-test.cpp index 09fb5f8bc..9f44c23ef 100644 --- a/tests/library/stat/data-csv-test.cpp +++ b/tests/library/stat/data-csv-test.cpp @@ -141,12 +141,12 @@ namespace test{ VERIFY_ERROR (STATE, tab.val.get()); VERIFY_ERROR (STATE, tab.off.get()); VERIFY_ERROR (STATE, tab.off = 5 ); - VERIFY_ERROR (STATE,(tab.off == 5)); + VERIFY_ERROR (STATE, int(tab.off) ); // direct access to the data is possible and tolerated tab.val.data.push_back (5.5); CHECK (tab.val == 5.5); - VERIFY_ERROR (STATE, (tab.off == 5)); + VERIFY_ERROR (STATE, tab.off.get()); CHECK (1 == tab.val.data.size()); CHECK (0 == tab.off.data.size()); CHECK (0 == tab.id.data.size()); diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index b9e5c5449..eae9025da 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -84901,6 +84901,30 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + +

+ das waren allesamt Datenstrukturen aus der ersten Zeit; wir waren auf C++03 und ich hatte noch wenig Erfahrung mit Library-Design in C++ — leider wurde dieser teilweise recht dilettantische Code immerfort festgehalten  von den ersten Entwürfen zum Memory-Management und zur Node-Invocation. Insofern habe ich mich fast schon daran gewöhnt, das immerfort zu übersehen. Aber zum Glück ist jetzt die Ausrede weg, und die letzten Reste sollten keinen großen Aufwand mehr machen +

+ +
+ +
+ + + + + + +
@@ -159640,7 +159664,7 @@ actively maintained upstream. Please remove gdl from Debian. - + @@ -160492,8 +160516,8 @@ actively maintained upstream. Please remove gdl from Debian. - - + + @@ -160528,7 +160552,7 @@ actively maintained upstream. Please remove gdl from Debian. - + @@ -160645,8 +160669,7 @@ Since then others have made contributions, see the log for the history. - - + @@ -160665,7 +160688,7 @@ Since then others have made contributions, see the log for the history. - + @@ -160685,8 +160708,20 @@ Since then others have made contributions, see the log for the history. - - + + + + + + + +

+ git+ssh://ichthyo@git.lumiera.org/git/libs/scons-contrib +

+ +
+ +
@@ -160739,8 +160774,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -161107,6 +161142,11 @@ Since then others have made contributions, see the log for the history. + + + + + @@ -161144,6 +161184,17 @@ Since then others have made contributions, see the log for the history. + + + + +

+ wohl inzwischen nirgends mehr includiert +

+ +
+ +
@@ -161153,8 +161204,295 @@ Since then others have made contributions, see the log for the history.
- - + + + + + + + + + + + + + + + + + + +

+ Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead +

+ +
+
+ + + + +

+ Use 'rsvg_handle_render_document' instead +

+ +
+
+ + + + + + + + + +
+ + + + + + +

+ typically this was used as mix-in base class to get the typedefs argument_type and result_type — which are no longer needed by modern code (and the STL), since traits or even concepts are commonplace nowadays. +

+ + +
+ + + + + + + + +

+ src/lib/time/timevalue.hpp:303:13: note: because 'lib::time::Time' has user-provided 'lib::time::Time& lib::time::Time::operator=(lib::time::Time)' +

+ + +
+ + + + + +

+ bedeutet: hier sollte der (erlaubte) copy-ctor explizit deklariert werden als =default  +

+ +
+
+ + + + + + + + + + + + + + + + + + + +

+ MoveSupport<I, D, B>::moveInto(void*) was hidden by FullCopySupport<I, D, B>::moveInto(I&) +

+ +
+ +
+ + + + + + + + + + +

+ Das bedeutet, der Scope, in dem dem der Funktionsaufruf interpretiert wird, ist gegeben durch den Typ der Referenz, über die aufgerufen wird. Das kann das Interface sein, es kann aber auch die konkrete Klasse sein, oder irgend was dazwischen. In diesem Scope wird nach dem reinen Namen der Funktion gesucht. Für diesen könnten mehrere Overloads in dieser Funktion sichtbar sein, und nur auf diesen wird die Overload-Resolution gemacht. Nur falls die konkrete Subklasse die Funktion gar nicht definiert, wird dann über die Vererbungshierarchie gesucht (und bei Templates gar nicht). Das heißt, hier kollidiert das Standard-Verhalten von C++ (das von C abstammt), mit dem Konzept eines virtuellen Dispatch. Im Zweifelsfall macht der Compiler immer einen direkten Aufruf, und versucht dann ggfs. sogar, die Argumente automatisch zu konvertieren. Deshalb könnte das tatsächlich eine Falle sein, und die Warnung ist grundsätzlich angebracht..... +

+ + +
+
+ + + + +

+ Der konkrete Fall ist der »VirtualCopySupport«, und noch konkreter, er wird verwendet in unserem Variant-Typ. Dafür bauen wir eine Vererbungs-Kette, in der das VirtualCopySupportInterface irgendwo unter dem Interface liegt, und dann das per Policy gewählte Implementierungs-Mix-in irgendwo unter dem konkreten Typ. Aber die eigentliche Verwendung steckt im Variant-Container, der eben nichts über den konkreten Typ in seinem Inline-Buffer weiß. Deshalb erfolgt der Dispatch stets über das Basis-Interface des Buffers in das VirtualCopySupportInterface. Insofern wird hier vor einem potentiellen Problem gewarnt in dem Moment, in dem der konkrete Typ konstruiert wird, obwohl der gefährliche Aufruf niemals stattfinden kann +

+ +
+
+ + + + +

+ Das VirtualCopySupportInterface bietet zwei Sätze von Zugriffsfunktionen +

+
    +
  • + einen direkten Zugang über eine Referenz auf das Interface +
  • +
  • + einen indirekten Zugang, in dem der Empfänger einen Storage-Buffer anbietet (das wird zur Implementierung von Konstruktoren benötigt, weil in diesem Fall noch gar nichts im Buffer liegen kann) +
  • +
+

+ Und das bedeutet: die Argument-Typen für die beiden Funktions-Varianten sind total inkompatibel. Würde man also versehentlich mal tatsächlich über die konkrete Klasse aufrufen, dann wäre die u.U. die Variante mit dem Storage-Buffer shaddowed (und davor warnt der Compiler), aber man könnte einen Aufruf darauf auch gar nicht auflösen, da die Argumente nicht kompatibel sind +

+ +
+
+ + + + + + + + +

+ ...auch wenn sie nicht dem entspricht, was man intuitiv erwarten würde (aber gleiches hier: eine Lösung stünde in keinem Verhältnis zum Nutzen) +

+ +
+
+
+
+ + + +
+ + + + + + + + +

+ denn hier kann man gar nicht die Basis-Impl in scope bringen +

+ +
+
+ + + + +

+ d.h. wenn ich hinzufüge using BASE::resolve,  dann bekomme ich einen echten Compile-Fehler, weil das Symbol zweideutig ist. Und zwar by design, wir bauen das ja über eine Typ-Sequenz auf +

+ + +
+
+ + + + + + + + + + + + + + + +

+ siehe Zyn.mm, suche nach "std::move ungeschickt verwendet" +

+ + +
+
+ + + + + + + + +

+ weil std::move() einen Cast macht, und damit das Ergebnis der delegate-Funktion nicht mehr den gleichen Value-Typ hat, den wir grade zurückkeben wollen. Denn bei gleichem Value-Typ, kann der Compiler die ganze Kette auflösen und erstellt den Ergebniswert bereits am endgültigen Zielort (das ist die RVO). Aber durch unseren Cast sieht er einen RValue, und muß damit ein neues Objekt konstruieren. Weil Herrchen das so verlangt hat ;-) +

+ +
+
+
+
+ + + + + + + + + + + + + +

+ ui-location-solver.hpp , l.280 +

+

+ Das move ist hier aber nicht überflüssig, sondern soll tatsächlich die Terminal-Operation des UICoord::Builder auslösen (von dem UILocationSolver erbt). Also mißdeutet der Compiler die Situation komplett, denn es handelt sich nicht um eine RVO, sondern um einen speziellen Konstruktor-Aufruf von UICoord, in dem noch eine Normalisierung stattfindet +

+ + +
+
+ + + + +

+ UICoord hat nämlich einen variadischen Konstruktor; hier tritt wieder das notorische Problem auf, daß dieser andere konkrete Definitionen verdeckt. Ich mußte deshalb auch schon die ganzen Copy-Operationen nochmal anschreiben (inzwischen gäbe es dafür den disable_if_self-Helper) +

+ +
+
+ + + + + + + +

+ Ich hab auch erst selbst nicht verstanden, was hier vorgeht, zumal die Terminal-Operation im UICoord::Builder selber gar nicht zu sehen ist (obzwar die tatsächliche Implementierung direkt dahinter steht, und auch erst an der Stelle gegeben werden kann). Ein weiterer design smell  ist, daß ich dazu UICoord zum friend machen mußte. Was war nochmal die Motivation für dieses Design?  UICoord selber ist doch kopierbar, also warum nicht eine explzite Terminal-Operation, in der die Normalisierung passiert, und das Ergebnis dann direkt in ein neue UICoord-Objekt schieben? +

+ +
+
+ + + +
+
@@ -162010,6 +162348,10 @@ Since then others have made contributions, see the log for the history.
+ + + +
@@ -163682,8 +164024,8 @@ Since then others have made contributions, see the log for the history.
- - + + @@ -163759,9 +164101,8 @@ Since then others have made contributions, see the log for the history. - - - + + @@ -163807,8 +164148,9 @@ Since then others have made contributions, see the log for the history. - + + @@ -163819,11 +164161,11 @@ Since then others have made contributions, see the log for the history. - + - - - + + + @@ -163857,9 +164199,8 @@ Since then others have made contributions, see the log for the history. - - - + + @@ -163958,7 +164299,7 @@ Since then others have made contributions, see the log for the history. - + @@ -163966,8 +164307,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -164032,8 +164373,12 @@ Since then others have made contributions, see the log for the history. - - + + + + + + @@ -164071,9 +164416,9 @@ Since then others have made contributions, see the log for the history. - + - + @@ -164150,7 +164495,7 @@ Since then others have made contributions, see the log for the history. - + @@ -164190,8 +164535,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -164253,12 +164598,10 @@ Since then others have made contributions, see the log for the history. - + + - - - - +