Fixed glsl-optimizer and fcpp warnings.

This commit is contained in:
bkaradzic 2013-03-20 21:44:17 -07:00
parent f3c22c5b9d
commit d465d7279e
8 changed files with 25 additions and 22 deletions

View file

@ -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;

View file

@ -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 */

10
3rdparty/fcpp/cpp6.c vendored
View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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 {

View file

@ -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;

View file

@ -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",
}