This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Another 'dwarf' ICE in egcs-1.1b


Did run into another ICE.  I am really sorry I don't have time to
strip down the test cases further :(.  Hope you find it useful to
get any ICE test case anyway.  Note that the program is full of
errors, which are probably causing it, so its not of a high priority :)

~/c++/libr/src/kernel>g++ -ggdb -c bug.cc -o bug.obug.cc:125: syntax error before `::'
bug.cc:130: warning: ANSI C++ forbids declaration `' with no type
bug.cc:130: abstract declarator `int' used as declaration
bug.cc:131: parse error before `}'
bug.cc:135: parse error before `.*'
bug.cc:136: syntax error before `.'
bug.cc:147: cannot declare member `busy_interface_ct::none' within `simple_event_server_tct<EVENTDATA>'
../../egcs-1.1b/gcc/dwarf2out.c:6247: Internal compiler error in function is_base_type

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>

The current hopeless junk I am working on (bug.cc) (all rights reserved):
------------------------------------------------------------------------------
#include <list>

class event_data_ct {
public:
  virtual bool check_range(void) = 0;
};

template<class EVENTDATA>
class event_server_tct {
public:
  typedef EVENTDATA event_data_ct;

  class event_type_ct : public EVENTDATA {
  public:
    virtual bool check_range(void);
  };
};

template<class EVENTDATA>
class event_request_btct {
private:
  unsigned int reference_count;

protected:
  virtual ~event_request_btct() { }

public:
  event_request_btct(void) : reference_count(1) {}
  virtual void triggered(const EVENTDATA &eventdata) = 0;
  void add_reference(void) { ++reference_count; }
  void release(void) { if (!--reference_count) delete this; }
};

class event_ct {
};

template<class EVENTDATA>
class event_tct : public event_ct {
  event_request_btct<EVENTDATA> *event_request;
  const EVENTDATA &event_data;
public:
  event_tct(event_request_btct<EVENTDATA> *er, const EVENTDATA &d) : event_request(er), event_data(d) { }
};

class never_busy_interface_ct {
public:
  bool is_busy(void) { return false; }
  void set_busy(void) { }
  void unset_busy(void) { }
  void store(void *) { }
};

class busy_interface_ct {
private:
  bool busy;
  list<event_request_btct<event_ct> *> events;

public:
  static never_busy_interface_ct none;		// Hook for empty busy interface

  busy_interface_ct(void) : busy(false) { }

  bool is_busy(void) { return busy; }
  void set_busy(void) { busy = true; }
  void unset_busy(void) { busy = false; }
  template<class EVENTDATA>
  void store(event_request_btct<EVENTDATA> *event_request, const EVENTDATA &d)
      { events.push_back(new event_tct<EVENTDATA>(event_request, d)); }
};

//-----------------------------------------------------------------------------
//
// Simple Event Server template
//
// This event server simply stores are all requests in one list
// and subsequently calls the methods of the event clients when
// the event is triggered (by calling the method `trigger()').
//
// This simple event server does not allow you to pass data with the
// request and handles the events in the same order as they are arrived
// (No priorities).
//

template<class EVENTDATA>
class simple_event_server_tct : public event_server_tct<EVENTDATA> {
public:
  template<class EVENTCLIENT, class BUSYINTERFACE>
  class event_request_tct : public event_request_btct<EVENTDATA> {
    EVENTCLIENT event_client;
    void (EVENTCLIENT::*callbackfunc)(const event_type_ct &);
    BUSYINTERFACE busy_interface;
  public:
    event_request_tct(EVENTCLIENT ec, void (EVENTCLIENT::*em)(const event_type_ct &), BUSYINTERFACE bi)
        : event_client(ec), callbackfunc(em), busy_interface(bi) { }
    virtual void triggered(const EVENTDATA &d);
  };

private:
  typedef list<event_request_btct<EVENTDATA> *> request_list_ct;
  request_list_ct clients;

public:
  ~simple_event_server_tct();
  template<class EVENTCLIENT, class BUSYINTERFACE>
  void request(EVENTCLIENT *ec, void (EVENTCLIENT::*em)(const event_type_ct &), BUSYINTERFACE bi);
  void trigger(const EVENTDATA &d);
};

template<class EVENTDATA>
simple_event_server_tct<EVENTDATA>::~simple_event_server_tct()
{
  for (request_list_ct::iterator i = clients.begin(); i != clients.end(); ++i)
    (*i)->release();
}

template<class EVENTDATA>
template<class EVENTCLIENT, class BUSYINTERFACE>
void simple_event_server_tct<EVENTDATA>::request(EVENTCLIENT *ec, void (EVENTCLIENT::*em)(const event_type_ct &), BUSYINTERFACE bi)
{
  clients.push_back(new event_request_tct<EVENTCLIENT, BUSYINTERFACE>(ec, em, bi));
}

template<class EVENTDATA>
template<class EVENTCLIENT, class BUSYINTERFACE>
void simple_event_server_tct<EVENTDATA>::EventRequest::triggered(const EVENTDATA &d)
{
  if (bi.is_busy())
  {
    bi.store(this, d);
    add_reference();
  }
  else
  {
    bi.set_busy();
    (ptr.*func)(d);
    bi.unset_busy();
  }
}

template<class EVENTDATA>
void simple_event_server_tct<EVENTDATA>::trigger(const EVENTDATA &d)
{
  for (request_list_ct::iterator i = clients.begin(); i != clients.end(); ++i)
    (*i)->triggered(d);
}

never_busy_interface_ct busy_interface_ct::none;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]