diff --git a/app/StaApp.i b/app/StaApp.i index f38c4697..e9d4d8ce 100644 --- a/app/StaApp.i +++ b/app/StaApp.i @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -%include "StaException.i" +%include "Exception.i" %include "StaTcl.i" %include "Verilog.i" %include "NetworkEdit.i" diff --git a/doc/ApiChanges.txt b/doc/ApiChanges.txt index 6353d976..dcc54c93 100644 --- a/doc/ApiChanges.txt +++ b/doc/ApiChanges.txt @@ -16,6 +16,9 @@ This file summarizes STA API changes for each release. +Release 2.0.18 2020/02/15 +------------------------- + The following iterator functions are deprecated: TimingArcSet::timingArcIterator() @@ -38,6 +41,7 @@ use the following: TimingArc *arc = arc_iter.next(); } +StaException renamed to Exception Release 2.0.17 2019/11/11 ------------------------- diff --git a/sdc/ExceptionPath.cc b/sdc/ExceptionPath.cc index 49ceddf0..9b36986b 100644 --- a/sdc/ExceptionPath.cc +++ b/sdc/ExceptionPath.cc @@ -148,7 +148,7 @@ setNameCmp(NetSet *set1, //////////////////////////////////////////////////////////////// const char * -EmptyExpceptionPt::what() const throw() +EmptyExpceptionPt::what() const noexcept { return "empty exception from/through/to."; } diff --git a/sdc/ExceptionPath.hh b/sdc/ExceptionPath.hh index 5c7eeebd..b0087bfe 100644 --- a/sdc/ExceptionPath.hh +++ b/sdc/ExceptionPath.hh @@ -656,10 +656,10 @@ private: }; // Exception thrown by check. -class EmptyExpceptionPt : public StaException +class EmptyExpceptionPt : public Exception { public: - virtual const char *what() const throw(); + virtual const char *what() const noexcept; }; // Throws EmptyExpceptionPt it finds an empty exception point. diff --git a/search/Property.cc b/search/Property.cc index 279b9e61..51417f78 100644 --- a/search/Property.cc +++ b/search/Property.cc @@ -68,13 +68,13 @@ delayPropertyValue(Delay delay, //////////////////////////////////////////////////////////////// -class PropertyUnknown : public StaException +class PropertyUnknown : public Exception { public: PropertyUnknown(const char *type, const char *property); - virtual ~PropertyUnknown() THROW_DCL {} - virtual const char *what() const throw(); + virtual ~PropertyUnknown() {} + virtual const char *what() const noexcept; private: const char *type_; @@ -83,13 +83,14 @@ private: PropertyUnknown::PropertyUnknown(const char *type, const char *property) : + Exception(), type_(type), property_(property) { } const char * -PropertyUnknown::what() const throw() +PropertyUnknown::what() const noexcept { return stringPrint("Error: %s objects do not have a %s property.", type_, property_); diff --git a/search/WritePathSpice.cc b/search/WritePathSpice.cc index ebc242bb..b330dd91 100644 --- a/search/WritePathSpice.cc +++ b/search/WritePathSpice.cc @@ -224,19 +224,20 @@ private: //////////////////////////////////////////////////////////////// -class SubcktEndsMissing : public StaException +class SubcktEndsMissing : public Exception { public: SubcktEndsMissing(const char *cell_name, const char *subckt_filename); - const char *what() const throw(); + const char *what() const noexcept; protected: string what_; }; SubcktEndsMissing::SubcktEndsMissing(const char *cell_name, - const char *subckt_filename) + const char *subckt_filename) : + Exception() { what_ = "Error: spice subckt for cell "; what_ += cell_name; @@ -245,7 +246,7 @@ SubcktEndsMissing::SubcktEndsMissing(const char *cell_name, } const char * -SubcktEndsMissing::what() const throw() +SubcktEndsMissing::what() const noexcept { return what_.c_str(); } diff --git a/tcl/StaException.i b/tcl/Exception.i similarity index 90% rename from tcl/StaException.i rename to tcl/Exception.i index 0659e842..490ede15 100644 --- a/tcl/StaException.i +++ b/tcl/Exception.i @@ -16,21 +16,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "Machine.hh" -#include "Error.hh" - -using sta::StaException; - %} %exception { try { $function } - catch (StaException &excp) { - Tcl_SetResult(interp, const_cast(excp.what()), TCL_VOLATILE); - return TCL_ERROR; - } catch (std::bad_alloc &) { fprintf(stderr, "Error: out of memory.\n"); exit(0); } + catch (std::exception &excp) { + Tcl_SetResult(interp, const_cast(excp.what()), TCL_VOLATILE); + return TCL_ERROR; + } } diff --git a/tcl/StaTcl.i b/tcl/StaTcl.i index bc0a1df3..6db0caa2 100644 --- a/tcl/StaTcl.i +++ b/tcl/StaTcl.i @@ -108,17 +108,17 @@ typedef MinMaxAll MinMaxAllNull; typedef ClockSet TmpClockSet; typedef StringSeq TmpStringSeq; -class CmdErrorNetworkNotLinked : public StaException +class CmdErrorNetworkNotLinked : public Exception { public: - virtual const char *what() const throw() + virtual const char *what() const noexcept { return "Error: no network has been linked."; } }; -class CmdErrorNetworkNotEditable : public StaException +class CmdErrorNetworkNotEditable : public Exception { public: - virtual const char *what() const throw() + virtual const char *what() const noexcept { return "Error: network does not support edits."; } }; diff --git a/util/Error.cc b/util/Error.cc index 2ba320a3..18d3bbdd 100644 --- a/util/Error.cc +++ b/util/Error.cc @@ -22,14 +22,14 @@ namespace sta { -StaException::StaException() : +Exception::Exception() : std::exception() { } -StaExceptionLine::StaExceptionLine(const char *filename, - int line) : - StaException(), +ExceptionLine::ExceptionLine(const char *filename, + int line) : + Exception(), filename_(filename), line_(line) { @@ -38,13 +38,13 @@ StaExceptionLine::StaExceptionLine(const char *filename, InternalError::InternalError(const char *filename, int line, const char *msg) : - StaExceptionLine(filename, line), + ExceptionLine(filename, line), msg_(msg) { } const char * -InternalError::what() const throw() +InternalError::what() const noexcept { return stringPrintTmp("Internal error in %s:%d %s.", filename_, line_, msg_); @@ -56,7 +56,7 @@ FileNotReadable::FileNotReadable(const char *filename) : } const char * -FileNotReadable::what() const throw() +FileNotReadable::what() const noexcept { return stringPrintTmp("Error: cannot read file %s.", filename_); } @@ -67,7 +67,7 @@ FileNotWritable::FileNotWritable(const char *filename) : } const char * -FileNotWritable::what() const throw() +FileNotWritable::what() const noexcept { return stringPrintTmp("Error: cannot write file %s.", filename_); } diff --git a/util/Error.hh b/util/Error.hh index e82d1389..dd0d4e03 100644 --- a/util/Error.hh +++ b/util/Error.hh @@ -22,32 +22,32 @@ namespace sta { // Abstract base class for sta exceptions. -class StaException : public std::exception +class Exception : public std::exception { public: - StaException(); - virtual ~StaException() THROW_DCL {} - virtual const char *what() const throw() = 0; + Exception(); + virtual ~Exception() {} + virtual const char *what() const noexcept = 0; }; -class StaExceptionLine : public StaException +class ExceptionLine : public Exception { public: - StaExceptionLine(const char *filename, - int line); + ExceptionLine(const char *filename, + int line); protected: const char *filename_; int line_; }; -class InternalError : public StaExceptionLine +class InternalError : public ExceptionLine { public: InternalError(const char *filename, int line, const char *msg); - virtual const char *what() const throw(); + virtual const char *what() const noexcept; protected: const char *msg_; @@ -64,22 +64,22 @@ protected: printf("Internal Error: %s:%d %s\n", __FILE__, __LINE__, msg) // Failure opening filename for reading. -class FileNotReadable : public StaException +class FileNotReadable : public Exception { public: explicit FileNotReadable(const char *filename); - virtual const char *what() const throw(); + virtual const char *what() const noexcept; protected: const char *filename_; }; // Failure opening filename for writing. -class FileNotWritable : public StaException +class FileNotWritable : public Exception { public: explicit FileNotWritable(const char *filename); - virtual const char *what() const throw(); + virtual const char *what() const noexcept; protected: const char *filename_; diff --git a/util/Machine.hh b/util/Machine.hh index 07dd0c0c..a2030ea8 100644 --- a/util/Machine.hh +++ b/util/Machine.hh @@ -62,9 +62,6 @@ #define strtoull _strtoui64 // Flex doesn't check for unistd.h. #define YY_NO_UNISTD_H - // Visual c++ version of std::exception destructor missing throw() - // declaration. - #define THROW_DCL namespace sta { int vsnprint(char *str, size_t size, const char *fmt, va_list args); } @@ -72,7 +69,6 @@ #define DllExport #include // intptr_t #define vsnprint vsnprintf - #define THROW_DCL throw() #endif // _WINDOWS #include diff --git a/util/PatternMatch.cc b/util/PatternMatch.cc index 2df559ef..41f9456a 100644 --- a/util/PatternMatch.cc +++ b/util/PatternMatch.cc @@ -114,14 +114,14 @@ PatternMatch::matchNoCase(const char *str) const //////////////////////////////////////////////////////////////// RegexpCompileError::RegexpCompileError(const char *pattern) : - StaException() + Exception() { const char *msg = "Error: TCL failed to compile regular expression '%s'."; error_ = stringPrintTmp(msg, pattern); } const char * -RegexpCompileError::what() const throw() +RegexpCompileError::what() const noexcept { return error_; } diff --git a/util/PatternMatch.hh b/util/PatternMatch.hh index 7eed62ba..724e487a 100644 --- a/util/PatternMatch.hh +++ b/util/PatternMatch.hh @@ -64,11 +64,11 @@ private: }; // Error thrown by Pattern constructor. -class RegexpCompileError : public StaException +class RegexpCompileError : public Exception { public: explicit RegexpCompileError(const char *error); - virtual ~RegexpCompileError() throw() {} + virtual ~RegexpCompileError() noexcept {} virtual const char *what() const throw(); private: