- Notifications
You must be signed in to change notification settings - Fork28
Commit2719905
committed
Convert psql's flex lexer to be re-entrant, and make it compile standalone.
Change psqlscan.l to specify '%option reentrant', adjust internal APIsto match, and get rid of its internal static variables. While this isgood cleanup in an abstract sense, the reason to do it right now is thatit seems the only practical way to support use of separate flex lexerswith common PsqlScanState infrastructure. If we build two non-reentrantlexers then we are going to have problems with dangling buffer pointersin whichever lexer isn't active when we transition from one buffer toanother, as well as curious side-effects if we try to share any codebetween the files. (Horiguchi-san had a different solution to that in hispending patch, but I find it ugly and probably broken for corner cases.)Depending on which version of flex you're using, this may result in gettinga "warning: unused variable 'yyg'" warning from psqlscan, similar to theone you'd have seen for a long time in backend/parser/scan.l. I put alocal -Wno-error into CFLAGS for the file, for the convenience of thosewho compile with -Werror.Also, stop compiling psqlscan as part of mainloop.c, and make it astandalone build target instead. This is a lot cleaner than before, thoughit doesn't really change much in practice as of this commit. (I'm not surewhether the MSVC build scripts will need some help with this part, but thebuildfarm will soon tell us.)1 parentb555ed8 commit2719905
3 files changed
+176
-118
lines changedLines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 |
| - | |
| 26 | + | |
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 |
| - | |
48 |
| - | |
49 |
| - | |
50 | 47 |
| |
51 | 48 |
| |
52 | 49 |
| |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
53 | 55 |
| |
54 | 56 |
| |
55 | 57 |
| |
|
Lines changed: 0 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
458 | 458 |
| |
459 | 459 |
| |
460 | 460 |
| |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - |
0 commit comments
Comments
(0)