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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -646,7 +646,7 @@ void CRBox::mbkload (MBK::CFig *mbkfig
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Modifier : "CRBox::mbksave()". // 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; int x, y, z, mX, mY, mZ, pitch, spaceVIA;
bool inseg; bool inseg;

View File

@ -222,7 +222,7 @@ namespace D {
class except_done : public exception { class except_done : public exception {
// Overridables. // Overridables.
public: const char* what () const throw () { public: const char* what () const noexcept {
return ((char*)"This exception has already been processed."); return ((char*)"This exception has already been processed.");
} }
}; };
@ -298,15 +298,15 @@ namespace D {
COpts (void) : tShort("+") { } COpts (void) : tShort("+") { }
// Modifiers. // Modifiers.
public: void getopts (int argc, char *argv[]) throw (except_done); public: void getopts (int argc, char *argv[]) ;
public: void add ( string key_short public: void add ( string key_short
, string key_long , string key_long
, bool arg=false , bool arg=false
, string val="" , string val=""
) throw (except_done); ) ;
// Operators. // Operators.
private: long operator() (string key) throw (except_done); private: long operator() (string key) ;
public: struct COpt *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 ()". // Method : "CDRGrid::iterator::valid ()".
void CDRGrid::iterator::valid (bool validindex) void CDRGrid::iterator::valid (bool validindex)
throw (e_matrix_iterator)
{ {
if (_drgrid == NULL) { if (_drgrid == NULL) {
throw e_matrix_iterator ("Attempt to use an uninitialized grid iterator."); 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 ()". // Method : "CDRGrid::iterator::manhattan ()".
int CDRGrid::iterator::manhattan (iterator &other) int CDRGrid::iterator::manhattan (iterator &other)
throw (e_matrix_iterator)
{ {
long manhattan; long manhattan;

View File

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

View File

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