diff options
author | Tom Lane | 2016-03-24 00:22:08 +0000 |
---|---|---|
committer | Tom Lane | 2016-03-24 00:22:08 +0000 |
commit | 2c6af4f44228d76d3351fe26f68b00b55cdd239a (patch) | |
tree | 6a5ce32658ba9ad51ea05d6f46ef0aaf44b1f244 /src/interfaces/ecpg/preproc/keywords.c | |
parent | 3df9c374e279db37b00cd9c86219471d0cdaa97c (diff) |
Move keywords.c/kwlookup.c into src/common/.
Now that we have src/common/ for code shared between frontend and backend,
we can get rid of (most of) the klugy ways that the keyword table and
keyword lookup code were formerly shared between different uses.
This is a first step towards a more general plan of getting rid of
special-purpose kluges for sharing code in src/bin/.
I chose to merge kwlookup.c back into keywords.c, as it once was, and
always has been so far as keywords.h is concerned. We could have
kept them separate, but there is noplace that uses ScanKeywordLookup
without also wanting access to the backend's keyword list, so there
seems little point.
ecpg is still a bit weird, but at least now the trickiness is documented.
I think that the MSVC build script should require no adjustments beyond
what's done here ... but we'll soon find out.
Diffstat (limited to 'src/interfaces/ecpg/preproc/keywords.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/keywords.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c index 2f17f0c5c02..cffdaed67b0 100644 --- a/src/interfaces/ecpg/preproc/keywords.c +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -15,13 +15,23 @@ */ #include "postgres_fe.h" -#include "parser/keywords.h" -#include "type.h" +/* + * This is much trickier than it looks. We are #include'ing kwlist.h + * but the "value" numbers that go into the table are from preproc.h + * not the backend's gram.h. Therefore this table will recognize all + * keywords known to the backend, but will supply the token numbers used + * by ecpg's grammar, which is what we need. The ecpg grammar must + * define all the same token names the backend does, else we'll get + * undefined-symbol failures in this compile. + */ + +#include "common/keywords.h" + #include "extern.h" #include "preproc.h" -#define PG_KEYWORD(a,b,c) {a,b,c}, +#define PG_KEYWORD(a,b,c) {a,b,c}, const ScanKeyword SQLScanKeywords[] = { #include "parser/kwlist.h" |