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
This commit is contained in:
Fischlurch 2015-08-16 00:16:30 +02:00
parent 266cce9abe
commit 9ff79b86cf
16 changed files with 41 additions and 14 deletions

View file

@ -23,6 +23,7 @@
/** @file timeline-widget.hpp /** @file timeline-widget.hpp
** This file defines the core component of the Lumiera GUI ** 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 ** @todo needs to be reworked from ground as if 5/2015
** GTK-3 uses different event handling callbacks, ** GTK-3 uses different event handling callbacks,
** so the existing implementation is defunct. ** so the existing implementation is defunct.
@ -67,6 +68,7 @@ namespace widget {
* Core timeline display (custom widget). * Core timeline display (custom widget).
* @remarks This widget is a composite of several widgets contained * @remarks This widget is a composite of several widgets contained
* within the timeline namespace. * within the timeline namespace.
* @deprecated dysfunctional and broken by switch to GTK-3. Needs to be rewritten
*/ */
class TimelineWidget class TimelineWidget
: public Gtk::Table : public Gtk::Table

View file

@ -125,6 +125,7 @@ protected:
/** /**
* The event handler for when the TimelineWidget's state is switched. * 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<TimelineState> newState); void on_state_changed (shared_ptr<TimelineState> newState);

View file

@ -120,7 +120,7 @@ namespace diff{
using std::string; using std::string;
class GenNode; struct GenNode;
using Rec = Record<GenNode>; using Rec = Record<GenNode>;
using RecRef = RecordRef<GenNode>; using RecRef = RecordRef<GenNode>;
@ -170,7 +170,7 @@ namespace diff{
class ID class ID
: public idi::BareEntryID : public idi::BareEntryID
{ {
friend class GenNode; friend struct GenNode;
template<typename X> template<typename X>
ID (X*, string const& symbolicID) ID (X*, string const& symbolicID)

View file

@ -75,7 +75,7 @@ namespace diff{
namespace { namespace {
template<class PAR> template<class PAR>
class Builder; struct Builder;
using ID = Literal; using ID = Literal;
using Attribute = DataCap; using Attribute = DataCap;

View file

@ -117,7 +117,7 @@
namespace std { // forward declaration to avoid including <iostream> namespace std { // forward declaration to avoid including <iostream>
template<typename C> template<typename C>
class char_traits; struct char_traits;
template<typename C, class _TRAITS> template<typename C, class _TRAITS>
class basic_ostream; class basic_ostream;

View file

@ -107,7 +107,7 @@ namespace lib {
namespace { // internal helpers namespace { // internal helpers
void inline void
_throwIterExhausted() _throwIterExhausted()
{ {
throw lumiera::error::Invalid ("Can't iterate further", throw lumiera::error::Invalid ("Can't iterate further",

View file

@ -34,16 +34,16 @@
** a virtual function (which requires a VTable): Even if for everyone else any ** a virtual function (which requires a VTable): Even if for everyone else any
** knowledge regarding the exact implementation type has been discarded ("erased"), ** knowledge regarding the exact implementation type has been discarded ("erased"),
** the function pointers in the VTable still implicitly hold onto that precise ** 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 ** type was still available. Such a scheme of dealing with "opaque" copy operations
** is known as <b>virtual copy</b> -- it can be dangerous and tricky to get right ** is known as <b>virtual copy</b> -- it can be dangerous and tricky to get right
** and is preferably used only in flat class hierarchies. ** and is preferably used only in flat class hierarchies.
** **
** This helper template simplifies the construction of such a scheme. ** This helper template simplifies the construction of such a scheme.
** - a base interface defines the available virtual copy operations ** - 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 ** - full copy support
** - copy construction but not assignment ** - copy construction but no assignment
** - only move construction allowed ** - only move construction allowed
** - noncopyable type ** - noncopyable type
** - we use type traits and a policy template to pick the correct implementation ** - we use type traits and a policy template to pick the correct implementation
@ -144,6 +144,8 @@ namespace meta{
: public BASE : public BASE
{ {
public: public:
virtual ~VirtualCopySupportInterface() { }
virtual void copyInto (void* targetStorage) const =0; virtual void copyInto (void* targetStorage) const =0;
virtual void moveInto (void* targetStorage) =0; virtual void moveInto (void* targetStorage) =0;
virtual void copyInto (IFA& target) const =0; virtual void copyInto (IFA& target) const =0;
@ -198,6 +200,9 @@ namespace meta{
D& src = static_cast<D&> (*this); D& src = static_cast<D&> (*this);
new(targetStorage) D(move(src)); new(targetStorage) D(move(src));
} }
using I::copyInto;
using I::moveInto;
}; };
@ -211,6 +216,9 @@ namespace meta{
D const& src = static_cast<D const&> (*this); D const& src = static_cast<D const&> (*this);
new(targetStorage) D(src); new(targetStorage) D(src);
} }
using I::copyInto;
using I::moveInto;
}; };
@ -233,6 +241,9 @@ namespace meta{
D& s = static_cast<D&> (*this); D& s = static_cast<D&> (*this);
t = move(s); t = move(s);
} }
using I::copyInto;
using I::moveInto;
}; };

View file

@ -59,6 +59,14 @@
** concrete type does not support assignment or copy construction, the respective access ** concrete type does not support assignment or copy construction, the respective access
** function is replaced by an implementation raising a runtime error. ** 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 Veriant_test
** @see lib::diff::GenNode ** @see lib::diff::GenNode
** @see virtual-copy-support.hpp ** @see virtual-copy-support.hpp

View file

@ -39,7 +39,7 @@ namespace asset {
class Proc; class Proc;
class ProcPatt; class ProcPatt;
class BuildInstruct; struct BuildInstruct;
typedef lib::P<const asset::Proc> PProc; typedef lib::P<const asset::Proc> PProc;
typedef lib::P<const asset::ProcPatt> PProcPatt; typedef lib::P<const asset::ProcPatt> PProcPatt;

View file

@ -48,7 +48,7 @@ using boost::format;
namespace proc { namespace proc {
class StreamType; struct StreamType;
namespace mobject { namespace mobject {
namespace session { namespace session {

View file

@ -87,7 +87,7 @@ namespace builder {
public: public:
/** @internal record to describe a model port */ /** @internal record to describe a model port */
struct ModelPortDescriptor; class ModelPortDescriptor;
static void shutdown (); static void shutdown ();

View file

@ -175,7 +175,7 @@ namespace session {
{ {
typedef typename WrapReturn<TY>::Wrapper Ret; typedef typename WrapReturn<TY>::Wrapper Ret;
public:
/** (dummy) implementation of the QueryHandler interface */ /** (dummy) implementation of the QueryHandler interface */
virtual bool virtual bool
resolve (Ret& solution, Query<TY> const& q) resolve (Ret& solution, Query<TY> const& q)

View file

@ -47,6 +47,10 @@ namespace proc {
using lib::Symbol; 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 * TODO write type comment
*/ */

View file

@ -50,7 +50,7 @@ namespace test_format {
class StreamTypeBasics_test : public Test class StreamTypeBasics_test : public Test
{ {
virtual void virtual void
run (Arg arg) run (Arg)
{ {
ImplType iType = buildImplType (); ImplType iType = buildImplType ();
basicImplTypeProperties (iType); basicImplTypeProperties (iType);

View file

@ -161,6 +161,7 @@ namespace test {
CHECK (mp1); CHECK (mp1);
CHECK (mp2); CHECK (mp2);
CHECK (mp1x); CHECK (mp1x);
CHECK (mp2x);
CHECK (!mpNull); // bool check verifies setup and connected state 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 CHECK ( ModelPort::exists (pipeA)); // this is the same check, but invoked just with an pipe-ID

View file

@ -198,7 +198,7 @@ namespace test{
++scope; ++scope;
CHECK (luid == scope->data.get<LuidH>()); CHECK (luid == scope->data.get<LuidH>());
++scope; ++scope;
CHECK (Time(0.92,0) == scope->data.get<TimeSpan>().end()); CHECK (Time(920,0) == scope->data.get<TimeSpan>().end());
++scope; ++scope;
auto spam = *scope; auto spam = *scope;
CHECK (!++scope); CHECK (!++scope);