mirror of
https://github.com/The-OpenROAD-Project/TritonRoute.git
synced 2026-05-30 00:06:29 +08:00
turn on compiler many warnings and fix warnings
This commit is contained in:
@@ -202,3 +202,11 @@ target_link_libraries( TritonRoute
|
||||
install(FILES ${FLEXROUTE_HEADER} DESTINATION include)
|
||||
install(TARGETS TritonRoute DESTINATION bin)
|
||||
install(TARGETS TritonRoute DESTINATION lib)
|
||||
|
||||
# Todo: add -Wextra and cleanup warnings
|
||||
target_compile_options( TritonRoute
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -pedantic -Wcast-qual -Wredundant-decls -Wformat-security>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-Wall -pedantic -Wcast-qual -Wredundant-decls -Wformat-security>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wall -pedantic -Wcast-qual -Wredundant-decls -Wformat-security>
|
||||
)
|
||||
|
||||
@@ -358,7 +358,7 @@ void defiAssertion::addNet(const char* name) {
|
||||
if (name[i-2] == ',') {
|
||||
s = (char*)malloc(i-1);
|
||||
s1 = (char*)malloc(i-1);
|
||||
strncpy(s1, name, i-2);
|
||||
memcpy(s1, name, i-2);
|
||||
s1[i-2] = '\0';
|
||||
strcpy(s, defData->DEFCASE(s1));
|
||||
free(s1);
|
||||
|
||||
@@ -83,10 +83,10 @@ namespace fr {
|
||||
const std::vector<std::unique_ptr<frGuide> >& getGuides() const {
|
||||
return guides;
|
||||
}
|
||||
const bool isModified() const {
|
||||
bool isModified() const {
|
||||
return modified;
|
||||
}
|
||||
const bool isFake() const {
|
||||
bool isFake() const {
|
||||
return isFakeNet;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ namespace fr {
|
||||
public:
|
||||
// constructors
|
||||
frTrackPattern() = default;
|
||||
frTrackPattern(const frTrackPattern& tmpTrackPattern) :
|
||||
frTrackPattern(const frTrackPattern& tmpTrackPattern) :
|
||||
frBlockObject(tmpTrackPattern),
|
||||
horizontal(tmpTrackPattern.horizontal), startCoord(tmpTrackPattern.startCoord),
|
||||
numTracks(tmpTrackPattern.numTracks), trackSpacing(tmpTrackPattern.trackSpacing), layerNum(tmpTrackPattern.layerNum) {}
|
||||
frTrackPattern(bool tmpIsH, frCoord tmpSC, frUInt4 tmpNT, frUInt4 tmpTS, frLayerNum tmpLN) :
|
||||
|
||||
@@ -1304,8 +1304,8 @@ void FlexDRWorker::initNet_termGenAp_new(drPin* dPin) {
|
||||
void FlexDRWorker::getTrackLocs(bool isHorzTracks, frLayerNum currLayerNum, frCoord low, frCoord high, std::set<frCoord> &trackLocs) {
|
||||
frPrefRoutingDirEnum currPrefRouteDir = getTech()->getLayer(currLayerNum)->getDir();
|
||||
for (auto &tp: design->getTopBlock()->getTrackPatterns(currLayerNum)) {
|
||||
if (tp->isHorizontal() && currPrefRouteDir == frcVertPrefRoutingDir ||
|
||||
!tp->isHorizontal() && currPrefRouteDir == frcHorzPrefRoutingDir) {
|
||||
if ((tp->isHorizontal() && currPrefRouteDir == frcVertPrefRoutingDir) ||
|
||||
(!tp->isHorizontal() && currPrefRouteDir == frcHorzPrefRoutingDir)) {
|
||||
int trackNum = (low - tp->getStartCoord()) / (int)tp->getTrackSpacing();
|
||||
if (trackNum < 0) {
|
||||
trackNum = 0;
|
||||
|
||||
@@ -368,8 +368,8 @@ void FlexGridGraph::initTracks(map<frCoord, map<frLayerNum, frTrackPattern* > >
|
||||
for (auto &tp: getDesign()->getTopBlock()->getTrackPatterns(currLayerNum)) {
|
||||
// allow wrongway if global varialble and design rule allow
|
||||
bool flag = (USENONPREFTRACKS) ?
|
||||
(tp->isHorizontal() && currPrefRouteDir == frcVertPrefRoutingDir ||
|
||||
!tp->isHorizontal() && currPrefRouteDir == frcHorzPrefRoutingDir) :
|
||||
(tp->isHorizontal() && currPrefRouteDir == frcVertPrefRoutingDir) ||
|
||||
(!tp->isHorizontal() && currPrefRouteDir == frcHorzPrefRoutingDir) :
|
||||
true;
|
||||
if (flag) {
|
||||
int trackNum = ((tp->isHorizontal() ? bbox.left() : bbox.bottom()) - tp->getStartCoord()) / (int)tp->getTrackSpacing();
|
||||
|
||||
@@ -113,18 +113,18 @@ int endfunc(defrCallbackType_e c, void*, defiUserData ud) {
|
||||
}
|
||||
|
||||
|
||||
char* orientStr(int orient) {
|
||||
const char* orientStr(int orient) {
|
||||
switch (orient) {
|
||||
case 0: return ((char*)"N");
|
||||
case 1: return ((char*)"W");
|
||||
case 2: return ((char*)"S");
|
||||
case 3: return ((char*)"E");
|
||||
case 4: return ((char*)"FN");
|
||||
case 5: return ((char*)"FW");
|
||||
case 6: return ((char*)"FS");
|
||||
case 7: return ((char*)"FE");
|
||||
case 0: return ("N");
|
||||
case 1: return ("W");
|
||||
case 2: return ("S");
|
||||
case 3: return ("E");
|
||||
case 4: return ("FN");
|
||||
case 5: return ("FW");
|
||||
case 6: return ("FS");
|
||||
case 7: return ("FE");
|
||||
};
|
||||
return ((char*)"BOGUS");
|
||||
return "BOGUS";
|
||||
}
|
||||
|
||||
int compMSL(defrCallbackType_e c, defiComponentMaskShiftLayer* co, defiUserData ud) {
|
||||
@@ -1639,37 +1639,33 @@ int dname(defrCallbackType_e c, const char* string, defiUserData data) {
|
||||
}
|
||||
|
||||
|
||||
char* address(const char* in) {
|
||||
return ((char*)in);
|
||||
}
|
||||
|
||||
int cs(defrCallbackType_e c, int num, defiUserData ud) {
|
||||
char* name;
|
||||
const char* name;
|
||||
|
||||
checkType(c);
|
||||
|
||||
if (ud != userData) dataError();
|
||||
|
||||
switch (c) {
|
||||
case defrComponentStartCbkType : name = address("COMPONENTS"); break;
|
||||
case defrNetStartCbkType : name = address("NETS"); break;
|
||||
case defrStartPinsCbkType : name = address("PINS"); break;
|
||||
case defrViaStartCbkType : name = address("VIAS"); break;
|
||||
case defrRegionStartCbkType : name = address("REGIONS"); break;
|
||||
case defrSNetStartCbkType : name = address("SPECIALNETS"); break;
|
||||
case defrGroupsStartCbkType : name = address("GROUPS"); break;
|
||||
case defrScanchainsStartCbkType : name = address("SCANCHAINS"); break;
|
||||
case defrIOTimingsStartCbkType : name = address("IOTIMINGS"); break;
|
||||
case defrFPCStartCbkType : name = address("FLOORPLANCONSTRAINTS"); break;
|
||||
case defrTimingDisablesStartCbkType : name = address("TIMING DISABLES"); break;
|
||||
case defrPartitionsStartCbkType : name = address("PARTITIONS"); break;
|
||||
case defrPinPropStartCbkType : name = address("PINPROPERTIES"); break;
|
||||
case defrBlockageStartCbkType : name = address("BLOCKAGES"); break;
|
||||
case defrSlotStartCbkType : name = address("SLOTS"); break;
|
||||
case defrFillStartCbkType : name = address("FILLS"); break;
|
||||
case defrNonDefaultStartCbkType : name = address("NONDEFAULTRULES"); break;
|
||||
case defrStylesStartCbkType : name = address("STYLES"); break;
|
||||
default : name = address("BOGUS"); return 1;
|
||||
case defrComponentStartCbkType : name = "COMPONENTS"; break;
|
||||
case defrNetStartCbkType : name = "NETS"; break;
|
||||
case defrStartPinsCbkType : name = "PINS"; break;
|
||||
case defrViaStartCbkType : name = "VIAS"; break;
|
||||
case defrRegionStartCbkType : name = "REGIONS"; break;
|
||||
case defrSNetStartCbkType : name = "SPECIALNETS"; break;
|
||||
case defrGroupsStartCbkType : name = "GROUPS"; break;
|
||||
case defrScanchainsStartCbkType : name = "SCANCHAINS"; break;
|
||||
case defrIOTimingsStartCbkType : name = "IOTIMINGS"; break;
|
||||
case defrFPCStartCbkType : name = "FLOORPLANCONSTRAINTS"; break;
|
||||
case defrTimingDisablesStartCbkType : name = "TIMING DISABLES"; break;
|
||||
case defrPartitionsStartCbkType : name = "PARTITIONS"; break;
|
||||
case defrPinPropStartCbkType : name = "PINPROPERTIES"; break;
|
||||
case defrBlockageStartCbkType : name = "BLOCKAGES"; break;
|
||||
case defrSlotStartCbkType : name = "SLOTS"; break;
|
||||
case defrFillStartCbkType : name = "FILLS"; break;
|
||||
case defrNonDefaultStartCbkType : name = "NONDEFAULTRULES"; break;
|
||||
case defrStylesStartCbkType : name = "STYLES"; break;
|
||||
default : name = "BOGUS"; return 1;
|
||||
}
|
||||
fprintf(fout, "\n%s %d ;\n", name, num);
|
||||
numObjs = num;
|
||||
@@ -2935,22 +2931,22 @@ int dn(defrCallbackType_e c, const char* h, defiUserData ud) {
|
||||
|
||||
|
||||
int ext(defrCallbackType_e t, const char* c, defiUserData ud) {
|
||||
char* name;
|
||||
const char* name;
|
||||
|
||||
checkType(t);
|
||||
if (ud != userData) dataError();
|
||||
|
||||
switch (t) {
|
||||
case defrNetExtCbkType : name = address("net"); break;
|
||||
case defrComponentExtCbkType : name = address("component"); break;
|
||||
case defrPinExtCbkType : name = address("pin"); break;
|
||||
case defrViaExtCbkType : name = address("via"); break;
|
||||
case defrNetConnectionExtCbkType : name = address("net connection"); break;
|
||||
case defrGroupExtCbkType : name = address("group"); break;
|
||||
case defrScanChainExtCbkType : name = address("scanchain"); break;
|
||||
case defrIoTimingsExtCbkType : name = address("io timing"); break;
|
||||
case defrPartitionsExtCbkType : name = address("partition"); break;
|
||||
default: name = address("BOGUS"); return 1;
|
||||
case defrNetExtCbkType : name = "net"; break;
|
||||
case defrComponentExtCbkType : name = "component"; break;
|
||||
case defrPinExtCbkType : name = "pin"; break;
|
||||
case defrViaExtCbkType : name = "via"; break;
|
||||
case defrNetConnectionExtCbkType : name = "net connection"; break;
|
||||
case defrGroupExtCbkType : name = "group"; break;
|
||||
case defrScanChainExtCbkType : name = "scanchain"; break;
|
||||
case defrIoTimingsExtCbkType : name = "io timing"; break;
|
||||
case defrPartitionsExtCbkType : name = "partition"; break;
|
||||
default: name = "BOGUS"; return 1;
|
||||
}
|
||||
fprintf(fout, " %s extension %s\n", name, c);
|
||||
return 0;
|
||||
|
||||
@@ -2348,7 +2348,6 @@ int io::Parser::getLef58CutSpacing_adjacentCuts(void *data, frLayer* tmpLayer, c
|
||||
frCoord twoCutsSpacing = -1;
|
||||
bool isSameCut = false;
|
||||
// within
|
||||
frCoord cutWithin1 = -1;
|
||||
frCoord cutWithin2 = -1;
|
||||
|
||||
bool isExceptSamePGNet;
|
||||
@@ -2445,7 +2444,6 @@ int io::Parser::getLef58CutSpacing_adjacentCuts(void *data, frLayer* tmpLayer, c
|
||||
} else if (word == string("WITHIN")) {
|
||||
streampos pos = istr.tellg();
|
||||
double tmp1;
|
||||
double tmp2;
|
||||
if (istr >> tmp1) {
|
||||
pos = istr.tellg();
|
||||
} else {
|
||||
|
||||
@@ -435,8 +435,9 @@ void FlexRP::prep_via2viaForbiddenLen_lef58CutSpc(const frLayerNum &lNum,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((viaDef1->getLayer1Num() == lNum) && (viaDef2->getLayer2Num() == lNum) ||
|
||||
(viaDef1->getLayer2Num() == lNum) && (viaDef2->getLayer1Num() == lNum))) {
|
||||
const bool match12 = (viaDef1->getLayer1Num() == lNum) && (viaDef2->getLayer2Num() == lNum);
|
||||
const bool match21 = (viaDef1->getLayer2Num() == lNum) && (viaDef2->getLayer1Num() == lNum);
|
||||
if (!match12 && !match21) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -545,8 +546,9 @@ void FlexRP::prep_via2viaForbiddenLen_minStep(const frLayerNum &lNum,
|
||||
if (lNum != 10 || !isCurrDirY) {
|
||||
return;
|
||||
}
|
||||
if (!((viaDef1->getLayer1Num() == lNum) && (viaDef2->getLayer2Num() == lNum) ||
|
||||
(viaDef1->getLayer2Num() == lNum) && (viaDef2->getLayer1Num() == lNum))) {
|
||||
const bool match12 = (viaDef1->getLayer1Num() == lNum) && (viaDef2->getLayer2Num() == lNum);
|
||||
const bool match21 = (viaDef1->getLayer2Num() == lNum) && (viaDef2->getLayer1Num() == lNum);
|
||||
if (!match12 && !match21) {
|
||||
return;
|
||||
}
|
||||
frBox enclosureBox1, enclosureBox2;
|
||||
|
||||
Reference in New Issue
Block a user