Skip to content

Commit

Permalink
StaException -> Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Feb 16, 2020
1 parent 88c9cd3 commit 9cacb0c
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 54 deletions.
2 changes: 1 addition & 1 deletion app/StaApp.i
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

%include "StaException.i"
%include "Exception.i"
%include "StaTcl.i"
%include "Verilog.i"
%include "NetworkEdit.i"
Expand Down
4 changes: 4 additions & 0 deletions doc/ApiChanges.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -38,6 +41,7 @@ use the following:
TimingArc *arc = arc_iter.next();
}

StaException renamed to Exception

Release 2.0.17 2019/11/11
-------------------------
Expand Down
2 changes: 1 addition & 1 deletion sdc/ExceptionPath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ setNameCmp(NetSet *set1,
////////////////////////////////////////////////////////////////

const char *
EmptyExpceptionPt::what() const throw()
EmptyExpceptionPt::what() const noexcept
{
return "empty exception from/through/to.";
}
Expand Down
4 changes: 2 additions & 2 deletions sdc/ExceptionPath.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions search/Property.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand All @@ -83,13 +83,14 @@ class PropertyUnknown : public StaException

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_);
Expand Down
9 changes: 5 additions & 4 deletions search/WritePathSpice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,20 @@ class WritePathSpice : public StaState

////////////////////////////////////////////////////////////////

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;
Expand All @@ -245,7 +246,7 @@ SubcktEndsMissing::SubcktEndsMissing(const char *cell_name,
}

const char *
SubcktEndsMissing::what() const throw()
SubcktEndsMissing::what() const noexcept
{
return what_.c_str();
}
Expand Down
13 changes: 4 additions & 9 deletions tcl/StaException.i → tcl/Exception.i
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#include "Machine.hh"
#include "Error.hh"

using sta::StaException;

%}

%exception {
try { $function }
catch (StaException &excp) {
Tcl_SetResult(interp, const_cast<char*>(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<char*>(excp.what()), TCL_VOLATILE);
return TCL_ERROR;
}
}
8 changes: 4 additions & 4 deletions tcl/StaTcl.i
Original file line number Diff line number Diff line change
Expand Up @@ -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."; }
};

Expand Down
16 changes: 8 additions & 8 deletions util/Error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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_);
Expand All @@ -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_);
}
Expand All @@ -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_);
}
Expand Down
26 changes: 13 additions & 13 deletions util/Error.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand All @@ -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_;
Expand Down
4 changes: 0 additions & 4 deletions util/Machine.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,13 @@
#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);
}
#else
#define DllExport
#include <stdint.h> // intptr_t
#define vsnprint vsnprintf
#define THROW_DCL throw()
#endif // _WINDOWS

#include <stddef.h>
Expand Down
4 changes: 2 additions & 2 deletions util/PatternMatch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}
Expand Down
4 changes: 2 additions & 2 deletions util/PatternMatch.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9cacb0c

Please sign in to comment.