Skip to content

Commit 6fdd5d9

Browse files
committed
Drop warning-free support for Flex 2.5.35
This removes all the various workarounds for avoiding compiler warnings with Flex 2.5.35. Several recent patches have added additional warnings that would either need to be fixed along the lines of the existing workarounds, or we decide to no longer care about this, which we do here. Flex 2.5.35 is extremely outdated, and you can't even download it anymore from any of the Flex project sites, so it's nearly impossible to support. After this, using Flex 2.5.35 will still work, but the generated code will produce numerous compiler warnings. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/1a204ccd-7ae6-478c-a431-407b5c48ccc6@eisentraut.org
1 parent 630f9a4 commit 6fdd5d9

File tree

13 files changed

+3
-122
lines changed

13 files changed

+3
-122
lines changed

src/Makefile.global.in

-1
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ TAS = @TAS@
788788
%.c: %.l
789789
$(FLEX) $(if $(FLEX_NO_BACKUP),-b) $(FLEXFLAGS) -o'$@' $<
790790
@$(if $(FLEX_NO_BACKUP),if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup; see lex.backup." 1>&2; exit 1; fi)
791-
$(if $(FLEX_FIX_WARNING),$(PERL) $(top_srcdir)/src/tools/fix-old-flex-code.pl '$@')
792791

793792
%.c: %.y
794793
$(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))

src/backend/parser/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ gram.c: BISON_CHECK_CMD = $(PERL) $(srcdir)/check_keywords.pl $< $(top_srcdir)/s
5959

6060
scan.c: FLEXFLAGS = -CF -p -p
6161
scan.c: FLEX_NO_BACKUP=yes
62-
scan.c: FLEX_FIX_WARNING=yes
6362

6463

6564
# Force these dependencies to be known even without dependency info built:

src/backend/parser/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ parser_sources = files('parser.c')
3030
backend_scanner = custom_target('scan',
3131
input: 'scan.l',
3232
output: 'scan.c',
33-
command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-CF', '-p', '-p'],
33+
command: [flex_cmd, '--no-backup', '--', '-CF', '-p', '-p'],
3434
)
3535
generated_sources += backend_scanner
3636
parser_sources += backend_scanner

src/backend/parser/scan.l

-9
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,6 @@ static void addunicode(pg_wchar c, yyscan_t yyscanner);
130130
static void check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner);
131131
static void check_escape_warning(core_yyscan_t yyscanner);
132132

133-
/*
134-
* Work around a bug in flex 2.5.35: it emits a couple of functions that
135-
* it forgets to emit declarations for. Since we use -Wmissing-prototypes,
136-
* this would cause warnings. Providing our own declarations should be
137-
* harmless even when the bug gets fixed.
138-
*/
139-
extern int core_yyget_column(yyscan_t yyscanner);
140-
extern void core_yyset_column(int column_no, yyscan_t yyscanner);
141-
142133
%}
143134

144135
%option reentrant

src/bin/pgbench/exprscan.l

-9
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@ static const char *expr_command = NULL;
4444
/* indicates whether last yylex() call read a newline */
4545
static bool last_was_newline = false;
4646

47-
/*
48-
* Work around a bug in flex 2.5.35: it emits a couple of functions that
49-
* it forgets to emit declarations for. Since we use -Wmissing-prototypes,
50-
* this would cause warnings. Providing our own declarations should be
51-
* harmless even when the bug gets fixed.
52-
*/
53-
extern int expr_yyget_column(yyscan_t yyscanner);
54-
extern void expr_yyset_column(int column_no, yyscan_t yyscanner);
55-
5647
/* LCOV_EXCL_START */
5748

5849
%}

src/bin/psql/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
6060

6161
psqlscanslash.c: FLEXFLAGS = -Cfe -p -p
6262
psqlscanslash.c: FLEX_NO_BACKUP=yes
63-
psqlscanslash.c: FLEX_FIX_WARNING=yes
6463

6564
tab-complete.c: gen_tabcomplete.pl tab-complete.in.c
6665
$(PERL) $^ --outfile $@

src/bin/psql/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ psql_sources = files(
1919
psqlscanslash = custom_target('psqlscanslash',
2020
input: 'psqlscanslash.l',
2121
output: 'psqlscanslash.c',
22-
command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'])
22+
command: [flex_cmd, '--no-backup', '--', '-Cfe', '-p', '-p'])
2323
generated_sources += psqlscanslash
2424
psql_sources += psqlscanslash
2525

src/bin/psql/psqlscanslash.l

-9
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ static void evaluate_backtick(PsqlScanState state);
5757

5858
#define ECHO psqlscan_emit(cur_state, yytext, yyleng)
5959

60-
/*
61-
* Work around a bug in flex 2.5.35: it emits a couple of functions that
62-
* it forgets to emit declarations for. Since we use -Wmissing-prototypes,
63-
* this would cause warnings. Providing our own declarations should be
64-
* harmless even when the bug gets fixed.
65-
*/
66-
extern int slash_yyget_column(yyscan_t yyscanner);
67-
extern void slash_yyset_column(int column_no, yyscan_t yyscanner);
68-
6960
/* LCOV_EXCL_START */
7061

7162
%}

src/fe_utils/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ libpgfeutils.a: $(OBJS)
5151

5252
psqlscan.c: FLEXFLAGS = -Cfe -p -p
5353
psqlscan.c: FLEX_NO_BACKUP=yes
54-
psqlscan.c: FLEX_FIX_WARNING=yes
5554

5655
# libpgfeutils could be useful to contrib, so install it
5756
install: all installdirs

src/fe_utils/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fe_utils_sources = files(
2323
psqlscan = custom_target('psqlscan',
2424
input: 'psqlscan.l',
2525
output: 'psqlscan.c',
26-
command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'],
26+
command: [flex_cmd, '--no-backup', '--', '-Cfe', '-p', '-p'],
2727
)
2828
generated_sources += psqlscan
2929
fe_utils_sources += psqlscan

src/fe_utils/psqlscan.l

-9
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ typedef int YYSTYPE;
6161

6262
#define ECHO psqlscan_emit(cur_state, yytext, yyleng)
6363

64-
/*
65-
* Work around a bug in flex 2.5.35: it emits a couple of functions that
66-
* it forgets to emit declarations for. Since we use -Wmissing-prototypes,
67-
* this would cause warnings. Providing our own declarations should be
68-
* harmless even when the bug gets fixed.
69-
*/
70-
extern int psql_yyget_column(yyscan_t yyscanner);
71-
extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
72-
7364
%}
7465

7566
%option reentrant

src/tools/fix-old-flex-code.pl

-66
This file was deleted.

src/tools/pgflex

-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# Wrapper around flex that:
55
# - ensures lex.backup is created in a private directory
66
# - can error out if lex.backup is created (--no-backup)
7-
# - can fix warnings (--fix-warnings)
87
# - works around concurrency issues with win_flex.exe:
98
# https://github.com/lexxmark/winflexbison/issues/86
109

@@ -28,8 +27,6 @@ parser.add_argument('-o', dest='output_file', type=abspath, required=True,
2827
parser.add_argument('-i', dest='input_file', type=abspath, help='input file')
2928

3029

31-
parser.add_argument('--fix-warnings', action='store_true',
32-
help='whether to fix warnings in generated file')
3330
parser.add_argument('--no-backup', action='store_true',
3431
help='whether no_backup is enabled or not')
3532

@@ -72,14 +69,4 @@ if args.no_backup:
7269
sys.exit('Scanner requires backup; see lex.backup.')
7370
os.remove('lex.backup')
7471

75-
# fix warnings
76-
if args.fix_warnings:
77-
fix_warning_script = os.path.join(args.srcdir,
78-
'src/tools/fix-old-flex-code.pl')
79-
80-
command = [args.perl, fix_warning_script, args.output_file]
81-
sp = subprocess.run(command)
82-
if sp.returncode != 0:
83-
sys.exit(sp.returncode)
84-
8572
sys.exit(0)

0 commit comments

Comments
 (0)