From 9ff79b86cf55d38a1b1b620e07e61288c2f012f0 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 16 Aug 2015 00:16:30 +0200 Subject: [PATCH] fix warnings found by CLang (3.5) Note: not fixing all relevant warnings. Especially, the "-Woverloaded-virtual" of Clang defeats the whole purpose of generated generic interfaces. For example, our Variant type is instantiated with a list of types the variant can hold. Through metaprogramming, this instantiation generates also an embedded Visitor interface, which has virtual 'handle(TY)' functions for all the types in question The client now may implement, or even partially implement this Visitor, to retrieve specific data out of given Variant instance with unknown conent. To complain that some other virtual overload is now shaddowed is besides the point, so we might consider to disable this warning altogether --- src/gui/widget/timeline-widget.hpp | 2 ++ src/gui/widget/timeline/timeline-body.hpp | 1 + src/lib/diff/gen-node.hpp | 4 ++-- src/lib/diff/tree-mutator.hpp | 2 +- src/lib/format-string.hpp | 2 +- src/lib/iter-adapter.hpp | 2 +- src/lib/meta/virtual-copy-support.hpp | 17 ++++++++++++++--- src/lib/variant.hpp | 8 ++++++++ src/proc/asset/procpatt.hpp | 2 +- src/proc/asset/struct-scheme.hpp | 2 +- .../mobject/builder/model-port-registry.hpp | 2 +- .../mobject/session/query/fake-configrules.hpp | 2 +- src/proc/streamtype.hpp | 4 ++++ tests/basics/streamtypebasicstest.cpp | 2 +- .../builder/model-port-registry-test.cpp | 1 + tests/library/diff/gen-node-basic-test.cpp | 2 +- 16 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/gui/widget/timeline-widget.hpp b/src/gui/widget/timeline-widget.hpp index 2eaae7a14..8e40f606d 100644 --- a/src/gui/widget/timeline-widget.hpp +++ b/src/gui/widget/timeline-widget.hpp @@ -23,6 +23,7 @@ /** @file timeline-widget.hpp ** This file defines the core component of the Lumiera GUI ** + ** @deprecated broken since transition to GTK-3 ** @todo needs to be reworked from ground as if 5/2015 ** GTK-3 uses different event handling callbacks, ** so the existing implementation is defunct. @@ -67,6 +68,7 @@ namespace widget { * Core timeline display (custom widget). * @remarks This widget is a composite of several widgets contained * within the timeline namespace. + * @deprecated dysfunctional and broken by switch to GTK-3. Needs to be rewritten */ class TimelineWidget : public Gtk::Table diff --git a/src/gui/widget/timeline/timeline-body.hpp b/src/gui/widget/timeline/timeline-body.hpp index d3dd39e43..f31380f0d 100644 --- a/src/gui/widget/timeline/timeline-body.hpp +++ b/src/gui/widget/timeline/timeline-body.hpp @@ -125,6 +125,7 @@ protected: /** * The event handler for when the TimelineWidget's state is switched. + * @deprecated needs to be rewritten from scratch for GTK-3 */ void on_state_changed (shared_ptr newState); diff --git a/src/lib/diff/gen-node.hpp b/src/lib/diff/gen-node.hpp index 4b49ca4ae..ffb589db8 100644 --- a/src/lib/diff/gen-node.hpp +++ b/src/lib/diff/gen-node.hpp @@ -120,7 +120,7 @@ namespace diff{ using std::string; - class GenNode; + struct GenNode; using Rec = Record; using RecRef = RecordRef; @@ -170,7 +170,7 @@ namespace diff{ class ID : public idi::BareEntryID { - friend class GenNode; + friend struct GenNode; template ID (X*, string const& symbolicID) diff --git a/src/lib/diff/tree-mutator.hpp b/src/lib/diff/tree-mutator.hpp index 2e3254f3d..25e44f57a 100644 --- a/src/lib/diff/tree-mutator.hpp +++ b/src/lib/diff/tree-mutator.hpp @@ -75,7 +75,7 @@ namespace diff{ namespace { template - class Builder; + struct Builder; using ID = Literal; using Attribute = DataCap; diff --git a/src/lib/format-string.hpp b/src/lib/format-string.hpp index fa884b174..173ebc8b8 100644 --- a/src/lib/format-string.hpp +++ b/src/lib/format-string.hpp @@ -117,7 +117,7 @@ namespace std { // forward declaration to avoid including template - class char_traits; + struct char_traits; template class basic_ostream; diff --git a/src/lib/iter-adapter.hpp b/src/lib/iter-adapter.hpp index 69d5407fd..ccf36f3d5 100644 --- a/src/lib/iter-adapter.hpp +++ b/src/lib/iter-adapter.hpp @@ -107,7 +107,7 @@ namespace lib { namespace { // internal helpers - void + inline void _throwIterExhausted() { throw lumiera::error::Invalid ("Can't iterate further", diff --git a/src/lib/meta/virtual-copy-support.hpp b/src/lib/meta/virtual-copy-support.hpp index 9e1cfee30..fee8effa4 100644 --- a/src/lib/meta/virtual-copy-support.hpp +++ b/src/lib/meta/virtual-copy-support.hpp @@ -34,16 +34,16 @@ ** a virtual function (which requires a VTable): Even if for everyone else any ** knowledge regarding the exact implementation type has been discarded ("erased"), ** the function pointers in the VTable still implicitly hold onto that precise - ** implementation type, since they were setup during construction, where the + ** implementation type, since they were set up during construction, where the ** type was still available. Such a scheme of dealing with "opaque" copy operations ** is known as virtual copy -- it can be dangerous and tricky to get right ** and is preferably used only in flat class hierarchies. ** ** This helper template simplifies the construction of such a scheme. ** - a base interface defines the available virtual copy operations - ** - a set of CRTP-style templates covers all the case of + ** - a set of CRTP-style templates covers all the cases of ** - full copy support - ** - copy construction but not assignment + ** - copy construction but no assignment ** - only move construction allowed ** - noncopyable type ** - we use type traits and a policy template to pick the correct implementation @@ -144,6 +144,8 @@ namespace meta{ : public BASE { public: + virtual ~VirtualCopySupportInterface() { } + virtual void copyInto (void* targetStorage) const =0; virtual void moveInto (void* targetStorage) =0; virtual void copyInto (IFA& target) const =0; @@ -198,6 +200,9 @@ namespace meta{ D& src = static_cast (*this); new(targetStorage) D(move(src)); } + + using I::copyInto; + using I::moveInto; }; @@ -211,6 +216,9 @@ namespace meta{ D const& src = static_cast (*this); new(targetStorage) D(src); } + + using I::copyInto; + using I::moveInto; }; @@ -233,6 +241,9 @@ namespace meta{ D& s = static_cast (*this); t = move(s); } + + using I::copyInto; + using I::moveInto; }; diff --git a/src/lib/variant.hpp b/src/lib/variant.hpp index 19f272b01..9902e1746 100644 --- a/src/lib/variant.hpp +++ b/src/lib/variant.hpp @@ -59,6 +59,14 @@ ** concrete type does not support assignment or copy construction, the respective access ** function is replaced by an implementation raising a runtime error. ** + ** @note we use a Visitor interface generated through metaprogramming. + ** This may generate a lot of warnings "-Woverloaded-virtual", + ** since one \c handle(TX) function may shadow other \c handle(..) functions + ** from the inherited (generated) Visitor interface. These warnings are besides + ** the point, since not the \em client uses these functions, but the Variant does, + ** after upcasting to the interface. Make sure you define your specialisations with + ** the override modifier; when done so, it is safe to disable this warning here. + ** ** @see Veriant_test ** @see lib::diff::GenNode ** @see virtual-copy-support.hpp diff --git a/src/proc/asset/procpatt.hpp b/src/proc/asset/procpatt.hpp index 7f61e0751..b6202085a 100644 --- a/src/proc/asset/procpatt.hpp +++ b/src/proc/asset/procpatt.hpp @@ -39,7 +39,7 @@ namespace asset { class Proc; class ProcPatt; - class BuildInstruct; + struct BuildInstruct; typedef lib::P PProc; typedef lib::P PProcPatt; diff --git a/src/proc/asset/struct-scheme.hpp b/src/proc/asset/struct-scheme.hpp index 350f1d090..ab5a837a5 100644 --- a/src/proc/asset/struct-scheme.hpp +++ b/src/proc/asset/struct-scheme.hpp @@ -48,7 +48,7 @@ using boost::format; namespace proc { - class StreamType; + struct StreamType; namespace mobject { namespace session { diff --git a/src/proc/mobject/builder/model-port-registry.hpp b/src/proc/mobject/builder/model-port-registry.hpp index 694e5d783..e836c2289 100644 --- a/src/proc/mobject/builder/model-port-registry.hpp +++ b/src/proc/mobject/builder/model-port-registry.hpp @@ -87,7 +87,7 @@ namespace builder { public: /** @internal record to describe a model port */ - struct ModelPortDescriptor; + class ModelPortDescriptor; static void shutdown (); diff --git a/src/proc/mobject/session/query/fake-configrules.hpp b/src/proc/mobject/session/query/fake-configrules.hpp index 93058a54e..b74c18993 100644 --- a/src/proc/mobject/session/query/fake-configrules.hpp +++ b/src/proc/mobject/session/query/fake-configrules.hpp @@ -175,7 +175,7 @@ namespace session { { typedef typename WrapReturn::Wrapper Ret; - public: + /** (dummy) implementation of the QueryHandler interface */ virtual bool resolve (Ret& solution, Query const& q) diff --git a/src/proc/streamtype.hpp b/src/proc/streamtype.hpp index e357bd694..0c9c677fb 100644 --- a/src/proc/streamtype.hpp +++ b/src/proc/streamtype.hpp @@ -47,6 +47,10 @@ namespace proc { using lib::Symbol; +// "yes mummy, we all know this code is not finished yet..." +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" + /** * TODO write type comment */ diff --git a/tests/basics/streamtypebasicstest.cpp b/tests/basics/streamtypebasicstest.cpp index c0deaa898..53f8a6809 100644 --- a/tests/basics/streamtypebasicstest.cpp +++ b/tests/basics/streamtypebasicstest.cpp @@ -50,7 +50,7 @@ namespace test_format { class StreamTypeBasics_test : public Test { virtual void - run (Arg arg) + run (Arg) { ImplType iType = buildImplType (); basicImplTypeProperties (iType); diff --git a/tests/core/proc/mobject/builder/model-port-registry-test.cpp b/tests/core/proc/mobject/builder/model-port-registry-test.cpp index c769e802b..1d47fb689 100644 --- a/tests/core/proc/mobject/builder/model-port-registry-test.cpp +++ b/tests/core/proc/mobject/builder/model-port-registry-test.cpp @@ -161,6 +161,7 @@ namespace test { CHECK (mp1); CHECK (mp2); CHECK (mp1x); + CHECK (mp2x); CHECK (!mpNull); // bool check verifies setup and connected state CHECK ( ModelPort::exists (pipeA)); // this is the same check, but invoked just with an pipe-ID diff --git a/tests/library/diff/gen-node-basic-test.cpp b/tests/library/diff/gen-node-basic-test.cpp index cac1344a4..6fe4e4ca3 100644 --- a/tests/library/diff/gen-node-basic-test.cpp +++ b/tests/library/diff/gen-node-basic-test.cpp @@ -198,7 +198,7 @@ namespace test{ ++scope; CHECK (luid == scope->data.get()); ++scope; - CHECK (Time(0.92,0) == scope->data.get().end()); + CHECK (Time(920,0) == scope->data.get().end()); ++scope; auto spam = *scope; CHECK (!++scope);