dirty fix for flex problem

master
Boris Glavic 2019-12-01 17:34:00 -06:00
parent ff5d7728e6
commit d713192ca8
6 changed files with 69 additions and 60 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.o
*.so
*.a
*.so.*

View File

@ -53,6 +53,8 @@ endif
$(srcdir)/pgc.c: pgc.l
ifdef FLEX
$(FLEX) $(FLEXFLAGS) -o'$@' $<
sed -i 's/int yylineno/yy_size_t yylineno/g' pgc.c
sed -i 's/int yyleng/yy_size_t yyleng/g' pgc.c
else
@$(missing) flex $< $@
endif

View File

@ -38,7 +38,10 @@ extern char *yytext,
#ifdef YYDEBUG
extern int yydebug;
#endif
extern int yylineno,
#ifndef yy_size_t
typedef size_t yy_size_t;
#endif
extern yy_size_t yylineno,
yyleng;
extern FILE *yyin,
*yyout;

View File

@ -97,7 +97,7 @@ hashline_number(void)
{
char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename));
sprintf(line, "\n#line %d \"%s\"\n", yylineno, input_filename);
sprintf(line, "\n#line %lu \"%s\"\n", yylineno, input_filename);
return line;
}

View File

@ -1249,7 +1249,7 @@ parse_include(void)
{
if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
{
fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno);
fprintf(stderr, "Error: Path %s/%s is too long in line %lu, skipping.\n", ip->path, yytext, yylineno);
continue;
}
snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
@ -1265,7 +1265,7 @@ parse_include(void)
}
}
if (!yyin)
mmerror(NO_INCLUDE_FILE, ET_FATAL, "Cannot open include file %s in line %d\n", yytext, yylineno);
mmerror(NO_INCLUDE_FILE, ET_FATAL, "Cannot open include file %s in line %lu\n", yytext, yylineno);
input_filename = mm_strdup(inc_file);
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE ));

View File

@ -60,7 +60,7 @@ mmerror(int error_code, enum errortype type, char * error, ...)
{
va_list ap;
fprintf(stderr, "%s:%d: ", input_filename, yylineno);
fprintf(stderr, "%s:%lu: ", input_filename, yylineno);
switch(type)
{
@ -5739,7 +5739,7 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initialize
/* make sure varchar struct name is unique by adding linenumer of its definition */
vcn = (char *) mm_alloc(strlen($2) + sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(vcn, "%s_%d", $2, yylineno);
sprintf(vcn, "%s_%lu", $2, yylineno);
if (strcmp(dimension, "0") == 0)
$$ = cat_str(7, make2_str(make_str(" struct varchar_"), vcn), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } *"), mm_strdup($2), $4, $5);
else