1 |
commit: 294d3baca2c4c837a45324b2dcedcc4ca654ecc1 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 5 08:02:50 2021 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 5 08:04:58 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=294d3bac |
7 |
|
8 |
dev-haskell/language-c: handle gcc-11's #line 0 macros |
9 |
|
10 |
Reported-by: Agostino Sarubbo |
11 |
Closes: https://bugs.gentoo.org/788298 |
12 |
Package-Manager: Portage-3.0.18, Repoman-3.0.3 |
13 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
14 |
|
15 |
.../language-c/files/language-c-0.8.3-gcc-11.patch | 41 ++++++++++++++++++++++ |
16 |
dev-haskell/language-c/language-c-0.8.3-r1.ebuild | 41 ++++++++++++++++++++++ |
17 |
2 files changed, 82 insertions(+) |
18 |
|
19 |
diff --git a/dev-haskell/language-c/files/language-c-0.8.3-gcc-11.patch b/dev-haskell/language-c/files/language-c-0.8.3-gcc-11.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..5b2e8e4e899 |
22 |
--- /dev/null |
23 |
+++ b/dev-haskell/language-c/files/language-c-0.8.3-gcc-11.patch |
24 |
@@ -0,0 +1,41 @@ |
25 |
+From 8133e1526750ab74ca4d5180fb140a7e172d473f Mon Sep 17 00:00:00 2001 |
26 |
+From: Sergei Trofimovich <slyfox@g.o> |
27 |
+Date: Sat, 8 Aug 2020 23:43:12 +0100 |
28 |
+Subject: [PATCH] Lexer: allow zeros as line numbers in preprocessed directives |
29 |
+ |
30 |
+Starting from `gcc-11` initial line numbers not related to |
31 |
+actual files are marked as zeros. See the "preprocessor: |
32 |
+Better line info for <builtin> & <command-line>" |
33 |
+https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6bf2ff0d52a9 |
34 |
+ |
35 |
+language-c's grammar did not allow it (by accident) |
36 |
+ |
37 |
+``` |
38 |
+Prelude> Language.C.parseC (Data.ByteString.Char8.pack "# 0 \"/dev/null\"\n") Language.C.nopos |
39 |
+Left <no file>:: [ERROR] >>> Syntax Error ! |
40 |
+ Lexical error ! |
41 |
+ The character '#' does not fit here. |
42 |
+``` |
43 |
+ |
44 |
+The change allows '0' in line numbers as well. |
45 |
+ |
46 |
+Closes: https://github.com/visq/language-c/issues/74 |
47 |
+Signed-off-by: Sergei Trofimovich <slyfox@g.o> |
48 |
+--- |
49 |
+ src/Language/C/Parser/Lexer.x | 2 +- |
50 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
51 |
+ |
52 |
+--- a/src/Language/C/Parser/Lexer.x |
53 |
++++ b/src/Language/C/Parser/Lexer.x |
54 |
+@@ -147,7 +147,7 @@ $white+ ; |
55 |
+ -- |
56 |
+ -- * see https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html |
57 |
+ -- |
58 |
+-\#$space*@int$space*(\"($infname|@charesc)*\"$space*)?(@int$space*)*\r?$eol |
59 |
++\#$space*@digits$space*(\"($infname|@charesc)*\"$space*)?(@int$space*)*\r?$eol |
60 |
+ { \pos len str -> setPos (adjustLineDirective len (takeChars len str) pos) >> lexToken' False } |
61 |
+ |
62 |
+ -- #pragma directive (K&R A12.8) |
63 |
+-- |
64 |
+2.28.0 |
65 |
+ |
66 |
|
67 |
diff --git a/dev-haskell/language-c/language-c-0.8.3-r1.ebuild b/dev-haskell/language-c/language-c-0.8.3-r1.ebuild |
68 |
new file mode 100644 |
69 |
index 00000000000..795d688b3cd |
70 |
--- /dev/null |
71 |
+++ b/dev-haskell/language-c/language-c-0.8.3-r1.ebuild |
72 |
@@ -0,0 +1,41 @@ |
73 |
+# Copyright 1999-2021 Gentoo Authors |
74 |
+# Distributed under the terms of the GNU General Public License v2 |
75 |
+ |
76 |
+EAPI=7 |
77 |
+ |
78 |
+# ebuild generated by hackport 0.6.9999 |
79 |
+#hackport: flags: -allwarnings,+separatesyb,+usebytestrings,+splitbase,+iecfpextension |
80 |
+ |
81 |
+CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite" |
82 |
+inherit haskell-cabal |
83 |
+ |
84 |
+DESCRIPTION="Analysis and generation of C code" |
85 |
+HOMEPAGE="http://visq.github.io/language-c/" |
86 |
+SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz" |
87 |
+ |
88 |
+LICENSE="BSD" |
89 |
+SLOT="0/${PV}" |
90 |
+KEYWORDS="~amd64 ~x86" |
91 |
+IUSE="" |
92 |
+ |
93 |
+RDEPEND="dev-haskell/syb:=[profile?] |
94 |
+ >=dev-lang/ghc-7.10.1:= |
95 |
+" |
96 |
+DEPEND="${RDEPEND} |
97 |
+ dev-haskell/alex |
98 |
+ >=dev-haskell/cabal-1.22.2.0 |
99 |
+ dev-haskell/happy |
100 |
+" |
101 |
+ |
102 |
+PATCHES=( |
103 |
+ "${FILESDIR}"/${PN}-0.8.3-gcc-11.patch |
104 |
+) |
105 |
+ |
106 |
+src_configure() { |
107 |
+ haskell-cabal_src_configure \ |
108 |
+ --flag=-allwarnings \ |
109 |
+ --flag=iecfpextension \ |
110 |
+ --flag=separatesyb \ |
111 |
+ --flag=splitbase \ |
112 |
+ --flag=usebytestrings |
113 |
+} |