1From d92b11fea65364fefa700249bd3340e0cd4c5b31 Mon Sep 17 00:00:00 2001
2From: Dmitry Shachnev <mitya57@gmail.com>
3Date: Tue, 4 Aug 2020 21:04:06 +0300
4Subject: [PATCH] Let Bison generate the header directly, to fix build with
5 Bison 3.7
6
7Starting with Bison 3.7, the generated C++ file #include's the header
8by default, instead of duplicating it. So we should not delete it.
9
10Remove the code to add #ifdef guards to the header, since Bison adds
11them itself since version 2.6.3.
12Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
13[james.hilliard1@gmail.com: backport from upstream commit
14d92b11fea65364fefa700249bd3340e0cd4c5b31]
15---
16 Source/WebCore/css/makegrammar.pl | 21 +--------------------
17 1 file changed, 1 insertion(+), 20 deletions(-)
18
19diff --git a/Source/WebCore/css/makegrammar.pl b/Source/WebCore/css/makegrammar.pl
20index 5d63b08102eb..9435701c7061 100644
21--- a/Source/WebCore/css/makegrammar.pl
22+++ b/Source/WebCore/css/makegrammar.pl
23@@ -73,25 +73,6 @@ if ($suffix eq ".y.in") {
24 }
25
26 my $fileBase = File::Spec->join($outputDir, $filename);
27-my @bisonCommand = ($bison, "-d", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp");
28+my @bisonCommand = ($bison, "--defines=$fileBase.h", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp");
29 push @bisonCommand, "--no-lines" if $^O eq "MSWin32"; # Work around bug in bison >= 3.0 on Windows where it puts backslashes into #line directives.
30 system(@bisonCommand) == 0 or die;
31-
32-open HEADER, ">$fileBase.h" or die;
33-print HEADER << "EOF";
34-#ifndef CSSGRAMMAR_H
35-#define CSSGRAMMAR_H
36-EOF
37-
38-open HPP, "<$fileBase.cpp.h" or open HPP, "<$fileBase.hpp" or die;
39-while (<HPP>) {
40-    print HEADER;
41-}
42-close HPP;
43-
44-print HEADER "#endif\n";
45-close HEADER;
46-
47-unlink("$fileBase.cpp.h");
48-unlink("$fileBase.hpp");
49-
50--
512.25.1
52
53