commit: 294d3baca2c4c837a45324b2dcedcc4ca654ecc1 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> AuthorDate: Wed May 5 08:02:50 2021 +0000 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> CommitDate: Wed May 5 08:04:58 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=294d3bac
dev-haskell/language-c: handle gcc-11's #line 0 macros Reported-by: Agostino Sarubbo Closes: https://bugs.gentoo.org/788298 Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> .../language-c/files/language-c-0.8.3-gcc-11.patch | 41 ++++++++++++++++++++++ dev-haskell/language-c/language-c-0.8.3-r1.ebuild | 41 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) 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 new file mode 100644 index 00000000000..5b2e8e4e899 --- /dev/null +++ b/dev-haskell/language-c/files/language-c-0.8.3-gcc-11.patch @@ -0,0 +1,41 @@ +From 8133e1526750ab74ca4d5180fb140a7e172d473f Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <sly...@gentoo.org> +Date: Sat, 8 Aug 2020 23:43:12 +0100 +Subject: [PATCH] Lexer: allow zeros as line numbers in preprocessed directives + +Starting from `gcc-11` initial line numbers not related to +actual files are marked as zeros. See the "preprocessor: +Better line info for <builtin> & <command-line>" +https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6bf2ff0d52a9 + +language-c's grammar did not allow it (by accident) + +``` +Prelude> Language.C.parseC (Data.ByteString.Char8.pack "# 0 \"/dev/null\"\n") Language.C.nopos +Left <no file>:: [ERROR] >>> Syntax Error ! + Lexical error ! + The character '#' does not fit here. +``` + +The change allows '0' in line numbers as well. + +Closes: https://github.com/visq/language-c/issues/74 +Signed-off-by: Sergei Trofimovich <sly...@gentoo.org> +--- + src/Language/C/Parser/Lexer.x | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/Language/C/Parser/Lexer.x ++++ b/src/Language/C/Parser/Lexer.x +@@ -147,7 +147,7 @@ $white+ ; + -- + -- * see https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html + -- +-\#$space*@int$space*(\"($infname|@charesc)*\"$space*)?(@int$space*)*\r?$eol ++\#$space*@digits$space*(\"($infname|@charesc)*\"$space*)?(@int$space*)*\r?$eol + { \pos len str -> setPos (adjustLineDirective len (takeChars len str) pos) >> lexToken' False } + + -- #pragma directive (K&R A12.8) +-- +2.28.0 + 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 new file mode 100644 index 00000000000..795d688b3cd --- /dev/null +++ b/dev-haskell/language-c/language-c-0.8.3-r1.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +# ebuild generated by hackport 0.6.9999 +#hackport: flags: -allwarnings,+separatesyb,+usebytestrings,+splitbase,+iecfpextension + +CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite" +inherit haskell-cabal + +DESCRIPTION="Analysis and generation of C code" +HOMEPAGE="http://visq.github.io/language-c/" +SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0/${PV}" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND="dev-haskell/syb:=[profile?] + >=dev-lang/ghc-7.10.1:= +" +DEPEND="${RDEPEND} + dev-haskell/alex + >=dev-haskell/cabal-1.22.2.0 + dev-haskell/happy +" + +PATCHES=( + "${FILESDIR}"/${PN}-0.8.3-gcc-11.patch +) + +src_configure() { + haskell-cabal_src_configure \ + --flag=-allwarnings \ + --flag=iecfpextension \ + --flag=separatesyb \ + --flag=splitbase \ + --flag=usebytestrings +}