From 7f119684e9ee74ee599be7005af73b0cc9ee6abb Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Sat, 9 Jan 2021 13:25:16 +0300 Subject: [PATCH] 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') --- flex/src/buf.c | 4 ++-- flex/src/skel.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flex/src/buf.c b/flex/src/buf.c index 185083c..8efced7 100644 --- a/flex/src/buf.c +++ b/flex/src/buf.c @@ -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 */ diff --git a/flex/src/skel.c b/flex/src/skel.c index 0b43266..eaf45e9 100644 --- a/flex/src/skel.c +++ b/flex/src/skel.c @@ -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) )", @@ -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;", "}", "", "",