Skip to content

Commit

Permalink
fix warning in thirdparty lef/def parsers and zlib dependency with ZL…
Browse files Browse the repository at this point in the history
…IB_DIR, ZLIB_INCLUDE_FLAG, ZLIB_LINK_FLAG
  • Loading branch information
limbo018 committed Feb 10, 2018
1 parent c3d4b45 commit 6dce8d4
Show file tree
Hide file tree
Showing 22 changed files with 84 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Makefile.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ CXXFLAGS_DEBUG = -g $(CXXFLAGS_BASIC)
CXXFLAGS_RELEASE = -O3 -fopenmp $(CXXFLAGS_BASIC)

CFLAGS_BASIC = -fmax-errors=1 -fPIC -W -Wall -Wextra -Wreturn-type -ansi -m64 -Wno-deprecated -Wno-unused-local-typedefs
CFLAGS_DEBUG = -g $(CXXFLAGS_BASIC)
CFLAGS_RELEASE = -O3 -fopenmp $(CXXFLAGS_BASIC)
CFLAGS_DEBUG = -g $(CFLAGS_BASIC)
CFLAGS_RELEASE = -O3 -fopenmp $(CFLAGS_BASIC)

ARFLAGS = rvs

2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Some components depend on external libraries, such as
* [Lemon](https://lemon.cs.elte.hu): require LEMON_DIR environment variable to the path where Lemon is installed.
* [Gurobi](www.gurobi.com): require GUROBI_HOME environment variable to the path where Gurobi is installed.
* [Flex](http://flex.sourceforge.net): require FLEX_DIR or LEX_INCLUDE_DIR environment variable if the flex version is not 2.5.37. See FAQ for details.
* [Zlib](http://www.zlib.net) (optional): require ZLIB_DIR environment variable to enable zlib features. If both zlib and boost are available, Gds parser supports reading/writing .gds.gz files. ZLIB_DIR should defined in a way that ZLIB_DIR/include contains the headers to include and ZLIB_DIR/lib contains the libraries to link.
* [Zlib](http://www.zlib.net) (optional): require ZLIB_DIR, or ZLIB_INCLUDE_FLAG and ZLIB_LINK_FLAG environment variables to enable zlib features. If both zlib and boost are available, Gds parser supports reading/writing .gds.gz files. If using ZLIB_DIR, ZLIB_DIR should defined in a way that ZLIB_DIR/include contains the headers to include and ZLIB_DIR/lib contains the libraries to link; otherwise, use ZLIB_INCLUDE_FLAG and ZLIB_LINK_FLAG

Users need to make sure they are properly installed and the corresponding settings are configured.

Expand Down
8 changes: 7 additions & 1 deletion limbo/makeutils/FindZlib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@
ZLIB_LINK_FLAG =

# use libz.a to test whether Zlib has static library
ifeq ($(ZLIB_LINK_FLAG),)
ifeq ($(wildcard $(ZLIB_DIR)/lib/libz.a),)
ZLIB_LINK_FLAG = -Wl,-rpath,$(ZLIB_DIR)/lib $(DYNAMIC_LINK_FLAG)
else
ZLIB_LINK_FLAG = $(STATIC_LINK_FLAG)
ZLIB_LINK_FLAG = -L $(ZLIB_DIR)/lib $(STATIC_LINK_FLAG)
endif
endif

ifeq ($(ZLIB_INCLUDE_FLAG),)
ZLIB_INCLUDE_FLAG = -I $(ZLIB_DIR)/include
endif

## @endcond
4 changes: 2 additions & 2 deletions limbo/parsers/gdsii/gdsdb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ endif
# boost iostreams is needed for compression
ifdef ZLIB_DIR
ifdef BOOST_DIR
INCLUDE += -I $(ZLIB_DIR)/include
INCLUDE += $(ZLIB_INCLUDE_FLAG)
LIB += -L $(BOOST_DIR)/lib -lboost_iostreams \
-L $(ZLIB_DIR)/lib -lz
$(ZLIB_LINK_FLAG) -lz
endif
endif

Expand Down
4 changes: 2 additions & 2 deletions limbo/parsers/gdsii/stream/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ INCLUDE = -I $(LIMBO_ROOT_DIR)

ifdef ZLIB_DIR
ifdef BOOST_DIR
INCLUDE += -I $(BOOST_DIR)/include -I $(ZLIB_DIR)/include
INCLUDE += -I $(BOOST_DIR)/include $(ZLIB_INCLUDE_FLAG)
LIB += -L $(BOOST_DIR)/lib -lboost_iostreams \
-L $(ZLIB_DIR)/lib -lz
$(ZLIB_LINK_FLAG) -lz
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion limbo/thirdparty/CThreadPool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else
CFLAGS = $(CFLAGS_RELEASE)
endif

CFLAGS += -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE=500
CFLAGS += -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE=500 -Wno-unused-parameter

#==========================================================================
# Special Library
Expand Down
14 changes: 12 additions & 2 deletions limbo/thirdparty/lefdef/5.8/def/def/def.y
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,12 @@ property_def: K_DESIGN {defData->dumb_mode = 1; defData->no_num = 1; defData->Pr
}
| error ';' { yyerrok; yyclearin;}

property_type_and_val: K_INTEGER { defData->real_num = 0 } opt_range opt_num_val
property_type_and_val: K_INTEGER { defData->real_num = 0; } opt_range opt_num_val
{
if (defData->callbacks->PropCbk) defData->Prop.setPropInteger();
defData->defPropDefType = 'I';
}
| K_REAL { defData->real_num = 1 } opt_range opt_num_val
| K_REAL { defData->real_num = 1; } opt_range opt_num_val
{
if (defData->callbacks->PropCbk) defData->Prop.setPropReal();
defData->defPropDefType = 'R';
Expand Down Expand Up @@ -3088,7 +3088,9 @@ snet_other_option: '+' net_type
{
// 11/12/2002 - this is obsolete in 5.5, & will be ignored
if (defData->VersionNum < 5.5)
{
if (defData->callbacks->SNetCbk) defData->Net.setCap($3);
}
else
defData->defWarning(7024, "The ESTCAP statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.");
}
Expand Down Expand Up @@ -3191,7 +3193,9 @@ snet_width: '+' K_WIDTH { defData->dumb_mode = 1; } T_STRING NUMBER
{
// 11/12/2002 - this is obsolete in 5.5, & will be ignored
if (defData->VersionNum < 5.5)
{
if (defData->callbacks->SNetCbk) defData->Net.setWidth($4, $5);
}
else
defData->defWarning(7026, "The WIDTH statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.");
}
Expand Down Expand Up @@ -3466,23 +3470,29 @@ group_soft_option: K_MAXX NUMBER
{
// 11/12/2002 - this is obsolete in 5.5, & will be ignored
if (defData->VersionNum < 5.5)
{
if (defData->callbacks->GroupCbk) defData->Group.setMaxX(ROUND($2));
}
else
defData->defWarning(7028, "The GROUP SOFT MAXX statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.");
}
| K_MAXY NUMBER
{
// 11/12/2002 - this is obsolete in 5.5, & will be ignored
if (defData->VersionNum < 5.5)
{
if (defData->callbacks->GroupCbk) defData->Group.setMaxY(ROUND($2));
}
else
defData->defWarning(7029, "The GROUP SOFT MAXY statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.");
}
| K_MAXHALFPERIMETER NUMBER
{
// 11/12/2002 - this is obsolete in 5.5, & will be ignored
if (defData->VersionNum < 5.5)
{
if (defData->callbacks->GroupCbk) defData->Group.setPerim(ROUND($2));
}
else
defData->defWarning(7030, "The GROUP SOFT MAXHALFPERIMETER statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.");
}
Expand Down
8 changes: 4 additions & 4 deletions limbo/thirdparty/lefdef/5.8/def/def/def_keywords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,10 @@ defrData::sublex(YYSTYPE *pYylval)

if (defGetKeyword(uc_token, &result)) {
if (K_HISTORY == result) { /* history - get up to ';' */
int n;
/*int n;*/
int c;
int prev;
n = 0;
/*n = 0;*/
prev = ' ';
while (1) {
c = GETC();
Expand All @@ -807,12 +807,12 @@ defrData::sublex(YYSTYPE *pYylval)
}
History_text.push_back('\0');
} else if (K_BEGINEXT == result) { /* extension, get up to end */
int nn;
/*int nn;*/
int cc;
int foundTag = 0;
int notEmpTag = 0;
int begQuote = 0;
nn = 0;
/*nn = 0;*/
/* First make sure there is a name after BEGINEXT within quote */
/* BEGINEXT "name" */
while (1) {
Expand Down
2 changes: 1 addition & 1 deletion limbo/thirdparty/lefdef/5.8/def/def/defrReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ defrInitSession(int startSession)
defContext.settings = new defrSettings();
}

if (defContext.session = NULL) {
if (defContext.session == NULL) {
defContext.session = new defrSession();
} else {
memset(defContext.settings->UnusedCallbacks, 0, CBMAX * sizeof(int));
Expand Down
3 changes: 2 additions & 1 deletion limbo/thirdparty/lefdef/5.8/def/def/defwWriterCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "defwWriter.hpp"
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "lex.h"
#include "defiDebug.hpp"

Expand Down Expand Up @@ -346,7 +347,7 @@ static int defwUnusedCount[100];

int defwCountFunc(defwCallbackType_e e, defiUserData d) {
int i = (int)e;
if (defiDebug(23)) printf("count %d 0x%x\n", (int)e, d);
if (defiDebug(23)) printf("count %d 0x%x\n", (int)e, (unsigned int)((intptr_t)d));
if (i >= 0 && i < 100) {
defwUnusedCount[i] += 1;
return 0;
Expand Down
28 changes: 14 additions & 14 deletions limbo/thirdparty/lefdef/5.8/def/defdiff/diffDefRW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ int compf(defrCallbackType_e c, defiComponent* co, defiUserData ud) {
// Net
int netf(defrCallbackType_e c, defiNet* net, defiUserData ud) {
// For net and special net.
int i, j, k, w, x, y, z, px, py, pz;
int i=0, j=0, k=0, w=0, x=0, y=0, z=0, px=0, py=0, pz=0;
defiPath* p;
defiSubnet* s;
int path;
defiVpin *vpin;
defiShield* noShield;
defiWire* wire;
int nline;
int nline = 0;
const char* layerName = "N/A";

checkType(c);
Expand Down Expand Up @@ -630,7 +630,7 @@ int snetf(defrCallbackType_e c, defiNet* net, defiUserData ud) {
int path;
defiShield* shield;
defiWire *wire;
int nline;
int nline = 0;
const char* sNLayerName = "N/A";
int numX, numY, stepX, stepY;

Expand Down Expand Up @@ -691,7 +691,7 @@ int snetf(defrCallbackType_e c, defiNet* net, defiUserData ud) {
}
}
if (net->polyMask(i)) {
fprintf(fout, "MASK %d POLYGON % s ",
fprintf(fout, "MASK %d POLYGON %s ",
net->polyMask(i),
net->polygonName(i));
} else {
Expand Down Expand Up @@ -1228,9 +1228,9 @@ int casesens(defrCallbackType_e c, int d, defiUserData ud) {
checkType(c);
if (ud != userData) dataError();
if (d == 1)
fprintf(fout, "NAMESCASESENSITIVE OFF\n", d);
fprintf(fout, "NAMESCASESENSITIVE OFF\n"/*, d*/);
else
fprintf(fout, "NAMESCASESENSITIVE ON\n", d);
fprintf(fout, "NAMESCASESENSITIVE ON\n"/*, d*/);
return 0;
}

Expand Down Expand Up @@ -1787,15 +1787,15 @@ int cls(defrCallbackType_e c, void* cl, defiUserData ud) {
fprintf(fout, "SCANCHAINS %s", sc->name());
if (sc->hasStart()) {
sc->start(&a1, &b1);
fprintf(fout, " START %s %s", sc->name(), a1, b1);
fprintf(fout, " START %s %s", /*sc->name(),*/ a1, b1);
}
if (sc->hasStop()) {
sc->stop(&a1, &b1);
fprintf(fout, " STOP %s %s", sc->name(), a1, b1);
fprintf(fout, " STOP %s %s", /*sc->name(),*/ a1, b1);
}
if (sc->hasCommonInPin() ||
sc->hasCommonOutPin()) {
fprintf(fout, " COMMONSCANPINS ", sc->name());
fprintf(fout, " COMMONSCANPINS "/*, sc->name()*/);
if (sc->hasCommonInPin())
fprintf(fout, " ( IN %s )", sc->commonInPin());
if (sc->hasCommonOutPin())
Expand Down Expand Up @@ -1910,14 +1910,14 @@ int cls(defrCallbackType_e c, void* cl, defiUserData ud) {
break;
case defrTimingDisableCbkType :
td = (defiTimingDisable*)cl;
if (td->hasFromTo()) fprintf(fout, "TIMINGDISABLE FROMPIN %s %s ", td->fromInst(), td->fromPin(), td->toInst(), td->toPin()); if (td->hasThru())
if (td->hasFromTo()) fprintf(fout, "TIMINGDISABLE FROMPIN %s %s %s %s ", td->fromInst(), td->fromPin(), td->toInst(), td->toPin()); if (td->hasThru())
fprintf(fout, " THRUPIN %s %s ", td->thruInst(), td->thruPin());
if (td->hasMacroFromTo())
fprintf(fout, " MACRO %s FROMPIN %s %s ", td->macroName(),
td->fromPin(), td->toPin());
if (td->hasMacroThru())
fprintf(fout, " MACRO %s THRUPIN %s %s ", td->macroName(),
td->fromPin());
td->fromPin(), td->toPin());
fprintf(fout, "\n");
break;
case defrPartitionCbkType :
Expand Down Expand Up @@ -2057,7 +2057,7 @@ int cls(defrCallbackType_e c, void* cl, defiUserData ud) {
slot->xh(i), slot->yh(i));
}
for (i = 0; i < slot->numPolygons(); i++) {
fprintf(fout, "SLOT LAYER %s POLYGON");
fprintf(fout, "SLOT LAYER %s POLYGON", slot->layerName());
points = slot->getPolygon(i);
for (j = 0; j < points.numPoints; j++)
fprintf(fout, " %d %d", points.x[j], points.y[j]);
Expand Down Expand Up @@ -2159,7 +2159,7 @@ int ext(defrCallbackType_e t, const char* c, defiUserData ud) {
int diffDefReadFile(char* inFile, char* outFile, char* ignorePinExtra,
char* ignoreRowName, char* ignoreViaName, char* netSegComp) {
FILE* f;
int res;
int res = 0;

userData = (void*)0x01020304;
defrInit();
Expand Down Expand Up @@ -2249,5 +2249,5 @@ int diffDefReadFile(char* inFile, char* outFile, char* ignorePinExtra,
fclose(f);
fclose(fout);

return 0;
return res;
}
19 changes: 10 additions & 9 deletions limbo/thirdparty/lefdef/5.8/def/defrw/defrw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ int snetf(defrCallbackType_e c, defiNet* net, defiUserData ud) {
}
}
if (net->polyMask(i)) {
fprintf(fout, "\n + MASK %d + POLYGON % s ", net->polyMask(i),
fprintf(fout, "\n + MASK %d + POLYGON %s ", net->polyMask(i),
net->polygonName(i));
} else {
fprintf(fout, "\n + POLYGON %s ", net->polygonName(i));
Expand Down Expand Up @@ -1792,9 +1792,9 @@ int casesens(defrCallbackType_e c, int d, defiUserData ud) {
checkType(c);
if (ud != userData) dataError();
if (d == 1)
fprintf(fout, "NAMESCASESENSITIVE ON ;\n", d);
fprintf(fout, "NAMESCASESENSITIVE ON ;\n"/*, d*/);
else
fprintf(fout, "NAMESCASESENSITIVE OFF ;\n", d);
fprintf(fout, "NAMESCASESENSITIVE OFF ;\n"/*, d*/);
return 0;
}

Expand Down Expand Up @@ -2535,9 +2535,9 @@ int cls(defrCallbackType_e c, void* cl, defiUserData ud) {
td = (defiTimingDisable*)cl;
if (td->hasFromTo())
fprintf(fout, "- FROMPIN %s %s ",
td->fromInst(),
/*td->fromInst(),*/
td->fromPin(),
td->toInst(),
/*td->toInst(),*/
td->toPin());
if (td->hasThru())
fprintf(fout, "- THRUPIN %s %s ",
Expand All @@ -2551,6 +2551,7 @@ int cls(defrCallbackType_e c, void* cl, defiUserData ud) {
if (td->hasMacroThru())
fprintf(fout, "- MACRO %s THRUPIN %s %s ",
td->macroName(),
td->fromInst(),
td->fromPin());
fprintf(fout, ";\n");
break;
Expand Down Expand Up @@ -2897,7 +2898,7 @@ int main(int argc, char** argv) {
char* inFile[6];
char* outFile;
FILE* f;
int res;
int res = 0;
int noCalls = 0;
// long start_mem;
int retStr = 0;
Expand Down Expand Up @@ -3192,7 +3193,7 @@ int main(int argc, char** argv) {
res = defrRead(f, inFile[fileCt], userData, 1);

if (res)
fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);
fprintf(stderr, "Reader returns bad status. '%s'\n", inFile[fileCt]);

(void)defrPrintUnusedCallbacks(fout);
(void)defrReleaseNResetMemory();
Expand Down Expand Up @@ -3231,7 +3232,7 @@ int main(int argc, char** argv) {
res = defrRead(f, inFile[fileCt], userData, 1);

if (res)
fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);
fprintf(stderr, "Reader returns bad status. '%s'\n", inFile[fileCt]);

(void)defrPrintUnusedCallbacks(fout);
(void)defrReleaseNResetMemory();
Expand All @@ -3253,7 +3254,7 @@ int main(int argc, char** argv) {
res = defrRead(f, inFile[fileCt], userData, 1);

if (res)
fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);
fprintf(stderr, "Reader returns bad status. '%s'\n", inFile[fileCt]);

// Testing the aliases API.
defrAddAlias ("alias1", "aliasValue1", 1);
Expand Down
2 changes: 1 addition & 1 deletion limbo/thirdparty/lefdef/5.8/def/template.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ LIMBO_ROOT_DIR = $(realpath ../../../../../..)
# include environmental configurations
include $(LIMBO_ROOT_DIR)/Include.mk

CXX_OPTIMIZE_FLAG += $(OPTIMIZE_FLAG) $(CXXFLAGS_BASIC)
CXX_OPTIMIZE_FLAG += $(OPTIMIZE_FLAG) $(CXXFLAGS_BASIC) -Wno-reorder -Wno-unused-variable -Wno-strict-aliasing
C_OPTIMIZE_FLAG += $(OPTIMIZE_FLAG) $(CFLAGS_BASIC)
BIN_LINK_FLAGS += $(CXX_OPTIMIZE_FLAG)

Expand Down
2 changes: 2 additions & 0 deletions limbo/thirdparty/lefdef/5.8/lef/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ OPTIMIZE_FLAG = -O
endif
endif

OPTIMIZE_FLAG += -Wno-reorder

install:
@$(MAKE) $(MFLAGS) installhdrs installlib installbin

Expand Down
Loading

0 comments on commit 6dce8d4

Please sign in to comment.