diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-12-11 18:04:28 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-12-11 18:04:28 -0500 |
commit | 2bdee07abefee3e59db9f89da635d7ecf9716a7b (patch) | |
tree | 4720a7b7d768f9b34ec3d501a402e0a396197c5a /src/interfaces/ecpg/preproc/ecpg.c | |
parent | 73ae395d84198ff14792522c79471975936ee76a (diff) |
Use "%option prefix" to set API names in ecpg's lexer.
Back-patch commit 92fb64983 into the pre-9.6 branches.
Without this, ecpg fails to build with the latest version of flex.
It's not unreasonable that people would want to compile our old branches
with recent tools. Per report from Дилян Палаузов.
Discussion: https://postgr.es/m/d845c1af-e18d-6651-178f-9f08cdf37e10@aegee.org
Diffstat (limited to 'src/interfaces/ecpg/preproc/ecpg.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 55ae30c534c..25e7d121bd3 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -162,11 +162,11 @@ main(int argc, char *const argv[]) case 'o': output_filename = strdup(optarg); if (strcmp(output_filename, "-") == 0) - yyout = stdout; + base_yyout = stdout; else - yyout = fopen(output_filename, PG_BINARY_W); + base_yyout = fopen(output_filename, PG_BINARY_W); - if (yyout == NULL) + if (base_yyout == NULL) { fprintf(stderr, _("%s: could not open file \"%s\": %s\n"), progname, output_filename, strerror(errno)); @@ -229,7 +229,7 @@ main(int argc, char *const argv[]) break; case 'd': #ifdef YYDEBUG - yydebug = 1; + base_yydebug = 1; #else fprintf(stderr, _("%s: parser debug support (-d) not available\n"), progname); @@ -276,7 +276,7 @@ main(int argc, char *const argv[]) { input_filename = mm_alloc(strlen("stdin") + 1); strcpy(input_filename, "stdin"); - yyin = stdin; + base_yyin = stdin; } else { @@ -300,13 +300,13 @@ main(int argc, char *const argv[]) ptr2ext[4] = '\0'; } - yyin = fopen(input_filename, PG_BINARY_R); + base_yyin = fopen(input_filename, PG_BINARY_R); } if (out_option == 0) /* calculate the output name */ { if (strcmp(input_filename, "stdin") == 0) - yyout = stdout; + base_yyout = stdout; else { output_filename = strdup(input_filename); @@ -316,8 +316,8 @@ main(int argc, char *const argv[]) ptr2ext[1] = (header_mode == true) ? 'h' : 'c'; ptr2ext[2] = '\0'; - yyout = fopen(output_filename, PG_BINARY_W); - if (yyout == NULL) + base_yyout = fopen(output_filename, PG_BINARY_W); + if (base_yyout == NULL) { fprintf(stderr, _("%s: could not open file \"%s\": %s\n"), progname, output_filename, strerror(errno)); @@ -328,7 +328,7 @@ main(int argc, char *const argv[]) } } - if (yyin == NULL) + if (base_yyin == NULL) fprintf(stderr, _("%s: could not open file \"%s\": %s\n"), progname, argv[fnr], strerror(errno)); else @@ -423,23 +423,23 @@ main(int argc, char *const argv[]) /* we need several includes */ /* but not if we are in header mode */ if (regression_mode) - fprintf(yyout, "/* Processed by ecpg (regression mode) */\n"); + fprintf(base_yyout, "/* Processed by ecpg (regression mode) */\n"); else - fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL); + fprintf(base_yyout, "/* Processed by ecpg (%d.%d.%d) */\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL); if (header_mode == false) { - fprintf(yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n"); + fprintf(base_yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n"); /* add some compatibility headers */ if (INFORMIX_MODE) - fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n"); + fprintf(base_yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n"); - fprintf(yyout, "/* End of automatic include section */\n"); + fprintf(base_yyout, "/* End of automatic include section */\n"); } if (regression_mode) - fprintf(yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n"); + fprintf(base_yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n"); output_line_number(); @@ -454,10 +454,10 @@ main(int argc, char *const argv[]) if (!(ptr->opened)) mmerror(PARSE_ERROR, ET_WARNING, "cursor \"%s\" has been declared but not opened", ptr->name); - if (yyin != NULL && yyin != stdin) - fclose(yyin); - if (out_option == 0 && yyout != stdout) - fclose(yyout); + if (base_yyin != NULL && base_yyin != stdin) + fclose(base_yyin); + if (out_option == 0 && base_yyout != stdout) + fclose(base_yyout); /* * If there was an error, delete the output file. |