fix warnings and problems detected by gcc 4.3 / Lenny

This commit is contained in:
Fischlurch 2009-01-10 17:01:09 +00:00
parent b6fb135398
commit f75bb233ba
6 changed files with 40 additions and 23 deletions

View file

@ -102,6 +102,10 @@ namespace lumiera {
ifa->name)); ifa->name));
} }
} // (End) impl details
namespace facade {
/** /**
* @internal Helper/Adapter for establishing a link * @internal Helper/Adapter for establishing a link
@ -113,13 +117,13 @@ namespace lumiera {
* when destroying the InstanceHandle, the proxy will be closed. * when destroying the InstanceHandle, the proxy will be closed.
*/ */
template<class I, class FA> template<class I, class FA>
struct FacadeLink struct Link
: boost::noncopyable : boost::noncopyable
{ {
typedef InstanceHandle<I,FA> IH; typedef InstanceHandle<I,FA> IH;
FacadeLink (IH const& iha) { facade::openProxy(iha); } Link (IH const& iha) { facade::openProxy(iha); }
~FacadeLink() { facade::closeProxy<IH>(); } ~Link() { facade::closeProxy<IH>(); }
FA& FA&
operator() (IH const&) const operator() (IH const&) const
@ -132,16 +136,16 @@ namespace lumiera {
/** /**
* @internal when the InstanceHandle isn't associated with a * @internal when the InstanceHandle isn't associated with a
* facade interface, then this specialisation switches * facade interface, then this specialisation switches
* the FacadeLink into "NOP" mode. * the facade::Link into "NOP" mode.
*/ */
template<class I> template<class I>
struct FacadeLink<I,I> struct Link<I,I>
: boost::noncopyable : boost::noncopyable
{ {
typedef InstanceHandle<I,I> IH; typedef InstanceHandle<I,I> IH;
FacadeLink (IH const&) { /* NOP */ } Link (IH const&) { /* NOP */ }
~FacadeLink() { /* NOP */ } ~Link() { /* NOP */ }
I& I&
operator() (IH const& handle) const operator() (IH const& handle) const
@ -150,7 +154,7 @@ namespace lumiera {
} }
}; };
} // (End) impl details } // namespace facade (impl details)
@ -174,7 +178,7 @@ namespace lumiera {
{ {
LumieraInterface desc_; LumieraInterface desc_;
I* instance_; I* instance_;
FacadeLink<I,FA> facadeLink_; facade::Link<I,FA> facadeLink_;
typedef InstanceHandle<I,FA> _ThisType; typedef InstanceHandle<I,FA> _ThisType;

View file

@ -59,7 +59,7 @@ namespace lumiera {
protected: protected:
typedef InstanceHandle<I,FA> IHandle; typedef InstanceHandle<I,FA> IHandle;
typedef Holder<IHandle> THolder; typedef Holder<IHandle> THolder;
typedef Proxy<IHandle> Proxy; typedef Proxy<IHandle> TProxy;
typedef Accessor<FA> Access; typedef Accessor<FA> Access;
I& _i_; I& _i_;
@ -69,10 +69,10 @@ namespace lumiera {
{ } { }
public: public:
static Proxy& open(IHandle const& iha) static TProxy& open(IHandle const& iha)
{ {
static char buff[sizeof(Proxy)]; static char buff[sizeof(TProxy)];
Proxy* p = new(buff) Proxy(iha); TProxy* p = new(buff) TProxy(iha);
Access::implProxy_ = p; Access::implProxy_ = p;
return *p; return *p;
} }
@ -80,9 +80,9 @@ namespace lumiera {
static void close() static void close()
{ {
if (!Access::implProxy_) return; if (!Access::implProxy_) return;
Proxy* p = static_cast<Proxy*> (Access::implProxy_); TProxy* p = static_cast<TProxy*> (Access::implProxy_);
Access::implProxy_ = 0; Access::implProxy_ = 0;
p->~Proxy(); p->~TProxy();
} }
}; };

View file

@ -162,10 +162,12 @@ namespace lumiera {
bool started = susy->start (opts_, bind (&SubsystemRunner::sigTerm, this, susy, _1)); bool started = susy->start (opts_, bind (&SubsystemRunner::sigTerm, this, susy, _1));
if (started) if (started)
{
if (susy->isRunning()) if (susy->isRunning())
running_.push_back (susy); // now responsible for managing the started subsystem running_.push_back (susy); // now responsible for managing the started subsystem
else else
throw error::Logic("Subsystem "+string(*susy)+" failed to start"); throw error::Logic("Subsystem "+string(*susy)+" failed to start");
}
if (!and_all (susy->getPrerequisites(), isRunning() )) if (!and_all (susy->getPrerequisites(), isRunning() ))
{ {

View file

@ -29,7 +29,7 @@
#define GTK_LUMIERA_HPP #define GTK_LUMIERA_HPP
#include <gtkmm.h> #include <gtkmm.h>
#include <nobug.h> #include <nobug.h> // need to include this after gtkmm.h, because types.h from GTK tries to shaddow the ERROR macro from windows, which kills NoBug's ERROR macro
#include <vector> #include <vector>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>

View file

@ -45,8 +45,9 @@
** @see gui::GtkLumiera#main the GTK GUI main ** @see gui::GtkLumiera#main the GTK GUI main
*/ */
#include <locale> // need to include this to prevent errors when libintl.h defines textdomain (because gtk-lumiera removes the def when ENABLE_NLS isn't defined)
#include "gui/gtk-lumiera.hpp" #include "gui/gtk-lumiera.hpp" // need to include this before nobugcfg.h, because types.h from GTK tries to shaddow the ERROR macro from windows, which kills nobug's ERROR macro
#include "include/nobugcfg.h" #include "include/nobugcfg.h"
#include "lib/error.hpp" #include "lib/error.hpp"
#include "gui/guifacade.hpp" #include "gui/guifacade.hpp"

View file

@ -103,6 +103,7 @@ namespace lumiera {
|| "throw"==startSpec; || "throw"==startSpec;
} }
bool bool
start (lumiera::Option&, Subsys::SigTerm termination) start (lumiera::Option&, Subsys::SigTerm termination)
{ {
@ -282,8 +283,8 @@ namespace lumiera {
MockSys unit4 ("U4", "start(true), run(false)."); MockSys unit4 ("U4", "start(true), run(false).");
SubsystemRunner runner(dummyOpt); SubsystemRunner runner(dummyOpt);
runner.maybeRun (unit1); runner.maybeRun (unit1); // this one doesn't start at all, which isn't considered an error
runner.maybeRun (unit4);
try try
{ {
runner.maybeRun (unit2); runner.maybeRun (unit2);
@ -302,6 +303,15 @@ namespace lumiera {
{ {
ASSERT (lumiera_error() == error::LUMIERA_ERROR_LOGIC); // incorrect behaviour trapped ASSERT (lumiera_error() == error::LUMIERA_ERROR_LOGIC); // incorrect behaviour trapped
} }
try
{
runner.maybeRun (unit4);
NOTREACHED;
}
catch (lumiera::Error&)
{
ASSERT (lumiera_error() == error::LUMIERA_ERROR_LOGIC); // detected that the subsystem didn't come up
}
bool emergency = runner.wait(); bool emergency = runner.wait();