[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Actual parameter to yyerror()
From: |
?????? |
Subject: |
Actual parameter to yyerror() |
Date: |
Wed, 15 Feb 2023 11:45:19 +0800 |
```
$ bison --version
bison (GNU Bison) 3.8.2
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
In Bison 3.8.2, if a parse parameter is a pointer to an explicit size array and
the size is defined by macro, it seems that Bison will just use the macro as
actual parameter.
e.g. A file named "bug.y":
```
%code requires {
#define _M 1
int yyerror(char (*_p)[_M]);
}
%parse-param {char (*_p)[_M]}
%%
target: {} ;
%%
int yyerror(char (*_p)[_M]) { return 0; }
```
In the file generated by ```bison bug.y```, it shows that yyerror() was
incorrectly invoked:
```
$ bison bug.y -o /dev/stdout|grep -nw 'yyerror'
103:int yyerror(char (*_p)[_M]);
650: yyerror (_M, YY_("syntax error:
cannot back up")); \
1140: yyerror (_M, YY_("syntax error"));
1251: yyerror (_M, YY_("memory exhausted"));
1290:yyerror(char (*_p)[_M]) { return 0; }
```
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Actual parameter to yyerror(),
?????? <=