Compliance with the C++11 throw policy.

This commit is contained in:
Jean-Paul Chaput 2021-10-01 18:36:22 +02:00
parent 720e37e77c
commit 4e726b8c3b
15 changed files with 55 additions and 65 deletions

View File

@ -572,7 +572,7 @@ void CAStar::load (CNet *pNet, int delta, int expand)
// -------------------------------------------------------------------
// Method : "CAStar::step()".
bool CAStar::step (void) throw (trapped_astar)
bool CAStar::step (void)
{
CNodeAS *successors[6], *pNodeAS;
int edge;
@ -806,7 +806,7 @@ void CAStar::dump (void)
// -------------------------------------------------------------------
// Method : "CAStar::route()".
void CAStar::route (CNet *pNet) throw (reach_max_pri)
void CAStar::route (CNet *pNet)
{
int pri;
int increase, expand;

View File

@ -49,7 +49,7 @@
public: trapped_astar (CNet *pNet) { net = pNet; }
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"AStar algorithm can't find a path.");
}
};
@ -69,7 +69,7 @@
public: no_route (CNet *pNet) { net = pNet; }
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"No route.");
}
};
@ -89,7 +89,7 @@
public: reach_max_pri (CNet *pNet) { net = pNet; }
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"Maximum priority reached in AStar.");
}
};
@ -271,7 +271,7 @@
public: CAStar (CDRGrid *drgrid, CASimple *netsched);
// Modifiers.
private: bool step (void) throw (trapped_astar);
private: bool step (void);
private: bool nexttarget (void);
private: void backtrack (void);
private: void abort (void);
@ -279,7 +279,7 @@
public: void clear (void);
public: void load (CNet *pNet, int delta=0, int expand=0);
public: bool search (void);
public: void route (CNet *pNet) throw (reach_max_pri);
public: void route (CNet *pNet);
// Database integrity check.

View File

@ -118,7 +118,6 @@ CDRGrid::iterator::iterator (const CDRGrid::iterator &other)
// Method : "CDRGrid::iterator::valid ()".
void CDRGrid::iterator::valid (bool validindex)
throw (e_matrix_iterator)
{
if (_drgrid == NULL) {
throw e_matrix_iterator ("Attempt to use an uninitialized grid iterator.");
@ -292,7 +291,6 @@ ostream &operator<< (ostream &o, CDRGrid::iterator &self)
// Method : "CDRGrid::iterator::manhattan ()".
int CDRGrid::iterator::manhattan (iterator &other)
throw (e_matrix_iterator)
{
long manhattan;
@ -321,7 +319,6 @@ int CDRGrid::iterator::manhattan (iterator &other)
// Constructor : "CDRGrid::CDRGrid()".
CDRGrid::CDRGrid (int xoff, int yoff, int x, int y, int z, int zup)
throw (e_zupper)
: xoffset(xoff)
, yoffset(yoff)
, X(x)

View File

@ -132,10 +132,10 @@
public: e_matrix_iterator (string msg) : message(msg) { }
// Destructor.
public: ~e_matrix_iterator (void) throw () { };
public: ~e_matrix_iterator (void) { };
// Overridables.
public: const char* what () const throw () { return (message.c_str()); }
public: const char* what () const noexcept { return (message.c_str()); }
};
@ -152,10 +152,10 @@
public: e_zupper (int zup) { zupper = zup; }
// Destructor.
public: ~e_zupper (void) throw () { };
public: ~e_zupper (void) { };
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"\"zupper\" must not be lower than 4.");
}
};
@ -248,7 +248,7 @@
public: friend ostream &operator<< (ostream &o, iterator &self);
public: void valid (bool validindex) throw (e_matrix_iterator);
public: void valid (bool validindex);
public: int x (void) { return ( _drgrid->x (_index) ); }
public: int y (void) { return ( _drgrid->y (_index) ); }
public: int z (void) { return ( _drgrid->z (_index) ); }
@ -262,7 +262,7 @@
return (false);
};
public: int manhattan (iterator &other) throw (e_matrix_iterator);
public: int manhattan (iterator &other);
public: int zupper (void) { return ( _drgrid->zupper ); }
// Modifiers.
@ -315,7 +315,7 @@
public: CMatrixNodes *nodes;
// Constructor.
public: CDRGrid (int xoff, int yoff, int x, int y, int z, int zup) throw (e_zupper);
public: CDRGrid (int xoff, int yoff, int x, int y, int z, int zup);
private: CDRGrid ( const CDRGrid& );
@ -481,10 +481,10 @@
{ }
// Destructor.
public: ~bad_grab (void) throw () { };
public: ~bad_grab (void) { };
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"Attempt to grab a non-free node.");
}
@ -531,7 +531,7 @@
public: void grab ( CNet *net
, int pri
, CDRGrid::iterator &coord
) throw (bad_grab);
);
public: void ungrab (void);
public: void lock (void) { data.lock = true; }
public: void unlock (void) { data.lock = false; }
@ -627,10 +627,10 @@
{ }
// Destructor.
public: ~dup_term (void) throw () { };
public: ~dup_term (void) { };
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"Duplicated terminal node.");
}
};
@ -666,10 +666,10 @@
}
// Destructor.
public: ~merge_term (void) throw () { };
public: ~merge_term (void) { };
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return (message.c_str());
}
};
@ -700,8 +700,7 @@
public: CDRGrid::iterator &lowest (void);
// Modifiers.
public: CNode *newaccess (int x, int y, int z, int ident, CNet *net)
throw (dup_term, bad_grab, merge_term);
public: CNode *newaccess (int x, int y, int z, int ident, CNet *net);
public: void newaccess (CRect &rect, int z, int ident, CNet *net);
public: void merge (CTerm *other, int ident, CNet *net);
public: void lockalone (bool global=false);
@ -727,10 +726,10 @@
public: dup_net (string netName) : name(netName) { }
// Destructor.
public: ~dup_net (void) throw () { };
public: ~dup_net (void) { };
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"Duplicated net.");
}
};
@ -751,10 +750,10 @@
public: term_unknown (string nName, string tName) : netName(nName), termName(tName) { }
// Destructor.
public: ~term_unknown (void) throw () { };
public: ~term_unknown (void) { };
// Overridables.
public: virtual const char* what () const throw () {
public: virtual const char* what () const noexcept {
return ((char*)"Unknown terminal.");
}
};

View File

@ -316,7 +316,7 @@ CEnv::CEnv (void)
// -------------------------------------------------------------------
// Method : "CEnv::layer2width()".
long CEnv::layer2width (char layer) throw (except_done)
long CEnv::layer2width (char layer)
{
MLayer::iterator itLayer;
@ -336,7 +336,7 @@ long CEnv::layer2width (char layer) throw (except_done)
// -------------------------------------------------------------------
// Method : "CEnv::layer2spacing()".
long CEnv::layer2spacing (char layer) throw (except_done)
long CEnv::layer2spacing (char layer)
{
MLayer::iterator itLayer;
@ -356,7 +356,7 @@ long CEnv::layer2spacing (char layer) throw (except_done)
// -------------------------------------------------------------------
// Method : "CEnv::layer2z()".
long CEnv::layer2z (char layer) throw (except_done)
long CEnv::layer2z (char layer)
{
MLayer::iterator itLayer;
@ -376,7 +376,7 @@ long CEnv::layer2z (char layer) throw (except_done)
// -------------------------------------------------------------------
// Method : "CEnv::z2alu()".
char CEnv::z2alu (int z) throw (except_done)
char CEnv::z2alu (int z)
{
MLayer::iterator itLayer, endLayer;
@ -399,7 +399,7 @@ char CEnv::z2alu (int z) throw (except_done)
// -------------------------------------------------------------------
// Method : "CEnv::z2calu()".
char CEnv::z2calu (int z) throw (except_done)
char CEnv::z2calu (int z)
{
MLayer::iterator itLayer, endLayer;
@ -422,7 +422,7 @@ char CEnv::z2calu (int z) throw (except_done)
// -------------------------------------------------------------------
// Method : "CEnv::z2via()".
char CEnv::z2via (int z) throw (except_done)
char CEnv::z2via (int z)
{
char viaType;
@ -768,8 +768,8 @@ phseg_list &CIns::flatseg (phseg_list &flatSeg, phseg_list &seg)
// -------------------------------------------------------------------
// Constructor : "CFig::CFig()".
CFig::CFig (string &nameLofig, string &namePhfig) throw (except_done):
lofig (nameLofig), phfig (namePhfig)
CFig::CFig (string &nameLofig, string &namePhfig)
: lofig (nameLofig), phfig (namePhfig)
{
MLoins::iterator itLoins, endLoins;
MPhins::iterator itPhins, endPhins;

View File

@ -145,12 +145,12 @@ namespace MBK {
CEnv (void);
// Accessors.
long layer2spacing (char layer) throw (except_done);
long layer2width (char layer) throw (except_done);
long layer2z (char layer) throw (except_done);
char z2calu (int z) throw (except_done);
char z2alu (int z) throw (except_done);
char z2via (int z) throw (except_done);
long layer2spacing (char layer) ;
long layer2width (char layer) ;
long layer2z (char layer) ;
char z2calu (int z) ;
char z2alu (int z) ;
char z2via (int z) ;
long z2width (int z) { return (layer2width (z2alu(z))); }
@ -258,7 +258,7 @@ namespace MBK {
MIns orphans;
// Constructor.
CFig (string &nameLofig, string &namePhfig) throw (except_done);
CFig (string &nameLofig, string &namePhfig) ;
// Destructor.
~CFig (void);
@ -351,7 +351,7 @@ namespace MBK {
LPower powerLines;
// Constructor.
CPowers (CFig*, long xoff, long yoff, char, int, long) throw (except_done);
CPowers (CFig*, long xoff, long yoff, char, int, long) ;
// Methods.
void dump (CFig *fig);

View File

@ -134,7 +134,6 @@ CDRGrid::iterator &CTerm::lowest (void)
// Method : "CTerm::newaccess()".
CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net)
throw (dup_term, bad_grab, merge_term)
{
list<CDRGrid::iterator>::iterator itNode;
CDRGrid::iterator coord;

View File

@ -58,7 +58,6 @@ CNode::CNode (void)
// Method : "CNode::grab()".
void CNode::grab (CNet *net, int pri, CDRGrid::iterator &coord)
throw (bad_grab)
{
if (data.owner && (data.owner != net))
throw bad_grab ( data.owner->terms[getid()]->name

View File

@ -71,7 +71,7 @@ CPowers::CPowers ( CFig *fig
, char atype
, int alayer
, long awidth
) throw (except_done)
)
: xoffset(xoff)
, yoffset(yoff)
{

View File

@ -70,7 +70,7 @@
, bool yalfpitch
, bool rotate
, set<string>* subNetList=NULL );
public: void mbksave (string &name) throw (except_done);
public: void mbksave (string &name) ;
public: void route (void);
};

View File

@ -646,7 +646,7 @@ void CRBox::mbkload (MBK::CFig *mbkfig
// -------------------------------------------------------------------
// Modifier : "CRBox::mbksave()".
void CRBox::mbksave (string &name) throw (except_done)
void CRBox::mbksave (string &name)
{
int x, y, z, mX, mY, mZ, pitch, spaceVIA;
bool inseg;

View File

@ -222,7 +222,7 @@ namespace D {
class except_done : public exception {
// Overridables.
public: const char* what () const throw () {
public: const char* what () const noexcept {
return ((char*)"This exception has already been processed.");
}
};
@ -298,15 +298,15 @@ namespace D {
COpts (void) : tShort("+") { }
// Modifiers.
public: void getopts (int argc, char *argv[]) throw (except_done);
public: void getopts (int argc, char *argv[]) ;
public: void add ( string key_short
, string key_long
, bool arg=false
, string val=""
) throw (except_done);
) ;
// Operators.
private: long operator() (string key) throw (except_done);
private: long operator() (string key) ;
public: struct COpt *operator[] (string key);
};

View File

@ -195,7 +195,6 @@ CDRGrid::iterator::iterator (CDRGrid::iterator &other)
// Method : "CDRGrid::iterator::valid ()".
void CDRGrid::iterator::valid (bool validindex)
throw (e_matrix_iterator)
{
if (_drgrid == NULL) {
throw e_matrix_iterator ("Attempt to use an uninitialized grid iterator.");
@ -328,7 +327,6 @@ ostream &operator<< (ostream &o, CDRGrid::iterator &self)
// Method : "CDRGrid::iterator::manhattan ()".
int CDRGrid::iterator::manhattan (iterator &other)
throw (e_matrix_iterator)
{
long manhattan;

View File

@ -56,7 +56,7 @@ void COpts::add ( string key_short
, string key_long
, bool arg
, string val
) throw (except_done)
)
{
long key_index;
@ -109,7 +109,7 @@ void COpts::add ( string key_short
// -------------------------------------------------------------------
// Modifier : "COpts::getopts()".
void COpts::getopts (int argc, char *argv[]) throw (except_done)
void COpts::getopts (int argc, char *argv[])
{
extern int opterr;
extern int optopt;
@ -161,7 +161,7 @@ void COpts::getopts (int argc, char *argv[]) throw (except_done)
// -------------------------------------------------------------------
// Operator : "COpts::operator()".
long COpts::operator() (string key) throw (except_done)
long COpts::operator() (string key)
{
MOpt::iterator iter;

View File

@ -266,13 +266,13 @@
public: friend ostream &operator<< (ostream &o, iterator &self);
public: void valid (bool validindex) throw (e_matrix_iterator);
public: void valid (bool validindex);
public: int x (void) { return ( _drgrid->x (_index) ); }
public: int y (void) { return ( _drgrid->y (_index) ); }
public: int z (void) { return ( _drgrid->z (_index) ); }
public: bool outside (void) { return ( _index == INT_MAX ); }
public: bool inside (void) { return ( !outside() ); }
public: int manhattan (iterator &other) throw (e_matrix_iterator);
public: int manhattan (iterator &other);
// Modifiers.
public: iterator &set (int x, int y, int z);
@ -363,7 +363,6 @@ CDRGrid::iterator::iterator (CDRGrid::iterator &other)
// Method : "CDRGrid::iterator::valid ()".
void CDRGrid::iterator::valid (bool validindex)
throw (e_matrix_iterator)
{
if (_drgrid == NULL) {
throw e_matrix_iterator ("Attempt to use an uninitialized grid iterator.");
@ -496,7 +495,6 @@ ostream &operator<< (ostream &o, CDRGrid::iterator &self)
// Method : "CDRGrid::iterator::manhattan ()".
int CDRGrid::iterator::manhattan (iterator &other)
throw (e_matrix_iterator)
{
long manhattan;
@ -796,7 +794,7 @@ __CNode__ &TMatrix<__CNode__>::add (int index)
public: CNode &lowest (void);
// Modifiers.
public: CNode *newaccess (int x, int y, int z, int ident, CNet *net) throw (dup_term);
public: CNode *newaccess (int x, int y, int z, int ident, CNet *net);
public: void newaccess (CRect &rect, int z, int ident, CNet *net);
public: void lockalone (bool global=false);
public: void setid (int ident);