From 09004b3a75d746317c1379d2e0482cdb82052576 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 27 Jul 2016 11:04:14 +0200 Subject: [PATCH] More explicit error messages in Plug::setNet() to help diagnosis. --- hurricane/src/hurricane/Plug.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/hurricane/src/hurricane/Plug.cpp b/hurricane/src/hurricane/Plug.cpp index 5bff9ef1..0fd061e5 100644 --- a/hurricane/src/hurricane/Plug.cpp +++ b/hurricane/src/hurricane/Plug.cpp @@ -134,20 +134,26 @@ PlugFilter Plug::getIsUnconnectedFilter() void Plug::setNet(Net* net) // ************************ { - if (net != getNet()) { + if (net != getNet()) { + if (net and (getCell() != net->getCell())) + throw Error( "Plug::setNet(): Can't set Net of plug %s to %s\n" + "Net belong to %s instead of %s." + , getString(this).c_str() + , getString(net).c_str() + , getString(net->getCell()).c_str() + , getString(getCell()).c_str() + ); - if (net && (getCell() != net->getCell())) - throw Error("Can't change net of plug: " + getString(net) + " does not belong to " + getString(getCell())); + if (not getBodyHook()->getSlaveHooks().isEmpty()) + throw Error( "Plug::setNet(): Can't change net of %s: Component(s) are still attached upon it." + , getString(this).c_str() + ); - if (!getBodyHook()->getSlaveHooks().isEmpty()) - throw Error("Can't change net of plug: not empty slave hooks"); + if (not net) + cdebug_log(18,0) << "Plug::setNet(): About to disconnect " << this << endl; - if (net == NULL) { - cerr << "About to disconnect " << this << endl; - } - - _setNet(net); - } + _setNet( net ); + } } Plug* Plug::_create(Instance* instance, Net* masterNet)