Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit656ee84

Browse files
committed
Fix portability issues in86c43f4.
INT64_MIN/MAX should be spelled PG_INT64_MIN/MAX, per well establishedconvention in our sources. Less obviously, a symbol named DOUBLE causesproblems on Windows builds, so rename that to DOUBLE_CONST; and renameINTEGER to INTEGER_CONST for consistency.Also, get rid of incorrect/obsolete hand-munging of yycolumn, and fixthe grammar for float constants to handle expected cases such as ".1".First two items by Michael Paquier, second two by me.
1 parent5d4171d commit656ee84

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

‎src/bin/pgbench/exprparse.y

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ static PgBenchExpr *make_func(yyscan_t yyscanner, int fnumber, PgBenchExprList *
4747

4848
%type<elist>elist
4949
%type<expr>expr
50-
%type<ival>INTEGERfunction
51-
%type<dval>DOUBLE
50+
%type<ival>INTEGER_CONSTfunction
51+
%type<dval>DOUBLE_CONST
5252
%type<str>VARIABLEFUNCTION
5353

54-
%tokenINTEGERDOUBLEVARIABLEFUNCTION
54+
%tokenINTEGER_CONSTDOUBLE_CONSTVARIABLEFUNCTION
5555

5656
/* Precedence: lowest to highest*/
5757
%left'+''-'
@@ -76,8 +76,8 @@ expr: '(' expr ')'{ $$ = $2; }
7676
|expr'*'expr{$$ = make_op(yyscanner,"*",$1,$3); }
7777
|expr'/'expr{$$ = make_op(yyscanner,"/",$1,$3); }
7878
|expr'%'expr{$$ = make_op(yyscanner,"%",$1,$3); }
79-
|INTEGER{$$ = make_integer_constant($1); }
80-
|DOUBLE{$$ = make_double_constant($1); }
79+
|INTEGER_CONST{$$ = make_integer_constant($1); }
80+
|DOUBLE_CONST{$$ = make_double_constant($1); }
8181
|VARIABLE {$$ = make_variable($1); }
8282
|function'('elist')' {$$ = make_func(yyscanner,$1,$3); }
8383
;

‎src/bin/pgbench/exprscan.l

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,15 @@ newline[\n]
123123
}
124124
{digit}+{
125125
yylval->ival =strtoint64(yytext);
126-
returnINTEGER;
126+
returnINTEGER_CONST;
127127
}
128128
{digit}+(\.{digit}*)?([eE][-+]?{digit}+)?{
129-
yycolumn += yyleng;
130129
yylval->dval =atof(yytext);
131-
return DOUBLE;
130+
return DOUBLE_CONST;
131+
}
132+
\.{digit}+([eE][-+]?{digit}+)?{
133+
yylval->dval =atof(yytext);
134+
return DOUBLE_CONST;
132135
}
133136
{alpha}{alnum}*{
134137
yylval->str =pg_strdup(yytext);

‎src/bin/pgbench/pgbench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ coerceToInt(PgBenchValue *pval, int64 *ival)
10431043
{
10441044
doubledval=pval->u.dval;
10451045
Assert(pval->type==PGBT_DOUBLE);
1046-
if (dval<INT64_MIN||INT64_MAX<dval)
1046+
if (dval<PG_INT64_MIN||PG_INT64_MAX<dval)
10471047
{
10481048
fprintf(stderr,"double to int overflow for %f\n",dval);
10491049
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp