]> granicus.if.org Git - flex/commitdiff
Emit no #line directives if gen_line_dirs is false, resolves igh#55.
authorTobias Klauser <tklauser@distanz.ch>
Tue, 23 Feb 2016 14:59:42 +0000 (15:59 +0100)
committerWill Estes <westes575@gmail.com>
Wed, 24 Feb 2016 21:19:49 +0000 (16:19 -0500)
There are two instances in the code which will print a #line directive
to the resulting lexer, regardless of the value of gen_line_dirs. Fix
them, so they also respect gen_line_dirs.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
src/buf.c
src/main.c

index 2a423ef58e820d435ab69c26f0914ee0ac382537..f216b6d0d102362ade81b7032f2c2c6ba17afe06 100644 (file)
--- a/src/buf.c
+++ b/src/buf.c
@@ -95,6 +95,9 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno)
     const char *src;
     size_t tsz;
 
+    if (gen_line_dirs)
+       return buf;
+
     tsz = strlen("#line \"\"\n")                +   /* constant parts */
                2 * strlen (filename)            +   /* filename with possibly all backslashes escaped */
                (int) (1 + log10 (abs (lineno))) +   /* line number */
index fd06be427b845023aaf716c56641a595dcb978c4..e6ea2abaf6f808fa204c0176ecfe9f2642cb3aee 100644 (file)
@@ -496,7 +496,8 @@ void check_options (void)
     m4defs_buf.nelts = 0; /* memory leak here. */
 
     /* Place a bogus line directive, it will be fixed in the filter. */
-    outn("#line 0 \"M4_YY_OUTFILE_NAME\"\n");
+    if (gen_line_dirs)
+        outn("#line 0 \"M4_YY_OUTFILE_NAME\"\n");
 
        /* Dump the user defined preproc directives. */
        if (userdef_buf.elts)