Bug 164973 - Disable #line markers in bison output on Windows
Summary: Disable #line markers in bison output on Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Konstantin Tokarev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-18 17:20 PST by Konstantin Tokarev
Modified: 2016-11-21 17:57 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.58 KB, patch)
2016-11-18 17:22 PST, Konstantin Tokarev
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Tokarev 2016-11-18 17:20:25 PST
New bison versions since 3.0 have bug that causes unescaped paths to be printed in #line directives. On Windows CMake passes absolute paths to bison that have backslashes in them, leading to compiler errors or warnings because of unrecognized escape sequences.
Comment 1 Konstantin Tokarev 2016-11-18 17:22:15 PST
Created attachment 295229 [details]
Patch
Comment 2 Darin Adler 2016-11-21 09:14:12 PST
Comment on attachment 295229 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295229&action=review

> Source/WebCore/css/makegrammar.pl:83
> -system("\"$bison\" -d -p $symbolsPrefix $grammarFilePath -o $fileBase.cpp");
> +
> +my $extraArg = "";
> +if ($^O eq "MSWin32") {
> +    $extraArg = "--no-lines";
> +}
> +system("\"$bison\" $extraArg -d -p $symbolsPrefix $grammarFilePath -o $fileBase.cpp");

Here's how I would write it:

    my @noLines = ();
    push @noLines, "--no-lines" if $^O eq "MSWin32"; # Work around bug in bison >= 3.0 on Windows where it puts backslashes into #line directives.
    system($bison, @noLines, "-d", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp") == 0 or die;
Comment 3 Konstantin Tokarev 2016-11-21 09:39:59 PST
What about 

  my @bisonCmd = ($bison, "-d", "-p", $symbolsPrefix, $grammarFilePath, "-o", $fileBase.cpp);
  push @bisonCmd, "--no-lines" if $^O eq "MSWin32"; # Work around bug in bison >= 3.0 on Windows where it puts backslashes into #line directives.
  system(@bisonCmd) == 0 or die;

?
Comment 4 Darin Adler 2016-11-21 09:42:16 PST
That seems fine. I would name it @bisonCommand, without abbreviating the word, though.
Comment 5 Darin Adler 2016-11-21 09:43:00 PST
(In reply to comment #3)
>   my @bisonCmd = ($bison, "-d", "-p", $symbolsPrefix, $grammarFilePath,
> "-o", $fileBase.cpp);

Need quotes around "$fileBase.cpp".
Comment 6 Konstantin Tokarev 2016-11-21 17:57:42 PST
Committed r208954: <http://trac.webkit.org/changeset/208954>