From d465d7279eb1ec8e3faf7c5e57fa18891b20ab48 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Wed, 20 Mar 2013 21:44:17 -0700 Subject: [PATCH] Fixed glsl-optimizer and fcpp warnings. --- 3rdparty/fcpp/cpp1.c | 2 +- 3rdparty/fcpp/cpp4.c | 4 ++-- 3rdparty/fcpp/cpp6.c | 10 +++++----- 3rdparty/fcpp/cppadd.h | 2 +- .../glsl-optimizer/src/glsl/glcpp/glcpp-parse.c | 6 +++--- .../glsl-optimizer/src/glsl/glcpp/glcpp-parse.y | 6 +++--- 3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.h | 2 +- premake/shaderc.lua | 15 +++++++++------ 8 files changed, 25 insertions(+), 22 deletions(-) diff --git a/3rdparty/fcpp/cpp1.c b/3rdparty/fcpp/cpp1.c index 5c8fd813..ecb79c00 100644 --- a/3rdparty/fcpp/cpp1.c +++ b/3rdparty/fcpp/cpp1.c @@ -40,7 +40,7 @@ INLINE FILE_LOCAL ReturnCode cppmain(struct Global *); int fppPreProcess(struct fppTag *tags) { - int i=0; + size_t i=0; ReturnCode ret; /* cpp return code */ struct Global *global; diff --git a/3rdparty/fcpp/cpp4.c b/3rdparty/fcpp/cpp4.c index 2c64af21..2b20495f 100644 --- a/3rdparty/fcpp/cpp4.c +++ b/3rdparty/fcpp/cpp4.c @@ -314,7 +314,7 @@ ReturnCode textput(struct Global *global, char *text) * Put the string in the parm[] buffer. */ - int size; + size_t size; size = strlen(text) + 1; if ((global->parmp + size) >= &global->parm[NPARMWORK]) { @@ -559,7 +559,7 @@ ReturnCode expstuff(struct Global *global, int c; /* Current character */ char *inp; /* -> repl string */ char *defp; /* -> macro output buff */ - int size; /* Actual parm. size */ + size_t size; /* Actual parm. size */ char *defend; /* -> output buff end */ int string_magic; /* String formal hack */ FILEINFO *file; /* Funny #include */ diff --git a/3rdparty/fcpp/cpp6.c b/3rdparty/fcpp/cpp6.c index b6f59abc..40acf354 100644 --- a/3rdparty/fcpp/cpp6.c +++ b/3rdparty/fcpp/cpp6.c @@ -488,7 +488,7 @@ char *savestring(struct Global *global, char *text) } ReturnCode getfile(struct Global *global, - int bufsize, /* Line or define buffer size */ + size_t bufsize, /* Line or define buffer size */ char *name, FILEINFO **file) /* File or macro name string */ { @@ -496,7 +496,7 @@ ReturnCode getfile(struct Global *global, * Common FILEINFO buffer initialization for a new file or macro. */ - int size; + size_t size; size = strlen(name); /* File/macro name */ @@ -583,12 +583,12 @@ DEFBUF *defendel(struct Global *global, char *np; int nhash; int temp; - int size; + size_t size; for (nhash = 0, np = name; *np != EOS;) nhash += *np++; size = (np - name); - nhash += size; + nhash += (int)size; prevp = &global->symtab[nhash % SBSIZE]; while ((dp = *prevp) != (DEFBUF *) NULL) { if (dp->hash == nhash @@ -606,7 +606,7 @@ DEFBUF *defendel(struct Global *global, prevp = &dp->link; } if (!delete) { - dp = (DEFBUF *) malloc((int) (sizeof (DEFBUF) + size)); + dp = (DEFBUF *) malloc(sizeof (DEFBUF) + size); dp->link = *prevp; *prevp = dp; dp->hash = nhash; diff --git a/3rdparty/fcpp/cppadd.h b/3rdparty/fcpp/cppadd.h index b65db92e..8494ac64 100644 --- a/3rdparty/fcpp/cppadd.h +++ b/3rdparty/fcpp/cppadd.h @@ -398,7 +398,7 @@ void dumpstack(OPTAB[NEXP], register OPTAB *, int [NEXP], register int *); void skipnl(struct Global *); int skipws(struct Global *); ReturnCode macroid(struct Global *, int *); -ReturnCode getfile(struct Global *, int, char *, FILEINFO **); +ReturnCode getfile(struct Global *, size_t, char *, FILEINFO **); DEFBUF *lookid(struct Global *, int ); DEFBUF *defendel(struct Global *, char *, int); #if DEBUG diff --git a/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c b/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c index 1bd070aa..6eab14be 100644 --- a/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c +++ b/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.c @@ -2146,11 +2146,11 @@ yyreduce: #line 361 "src/glsl/glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { - (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); + (yyval.ival) = (int)strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); } else if ((yyvsp[(1) - (1)].str)[0] == '0') { - (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 8); + (yyval.ival) = (int)strtoll ((yyvsp[(1) - (1)].str), NULL, 8); } else { - (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 10); + (yyval.ival) = (int)strtoll ((yyvsp[(1) - (1)].str), NULL, 10); } } break; diff --git a/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.y b/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.y index fb9bc588..7300d29e 100644 --- a/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.y +++ b/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-parse.y @@ -360,11 +360,11 @@ control_line: integer_constant: INTEGER_STRING { if (strlen ($1) >= 3 && strncmp ($1, "0x", 2) == 0) { - $$ = strtoll ($1 + 2, NULL, 16); + $$ = (int)strtoll ($1 + 2, NULL, 16); } else if ($1[0] == '0') { - $$ = strtoll ($1, NULL, 8); + $$ = (int)strtoll ($1, NULL, 8); } else { - $$ = strtoll ($1, NULL, 10); + $$ = (int)strtoll ($1, NULL, 10); } } | INTEGER { diff --git a/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.h b/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.h index b696b437..cc6dd2cd 100644 --- a/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.h +++ b/3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp.h @@ -50,7 +50,7 @@ typedef struct token_list token_list_t; typedef union YYSTYPE { - int64_t ival; + int ival; char *str; string_list_t *string_list; token_t *token; diff --git a/premake/shaderc.lua b/premake/shaderc.lua index 9e6ea12b..4f09837b 100644 --- a/premake/shaderc.lua +++ b/premake/shaderc.lua @@ -10,6 +10,14 @@ project "shaderc" GLSL_OPTIMIZER .. "src/glsl/msvc", } + defines { -- glsl-optimizer + "__STDC__", + "__STDC_VERSION__=199901L", + "strdup=_strdup", + "alloca=_alloca", + "isascii=__isascii", + } + buildoptions { "/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. } @@ -32,14 +40,10 @@ project "shaderc" configuration {} - defines { - -- fcpp + defines { -- fcpp "NINCLUDE=64", "NWORK=65536", "NBUFF=65536", - - -- glsl-optimizer - "__STDC_VERSION__=199901L", } includedirs { @@ -82,4 +86,3 @@ project "shaderc" GLSL_OPTIMIZER .. "src/glsl/main.cpp", GLSL_OPTIMIZER .. "src/glsl/builtin_stubs.cpp", } -