Correct for various warnings appearing under gcc 8.3.0 (Debian 10).

Note: We don't suppress warnings due to unused variables or functions,
      as we may need them later or in debug mode...

* Change: In Hurricane::DBo::~DBo, add a noexcept(false) because
    constructed by default destructor of derived classes seems to
    loosen it. The right solution whould be to explicitely define
    all virtual destructors (too lazy for now).
* Change: In Viewer::Script, replace the deprecated
    PyModule_GetFilename() by PyModule_GetFilenameObject(), Unicode
    support again...
This commit is contained in:
Jean-Paul Chaput 2021-10-01 16:12:28 +02:00
parent c28fe3402b
commit e11bd98f52
10 changed files with 23 additions and 17 deletions

View File

@ -374,7 +374,7 @@ namespace CRL {
if (state->getFlags(loadMode) != 0) continue; if (state->getFlags(loadMode) != 0) continue;
// Transmit all flags except thoses related to views. // Transmit all flags except thoses related to views.
loadMode |= (mode & (!Catalog::State::Views)); loadMode |= (mode & (~Catalog::State::Views));
parser = & (_parsers.getParserSlot( name, loadMode, _environment )); parser = & (_parsers.getParserSlot( name, loadMode, _environment ));
// Try to open cell file (file extention is supplied by the parser). // Try to open cell file (file extention is supplied by the parser).
@ -864,7 +864,7 @@ namespace CRL {
if ( catalogProperty != NULL ) { if ( catalogProperty != NULL ) {
Catalog::State* state = catalogProperty->getState (); Catalog::State* state = catalogProperty->getState ();
if ( (flags and IgnoreFeeds) and state->isFeed() ) continue; if ( (flags & IgnoreFeeds) and state->isFeed() ) continue;
} }
++gates; ++gates;

View File

@ -515,7 +515,7 @@ Occurrence CHyperNetReceiverPortOccurrences::Locator::getElement() const
{ {
if (_pinLocator.isValid()) if (_pinLocator.isValid())
return _pinLocator.getElement(); return _pinLocator.getElement();
return _plugOccurrenceLocator.getElement(); return _plugOccurrenceLocator.getElement();
} }
Locator<Occurrence>* CHyperNetReceiverPortOccurrences::Locator::getClone() const Locator<Occurrence>* CHyperNetReceiverPortOccurrences::Locator::getClone() const

View File

@ -401,7 +401,7 @@ static void AttachContacts(Net* net)
{ {
if (contact->getBodyHook()->isAttached()) if (contact->getBodyHook()->isAttached())
throw Error("Cannot create contacts ring: A bodyHook is attached"); throw Error("Cannot create contacts ring: A bodyHook is attached");
componentsToAttachList.push_back(contact); componentsToAttachList.push_back(contact);
end_for; end_for;
} }
list<Component*>::iterator lcit = componentsToAttachList.begin(); list<Component*>::iterator lcit = componentsToAttachList.begin();
@ -779,7 +779,7 @@ void ConnectPlugHooks(Cell* cell)
try { try {
_index = std::stoi( sindex ); _index = std::stoi( sindex );
} }
catch ( std::invalid_argument e ) { catch ( std::invalid_argument& e ) {
cerr << Error( "SubNetNames::match(): std::stoi() catched an exception on \"%s\"." cerr << Error( "SubNetNames::match(): std::stoi() catched an exception on \"%s\"."
, sindex.c_str() ) << endl; , sindex.c_str() ) << endl;
} }

View File

@ -1998,8 +1998,8 @@ namespace Isobar3 {
PyErr_Clear(); PyErr_Clear();
setMessage( funcName() + "(): " ); setMessage( funcName() + "(): " );
TC* object; TC* object = NULL;
TArg* arg; TArg* arg = NULL;
pyToC( pyObject, &object ); pyToC( pyObject, &object );
if (not pyToC( pyArg, &arg )) { if (not pyToC( pyArg, &arg )) {
string message = "PyInPlaceOperatorWrapper():"; string message = "PyInPlaceOperatorWrapper():";

View File

@ -157,7 +157,7 @@ namespace Hurricane {
} }
DBo::~DBo () DBo::~DBo () noexcept(false)
{ {
if (_idCount) --_idCount; if (_idCount) --_idCount;
else { else {

View File

@ -196,11 +196,11 @@ Hook::Hook()
{ {
} }
Hook::~Hook() Hook::~Hook() noexcept(false)
// ********** // **************************
{ {
if (_nextHook != this) if (_nextHook != this)
throw Error("Abnormal deletion of hook : always attached"); throw Error("Abnormal deletion of hook : still attached");
} }
Hook* Hook::getNextHook() const Hook* Hook::getNextHook() const

View File

@ -81,7 +81,7 @@ namespace Hurricane {
void toJsonSignature ( JsonWriter* ) const; void toJsonSignature ( JsonWriter* ) const;
protected: protected:
DBo (); DBo ();
virtual ~DBo (); virtual ~DBo () noexcept(false);
virtual void _postCreate (); virtual void _postCreate ();
virtual void _preDestroy (); virtual void _preDestroy ();
private: private:

View File

@ -52,7 +52,7 @@ class Hook {
// Destructor // Destructor
// ********** // **********
protected: virtual ~Hook(); protected: virtual ~Hook() noexcept(false);
// Operators // Operators
// ********* // *********

View File

@ -115,7 +115,7 @@ namespace Hurricane {
inline bool PhysicalRule::isDouble () const { return _doubleValue != 0; } inline bool PhysicalRule::isDouble () const { return _doubleValue != 0; }
inline bool PhysicalRule::isDbU () const { return not _stepsValue.empty(); } inline bool PhysicalRule::isDbU () const { return not _stepsValue.empty(); }
inline bool PhysicalRule::isSymmetric () const { return _symmetric; } inline bool PhysicalRule::isSymmetric () const { return _symmetric; }
inline bool PhysicalRule::hasSteps () const { return not _stepsValue.size() > 1; } inline bool PhysicalRule::hasSteps () const { return not (_stepsValue.size() > 1); }
inline double PhysicalRule::getDoubleValue () const { return _doubleValue; } inline double PhysicalRule::getDoubleValue () const { return _doubleValue; }
inline void PhysicalRule::setSymmetric ( bool state ) { _symmetric = state; } inline void PhysicalRule::setSymmetric ( bool state ) { _symmetric = state; }
inline void PhysicalRule::addValue ( double value ) { _doubleValue = value; } inline void PhysicalRule::addValue ( double value ) { _doubleValue = value; }

View File

@ -48,7 +48,7 @@ namespace Isobar {
static Script* create ( const std::string& name="" ); static Script* create ( const std::string& name="" );
void destroy (); void destroy ();
inline std::string getUserModuleName () const; inline std::string getUserModuleName () const;
inline const char* getFileName () const; inline std::string getFileName () const;
inline PyObject* getSysModule (); inline PyObject* getSysModule ();
inline PyObject* getHurricaneModule (); inline PyObject* getHurricaneModule ();
inline PyObject* getUserModule (); inline PyObject* getUserModule ();
@ -93,8 +93,14 @@ namespace Isobar {
inline PyObject* Script::getHurricaneModule () { return _hurricaneModule; } inline PyObject* Script::getHurricaneModule () { return _hurricaneModule; }
inline PyObject* Script::getUserModule () { return _userModule; } inline PyObject* Script::getUserModule () { return _userModule; }
inline const char* Script::getFileName () const inline std::string Script::getFileName () const
{ return (_userModule) ? PyModule_GetFilename(_userModule) : getUserModuleName().c_str(); } {
if (not _userModule) return getUserModuleName();
PyObject* pyBytes = PyUnicode_AsASCIIString( PyModule_GetFilenameObject(_userModule) );
std::string fileName = PyBytes_AsString( pyBytes );
Py_DECREF( pyBytes );
return fileName;
}
inline PyObject* Script::_importHurricane ( unsigned int flags ) inline PyObject* Script::_importHurricane ( unsigned int flags )
{ return _hurricaneModule = _importModule("Hurricane",flags); } { return _hurricaneModule = _importModule("Hurricane",flags); }