summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorPeter Eisentraut2017-08-11 03:33:47 +0000
committerPeter Eisentraut2017-10-16 20:28:11 +0000
commit421167362242ce1fb46d6d720798787e7cd65aad (patch)
tree5f0c2620cd7364cd66404ca8a3433bb55d1291b3 /src/backend
parentcf5ba7c30c0428f5ff49197ec1e0f052035300d6 (diff)
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: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/bootstrap/bootscanner.l3
-rw-r--r--src/backend/parser/scan.l5
-rw-r--r--src/backend/replication/repl_scanner.l3
-rw-r--r--src/backend/replication/syncrep_scanner.l3
-rw-r--r--src/backend/utils/misc/guc-file.l4
5 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l
index 51c5e5e3cd6..5465217bc30 100644
--- a/src/backend/bootstrap/bootscanner.l
+++ b/src/backend/bootstrap/bootscanner.l
@@ -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)
{
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index 634bfa512f4..6af2199cdc5 100644
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -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
diff --git a/src/backend/replication/repl_scanner.l b/src/backend/replication/repl_scanner.l
index 62bb5288c01..568d55ac953 100644
--- a/src/backend/replication/repl_scanner.l
+++ b/src/backend/replication/repl_scanner.l
@@ -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)
diff --git a/src/backend/replication/syncrep_scanner.l b/src/backend/replication/syncrep_scanner.l
index d1d1b26a480..1fbc936aa6f 100644
--- a/src/backend/replication/syncrep_scanner.l
+++ b/src/backend/replication/syncrep_scanner.l
@@ -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
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index f01b814c6ed..3de8e791f21 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -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