let Bison generate the header directly
authorDmitry Shachnev <mitya57@debian.org>
Thu, 9 Jan 2025 11:39:01 +0000 (14:39 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 9 Jan 2025 11:39:01 +0000 (14:39 +0300)
Forwarded: https://github.com/qtwebkit/qtwebkit/pull/1012
Last-Update: 2020-08-04

Starting with Bison 3.7, the generated C++ file #include's the header
by default, instead of duplicating it. So we should not delete it.

Remove the code to add #ifdef guards to the header, since Bison adds
them itself since version 2.6.3.

Gbp-Pq: Name bison_3.7.diff

Source/WebCore/css/makegrammar.pl

index 5d63b08102eb5b80a04c221b34e4e1f1d4026ea8..9435701c706121eacd3071d00d8a18484d571382 100644 (file)
@@ -73,25 +73,6 @@ if ($suffix eq ".y.in") {
 }
 
 my $fileBase = File::Spec->join($outputDir, $filename);
-my @bisonCommand = ($bison, "-d", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp");
+my @bisonCommand = ($bison, "--defines=$fileBase.h", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp");
 push @bisonCommand, "--no-lines" if $^O eq "MSWin32"; # Work around bug in bison >= 3.0 on Windows where it puts backslashes into #line directives.
 system(@bisonCommand) == 0 or die;
-
-open HEADER, ">$fileBase.h" or die;
-print HEADER << "EOF";
-#ifndef CSSGRAMMAR_H
-#define CSSGRAMMAR_H
-EOF
-
-open HPP, "<$fileBase.cpp.h" or open HPP, "<$fileBase.hpp" or die;
-while (<HPP>) {
-    print HEADER;
-}
-close HPP;
-
-print HEADER "#endif\n";
-close HEADER;
-
-unlink("$fileBase.cpp.h");
-unlink("$fileBase.hpp");
-