Skip to content

Commit 0c79ba4

Browse files
committed
Warning GCC and Clang : Empty lines : %option '-L'
- Fixed [-Wmisleading-indentation] waning of clang(v10+) and gcc(v6+) - Fixed a problem with a sequence of empty lines ('\n' sequence) - Fixed a bugs with '-L' options (%top print a '#line')
1 parent 159682c commit 0c79ba4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

flex/src/buf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
9595
const char *src;
9696
size_t tsz;
9797

98-
if (gen_line_dirs)
99-
return buf;
98+
if (!gen_line_dirs)
99+
return buf;
100100

101101
tsz = strlen("#line \"\"\n") + /* constant parts */
102102
2 * strlen (filename) + /* filename with possibly all backslashes escaped */

flex/src/scan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,8 @@ YY_RULE_SETUP
23282328
{
23292329
brace_start_line = linenum;
23302330
++linenum;
2331-
buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
2331+
if(gen_line_dirs)
2332+
buf_linedir(&top_buf, infilename ? infilename : "<stdin>", linenum);
23322333
brace_depth = 1;
23332334
yy_push_state(CODEBLOCK_MATCH_BRACE);
23342335
}
@@ -4478,7 +4479,7 @@ static int yy_get_next_buffer (void)
44784479
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
44794480
yy_is_jam = (yy_current_state == 1113);
44804481

4481-
return yy_is_jam ? 0 : yy_current_state;
4482+
return yy_is_jam ? 0 : yy_current_state;
44824483
}
44834484

44844485
#ifndef YY_NO_UNPUT

flex/src/skel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,8 @@ const char *skel[] = {
16511651
" /* Create the reject buffer large enough to save one state per allowed character. */",
16521652
" if ( ! YY_G(yy_state_buf) )",
16531653
" YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);",
1654-
" if ( ! YY_G(yy_state_buf) )",
1655-
" YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );",
1654+
" if ( ! YY_G(yy_state_buf) )",
1655+
" YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );",
16561656
"]])",
16571657
"",
16581658
" if ( ! YY_G(yy_start) )",
@@ -2181,7 +2181,7 @@ const char *skel[] = {
21812181
"%% [17.0] code to find the next state, and perhaps do backing up, goes here",
21822182
"",
21832183
" M4_YY_NOOP_GUTS_VAR();",
2184-
" return yy_is_jam ? 0 : yy_current_state;",
2184+
"return yy_is_jam ? 0 : yy_current_state;",
21852185
"}",
21862186
"",
21872187
"",

0 commit comments

Comments
 (0)