Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5666462

Browse files
committed
Ensure that in all flex lexers that are part of the backend, a
yy_fatal_error() call results in elog(ERROR) not exit(). This was already fixed in the main lexer and plpgsql, but extend same technique to all the other dot-l files. Also, on review of the possible calls to yy_fatal_error(), it seems safe to use elog(ERROR) not elog(FATAL).
1 parent 4fb5b92 commit 5666462

File tree

7 files changed

+23
-8
lines changed

7 files changed

+23
-8
lines changed

contrib/cube/cubescan.l

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include "buffer.h"
99

10+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
11+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
12+
1013

1114
/* flex screws a couple symbols when used with the -P option; fix those */
1215
#define YY_DECL int cube_yylex YY_PROTO(( void )); \
@@ -52,6 +55,5 @@ float ({integer}|{real})([eE]{integer})?
5255
int cube_yylex();
5356

5457
void cube_flush_scanner_buffer(void) {
55-
fprintf(stderr, "cube_flush_scanner_buffer called\n");
5658
YY_FLUSH_BUFFER;
5759
}

contrib/seg/segscan.l

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include "buffer.h"
99

10+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
11+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
12+
1013

1114
/* flex screws a couple symbols when used with the -P option; fix those */
1215
#define YY_DECL int seg_yylex YY_PROTO(( void )); \

contrib/tsearch/parser.l

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include "deflex.h"
55
#include "parser.h"
66

7+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
8+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
9+
710
/* postgres allocation function */
811
#define free pfree
912
#define malloc palloc

src/backend/bootstrap/bootscanner.l

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.27 2002/11/04 14:22:32 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.28 2003/05/29 22:30:01 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -44,7 +44,11 @@
4444
/* #include "bootstrap_tokens.h" */
4545

4646

47-
int yyline; /* keep track of the line number for error reporting */
47+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
48+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
49+
50+
51+
static int yyline; /* keep track of the line number for error reporting */
4852

4953
%}
5054

src/backend/parser/scan.l

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.106 2003/05/29 20:40:36 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.107 2003/05/29 22:30:02 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -33,7 +33,7 @@
3333
#define YY_READ_BUF_SIZE 16777216
3434

3535
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
36-
#define fprintf(file, fmt, msg) ereport(FATAL, (errmsg_internal("%s", msg)))
36+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
3737

3838
extern YYSTYPE yylval;
3939

src/backend/utils/misc/guc-file.l

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright 2000 by PostgreSQL Global Development Group
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.15 2003/05/27 17:49:46 momjian Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.16 2003/05/29 22:30:02 tgl Exp $
88
*/
99

1010
%{
@@ -21,6 +21,9 @@
2121
#include "utils/elog.h"
2222
#include "utils/guc.h"
2323

24+
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
25+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
26+
2427
#define CONFIG_FILENAME "postgresql.conf"
2528

2629
static unsigned ConfigFileLineno;

src/pl/plpgsql/src/scan.l

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.25 2003/05/05 16:46:28 tgl Exp $
7+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.26 2003/05/29 22:30:02 tgl Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -43,7 +43,7 @@
4343
#define YY_READ_BUF_SIZE 16777216
4444

4545
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
46-
#define fprintf(file, fmt, msg) ereport(FATAL, (errmsg_internal("%s", msg)))
46+
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
4747

4848
/* Handles to the buffer that the lexer uses internally */
4949
static YY_BUFFER_STATE scanbufhandle;

0 commit comments

Comments
 (0)