Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4211673

Browse files
committed
Exclude flex-generated code from coverage testing
Flex generates a lot of functions that are not actually used. In orderto 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>
1 parentcf5ba7c commit4211673

File tree

12 files changed

+47
-1
lines changed

12 files changed

+47
-1
lines changed

‎contrib/cube/cubescan.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* contrib/cube/cubescan.l
55
*/
66

7+
/* LCOV_EXCL_START*/
8+
79
/* No reason to constrain amount of data slurped*/
810
#defineYY_READ_BUF_SIZE16777216
911

@@ -56,6 +58,8 @@ NaN [nN][aA][nN]
5658

5759
%%
5860

61+
/* LCOV_EXCL_STOP */
62+
5963
/* result is not used, but Bison expects this signature */
6064
void
6165
yyerror(NDBOX **result,constchar *message)

‎contrib/seg/segscan.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* A scanner for EMP-style numeric ranges
44
*/
55

6+
/* LCOV_EXCL_START*/
7+
68
/* No reason to constrain amount of data slurped*/
79
#defineYY_READ_BUF_SIZE16777216
810

@@ -51,6 +53,8 @@ float ({integer}|{real})([eE]{integer})?
5153

5254
%%
5355

56+
/* LCOV_EXCL_STOP */
57+
5458
void
5559
yyerror(SEG *result,constchar *message)
5660
{

‎src/backend/bootstrap/bootscanner.l

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
/* Not needed now that this file is compiled as part of bootparse.*/
3939
/* #include "bootparse.h"*/
4040

41+
/* LCOV_EXCL_START*/
4142

4243
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
4344
#undef fprintf
@@ -134,6 +135,8 @@ insert{ return INSERT_TUPLE; }
134135

135136
%%
136137

138+
/* LCOV_EXCL_STOP */
139+
137140
void
138141
yyerror(constchar *message)
139142
{

‎src/backend/parser/scan.l

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
}
4242

4343
%{
44+
45+
/* LCOV_EXCL_START*/
46+
4447
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error)*/
4548
#undef fprintf
4649
#definefprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
@@ -1011,6 +1014,8 @@ other.
10111014

10121015
%%
10131016

1017+
/* LCOV_EXCL_STOP */
1018+
10141019
/*
10151020
* Arrange access to yyextra for subroutines of the main yylex() function.
10161021
* We expect each subroutine to have a yyscanner parameter. Rather than

‎src/backend/replication/repl_scanner.l

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ static char *litbufdup(void);
3838
staticvoidaddlit(char *ytext,int yleng);
3939
staticvoidaddlitchar(unsignedchar ychar);
4040

41+
/* LCOV_EXCL_START*/
42+
4143
%}
4244

4345
%option8bit
@@ -186,6 +188,7 @@ WAIT{ return K_WAIT; }
186188
}
187189
%%
188190

191+
/* LCOV_EXCL_STOP */
189192

190193
staticvoid
191194
startlit(void)

‎src/backend/replication/syncrep_scanner.l

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ static YY_BUFFER_STATE scanbufhandle;
3232

3333
static StringInfoData xdbuf;
3434

35+
/* LCOV_EXCL_START*/
36+
3537
%}
3638

3739
%option8bit
@@ -112,6 +114,7 @@ xdinside[^"]+
112114
.{return JUNK; }
113115
%%
114116

117+
/* LCOV_EXCL_STOP */
115118

116119
/* Needs to be here for access to yytext */
117120
void

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ static void record_config_file_error(const char *errmsg,
5757
staticintGUC_flex_fatal(constchar *msg);
5858
staticchar *GUC_scanstr(constchar *s);
5959

60+
/* LCOV_EXCL_START */
61+
6062
%}
6163

6264
%option 8bit
@@ -107,7 +109,7 @@ STRING\'([^'\\\n]|\\.|\'\')*\'
107109
108110
%%
109111
110-
112+
/* LCOV_EXCL_STOP */
111113
112114
/*
113115
* Exported function to read and process the configuration file. The

‎src/bin/pgbench/exprscan.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ static bool last_was_newline = false;
4343
externintexpr_yyget_column(yyscan_t yyscanner);
4444
externvoidexpr_yyset_column(int column_no,yyscan_t yyscanner);
4545

46+
/* LCOV_EXCL_START*/
47+
4648
%}
4749

4850
/* Except for the prefix, these options should match psqlscan.l */
@@ -190,6 +192,8 @@ continuation\\{newline}
190192

191193
%%
192194

195+
/* LCOV_EXCL_STOP */
196+
193197
void
194198
expr_yyerror_more(yyscan_t yyscanner,constchar *message,constchar *more)
195199
{

‎src/bin/psql/psqlscanslash.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ static void evaluate_backtick(PsqlScanState state);
6767
extern intslash_yyget_column(yyscan_t yyscanner);
6868
externvoidslash_yyset_column(int column_no,yyscan_t yyscanner);
6969

70+
/* LCOV_EXCL_START*/
71+
7072
%}
7173

7274
/* Except for the prefix, these options should match psqlscan.l */
@@ -468,6 +470,8 @@ other.
468470

469471
%%
470472

473+
/* LCOV_EXCL_STOP */
474+
471475
/*
472476
* Scan the command name of a psql backslash command. This should be called
473477
* after psql_scan() returns PSCAN_BACKSLASH. It is assumed that the input

‎src/fe_utils/psqlscan.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ typedef int YYSTYPE;
7171
extern intpsql_yyget_column(yyscan_t yyscanner);
7272
externvoidpsql_yyset_column(int column_no,yyscan_t yyscanner);
7373

74+
/* LCOV_EXCL_START*/
75+
7476
%}
7577

7678
%optionreentrant
@@ -899,6 +901,8 @@ other.
899901

900902
%%
901903

904+
/* LCOV_EXCL_STOP */
905+
902906
/*
903907
* Create a lexer working state struct.
904908
*

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static struct _if_value
7979
short else_branch;
8080
} stacked_if_value[MAX_NESTED_IF];
8181

82+
/* LCOV_EXCL_START*/
83+
8284
%}
8385

8486
%option8bit
@@ -1249,7 +1251,11 @@ cppline{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
12491251
}
12501252
}
12511253
<INITIAL>{other}|\n{mmfatal(PARSE_ERROR,"internal error: unreachable state; please report this to <pgsql-bugs@postgresql.org>"); }
1254+
12521255
%%
1256+
1257+
/* LCOV_EXCL_STOP */
1258+
12531259
void
12541260
lex_init(void)
12551261
{

‎src/test/isolation/specscanner.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ static int litbufpos = 0;
1717

1818
staticvoidaddlitchar(char c);
1919

20+
/* LCOV_EXCL_START*/
21+
2022
%}
2123

2224
%option8bit
@@ -93,6 +95,8 @@ teardown{ return TEARDOWN; }
9395
}
9496
%%
9597

98+
/* LCOV_EXCL_STOP */
99+
96100
staticvoid
97101
addlitchar(char c)
98102
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp