Commit 42116736 authored by Peter Eisentraut's avatar Peter Eisentraut

Exclude flex-generated code from coverage testing

Flex generates a lot of functions that are not actually used.  In order
to avoid coverage figures being ruined by that, mark up the part of the
.l files where the generated code appears by lcov exclusion markers.
That way, lcov will typically only reported on coverage for the .l file,
which is under our control, but not for the .c file.
Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
parent cf5ba7c3
......@@ -4,6 +4,8 @@
* contrib/cube/cubescan.l
*/
/* LCOV_EXCL_START */
/* No reason to constrain amount of data slurped */
#define YY_READ_BUF_SIZE 16777216
......@@ -56,6 +58,8 @@ NaN [nN][aA][nN]
%%
/* LCOV_EXCL_STOP */
/* result is not used, but Bison expects this signature */
void
yyerror(NDBOX **result, const char *message)
......
......@@ -3,6 +3,8 @@
* A scanner for EMP-style numeric ranges
*/
/* LCOV_EXCL_START */
/* No reason to constrain amount of data slurped */
#define YY_READ_BUF_SIZE 16777216
......@@ -51,6 +53,8 @@ float ({integer}|{real})([eE]{integer})?
%%
/* LCOV_EXCL_STOP */
void
yyerror(SEG *result, const char *message)
{
......
......@@ -38,6 +38,7 @@
/* Not needed now that this file is compiled as part of bootparse. */
/* #include "bootparse.h" */
/* LCOV_EXCL_START */
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
#undef fprintf
......@@ -134,6 +135,8 @@ insert { return INSERT_TUPLE; }
%%
/* LCOV_EXCL_STOP */
void
yyerror(const char *message)
{
......
......@@ -41,6 +41,9 @@
}
%{
/* LCOV_EXCL_START */
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
#undef fprintf
#define fprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
......@@ -1011,6 +1014,8 @@ other .
%%
/* LCOV_EXCL_STOP */
/*
* Arrange access to yyextra for subroutines of the main yylex() function.
* We expect each subroutine to have a yyscanner parameter. Rather than
......
......@@ -38,6 +38,8 @@ static char *litbufdup(void);
static void addlit(char *ytext, int yleng);
static void addlitchar(unsigned char ychar);
/* LCOV_EXCL_START */
%}
%option 8bit
......@@ -186,6 +188,7 @@ WAIT { return K_WAIT; }
}
%%
/* LCOV_EXCL_STOP */
static void
startlit(void)
......
......@@ -32,6 +32,8 @@ static YY_BUFFER_STATE scanbufhandle;
static StringInfoData xdbuf;
/* LCOV_EXCL_START */
%}
%option 8bit
......@@ -112,6 +114,7 @@ xdinside [^"]+
. { return JUNK; }
%%
/* LCOV_EXCL_STOP */
/* Needs to be here for access to yytext */
void
......
......@@ -57,6 +57,8 @@ static void record_config_file_error(const char *errmsg,
static int GUC_flex_fatal(const char *msg);
static char *GUC_scanstr(const char *s);
/* LCOV_EXCL_START */
%}
%option 8bit
......@@ -107,7 +109,7 @@ STRING \'([^'\\\n]|\\.|\'\')*\'
%%
/* LCOV_EXCL_STOP */
/*
* Exported function to read and process the configuration file. The
......
......@@ -43,6 +43,8 @@ static bool last_was_newline = false;
extern int expr_yyget_column(yyscan_t yyscanner);
extern void expr_yyset_column(int column_no, yyscan_t yyscanner);
/* LCOV_EXCL_START */
%}
/* Except for the prefix, these options should match psqlscan.l */
......@@ -190,6 +192,8 @@ continuation \\{newline}
%%
/* LCOV_EXCL_STOP */
void
expr_yyerror_more(yyscan_t yyscanner, const char *message, const char *more)
{
......
......@@ -67,6 +67,8 @@ static void evaluate_backtick(PsqlScanState state);
extern int slash_yyget_column(yyscan_t yyscanner);
extern void slash_yyset_column(int column_no, yyscan_t yyscanner);
/* LCOV_EXCL_START */
%}
/* Except for the prefix, these options should match psqlscan.l */
......@@ -468,6 +470,8 @@ other .
%%
/* LCOV_EXCL_STOP */
/*
* Scan the command name of a psql backslash command. This should be called
* after psql_scan() returns PSCAN_BACKSLASH. It is assumed that the input
......
......@@ -71,6 +71,8 @@ typedef int YYSTYPE;
extern int psql_yyget_column(yyscan_t yyscanner);
extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
/* LCOV_EXCL_START */
%}
%option reentrant
......@@ -899,6 +901,8 @@ other .
%%
/* LCOV_EXCL_STOP */
/*
* Create a lexer working state struct.
*
......
......@@ -79,6 +79,8 @@ static struct _if_value
short else_branch;
} stacked_if_value[MAX_NESTED_IF];
/* LCOV_EXCL_START */
%}
%option 8bit
......@@ -1249,7 +1251,11 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
}
}
<INITIAL>{other}|\n { mmfatal(PARSE_ERROR, "internal error: unreachable state; please report this to <pgsql-bugs@postgresql.org>"); }
%%
/* LCOV_EXCL_STOP */
void
lex_init(void)
{
......
......@@ -17,6 +17,8 @@ static int litbufpos = 0;
static void addlitchar(char c);
/* LCOV_EXCL_START */
%}
%option 8bit
......@@ -93,6 +95,8 @@ teardown { return TEARDOWN; }
}
%%
/* LCOV_EXCL_STOP */
static void
addlitchar(char c)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment