Skip to content

Commit

Permalink
Warning GCC and Clang : Empty lines : %option '-L'
Browse files Browse the repository at this point in the history
- 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')
  • Loading branch information
dpasukhi committed Jan 11, 2021
1 parent 159682c commit 0c79ba4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions flex/src/buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
const char *src;
size_t tsz;

if (gen_line_dirs)
return buf;
if (!gen_line_dirs)
return buf;

tsz = strlen("#line \"\"\n") + /* constant parts */
2 * strlen (filename) + /* filename with possibly all backslashes escaped */
Expand Down
5 changes: 3 additions & 2 deletions flex/src/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,8 @@ YY_RULE_SETUP
{
brace_start_line = linenum;
++linenum;
buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
if(gen_line_dirs)
buf_linedir(&top_buf, infilename ? infilename : "<stdin>", linenum);
brace_depth = 1;
yy_push_state(CODEBLOCK_MATCH_BRACE);
}
Expand Down Expand Up @@ -4478,7 +4479,7 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 1113);

return yy_is_jam ? 0 : yy_current_state;
return yy_is_jam ? 0 : yy_current_state;
}

#ifndef YY_NO_UNPUT
Expand Down
6 changes: 3 additions & 3 deletions flex/src/skel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,8 @@ const char *skel[] = {
" /* Create the reject buffer large enough to save one state per allowed character. */",
" if ( ! YY_G(yy_state_buf) )",
" YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);",
" if ( ! YY_G(yy_state_buf) )",
" YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );",
" if ( ! YY_G(yy_state_buf) )",
" YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );",
"]])",
"",
" if ( ! YY_G(yy_start) )",
Expand Down Expand Up @@ -2181,7 +2181,7 @@ const char *skel[] = {
"%% [17.0] code to find the next state, and perhaps do backing up, goes here",
"",
" M4_YY_NOOP_GUTS_VAR();",
" return yy_is_jam ? 0 : yy_current_state;",
"return yy_is_jam ? 0 : yy_current_state;",
"}",
"",
"",
Expand Down

0 comments on commit 0c79ba4

Please sign in to comment.