[arch-commits] Commit in haskell-language-c/trunk (PKGBUILD float128.patch)

Felix Yan felixonmars at archlinux.org
Mon May 22 06:39:09 UTC 2017


    Date: Monday, May 22, 2017 @ 06:39:08
  Author: felixonmars
Revision: 228946

upgpkg: haskell-language-c 0.6.1-2

add a patch for gcc 7

Added:
  haskell-language-c/trunk/float128.patch
Modified:
  haskell-language-c/trunk/PKGBUILD

----------------+
 PKGBUILD       |   14 +++-
 float128.patch |  171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 182 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2017-05-21 21:03:17 UTC (rev 228945)
+++ PKGBUILD	2017-05-22 06:39:08 UTC (rev 228946)
@@ -5,7 +5,7 @@
 _hkgname=language-c
 pkgname=haskell-language-c
 pkgver=0.6.1
-pkgrel=1
+pkgrel=2
 pkgdesc="Analysis and generation of C code"
 url="http://visq.github.io/language-c/"
 license=("custom:BSD3")
@@ -12,9 +12,17 @@
 arch=('i686' 'x86_64')
 makedepends=('happy' 'alex')
 depends=("ghc=8.0.1" "haskell-syb")
-source=("https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz")
-sha256sums=('23cadc9d04e46490ec57f56b79ecdc2a709ebf57571345905e6e30db29fa37e8')
+source=("https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+        float128.patch)
+sha256sums=('23cadc9d04e46490ec57f56b79ecdc2a709ebf57571345905e6e30db29fa37e8'
+            'e9ca5665c11229f67b2b411aedd98ede1d4a1639c91c667ef9ac611071b0ec69')
 
+prepare() {
+    cd $_hkgname-$pkgver
+    # https://github.com/visq/language-c/pull/33
+    patch -p1 -i ../float128.patch
+}
+
 build() {
     cd "${srcdir}/${_hkgname}-${pkgver}"
     

Added: float128.patch
===================================================================
--- float128.patch	                        (rev 0)
+++ float128.patch	2017-05-22 06:39:08 UTC (rev 228946)
@@ -0,0 +1,171 @@
+From a53a3225bfd588e1a9b2cd00c5e4d0fe2c9bb2f1 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i at maskray.me>
+Date: Sun, 21 May 2017 14:23:49 -0700
+Subject: [PATCH] Add __float128
+
+`stddef.h` shipped by GCC 7.1.0 [1] adds when `__i386__` is defined.  This change breaks a lot packages depending on c2hs (which in turn depends on language-c).
+
+[1]: https://github.com/gcc-mirror/gcc/commit/9b5c49ef97e63cc63f1ffa13baf771368105ebe2
+---
+ README                          | 3 +--
+ src/Language/C/Parser/Lexer.x   | 6 ++++--
+ src/Language/C/Parser/Parser.y  | 2 ++
+ src/Language/C/Parser/Tokens.hs | 3 +++
+ src/Language/C/Pretty.hs        | 1 +
+ src/Language/C/Syntax/AST.hs    | 5 +++++
+ 6 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/README b/README
+index 9ea1084..2a4bf71 100644
+--- a/README
++++ b/README
+@@ -33,7 +33,6 @@ Currently unsupported C11 constructs:
+ 
+ Currently unsupported GNU C extensions:
+  - __auto_type
+- - __float128
+  - __builtin_offsetof
+    char a[__builtin_offsetof (struct S, sa->f)
+  - _Decimal32
+@@ -54,4 +53,4 @@ A couple of small examples are available in /examples
+ A couple of regression tests can be run via
+ > cd test/harness; make
+ 
+-For more tests, see test/README.
+\ No newline at end of file
++For more tests, see test/README.
+diff --git a/src/Language/C/Parser/Lexer.x b/src/Language/C/Parser/Lexer.x
+index 54f918e..ebebc29 100644
+--- a/src/Language/C/Parser/Lexer.x
++++ b/src/Language/C/Parser/Lexer.x
+@@ -119,7 +119,8 @@ $infname  = . # [ \\ \" ]             -- valid character in a filename
+ @hexmant   = @hexdigits?\. at hexdigits|@hexdigits\.
+ @binexp    = [pP][\+\-]?@digits
+ 
+- at floatsuffix    = [fFlL]
++-- Suffixes `qQwW` are GNU floating type extensions: <https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html>
++ at floatsuffix    = [fFlLqQwW]
+ @floatgnusuffix = @floatsuffix at gnusuffix?|@gnusuffix at floatsuffix?
+ 
+ -- clang version literals with a major.minor.rev
+@@ -297,7 +298,7 @@ label __label__
+ (CTokGnuC GnuCOffsetof) __builtin_offsetof
+ (CTokGnuC GnuCTyCompat) __builtin_types_compatible_p
+ -}
+--- Tokens: _Alignas _Alignof __alignof alignof __alignof__ __asm asm __asm__ _Atomic auto break _Bool case char __const const __const__ continue _Complex __complex__ default do double else enum extern float for _Generic goto if __inline inline __inline__ int __int128 long _Noreturn  _Nullable __nullable _Nonnull __nonnull register __restrict restrict __restrict__ return short __signed signed __signed__ sizeof static _Static_assert struct switch typedef __typeof typeof __typeof__ __thread _Thread_local union unsigned void __volatile volatile __volatile__ while __label__ __attribute __attribute__ __extension__ __real __real__ __imag __imag__ __builtin_va_arg __builtin_offsetof __builtin_types_compatible_p
++-- Tokens: _Alignas _Alignof __alignof alignof __alignof__ __asm asm __asm__ _Atomic auto break _Bool case char __const const __const__ continue _Complex __complex__ default do double else enum extern float __float128 for _Generic goto if __inline inline __inline__ int __int128 long _Noreturn  _Nullable __nullable _Nonnull __nonnull register __restrict restrict __restrict__ return short __signed signed __signed__ sizeof static _Static_assert struct switch typedef __typeof typeof __typeof__ __thread _Thread_local union unsigned void __volatile volatile __volatile__ while __label__ __attribute __attribute__ __extension__ __real __real__ __imag __imag__ __builtin_va_arg __builtin_offsetof __builtin_types_compatible_p
+ idkwtok ('_' : 'A' : 'l' : 'i' : 'g' : 'n' : 'a' : 's' : []) = tok 8 CTokAlignas
+ idkwtok ('_' : 'A' : 'l' : 'i' : 'g' : 'n' : 'o' : 'f' : []) = tok 8 CTokAlignof
+ idkwtok ('_' : 'A' : 't' : 'o' : 'm' : 'i' : 'c' : []) = tok 7 CTokAtomic
+@@ -337,6 +338,7 @@ idkwtok ('e' : 'n' : 'u' : 'm' : []) = tok 4 CTokEnum
+ idkwtok ('_' : '_' : 'e' : 'x' : 't' : 'e' : 'n' : 's' : 'i' : 'o' : 'n' : '_' : '_' : []) = tok 13 (CTokGnuC GnuCExtTok)
+ idkwtok ('e' : 'x' : 't' : 'e' : 'r' : 'n' : []) = tok 6 CTokExtern
+ idkwtok ('f' : 'l' : 'o' : 'a' : 't' : []) = tok 5 CTokFloat
++idkwtok ('_' : '_' : 'f' : 'l' : 'o' : 'a' : 't' : '1' : '2' : '8' : []) = tok 10 CTokFloat128
+ idkwtok ('f' : 'o' : 'r' : []) = tok 3 CTokFor
+ idkwtok ('g' : 'o' : 't' : 'o' : []) = tok 4 CTokGoto
+ idkwtok ('i' : 'f' : []) = tok 2 CTokIf
+diff --git a/src/Language/C/Parser/Parser.y b/src/Language/C/Parser/Parser.y
+index 9b40bf6..dfe6de0 100644
+--- a/src/Language/C/Parser/Parser.y
++++ b/src/Language/C/Parser/Parser.y
+@@ -201,6 +201,7 @@ else		{ CTokElse	_ }
+ enum		{ CTokEnum	_ }
+ extern		{ CTokExtern	_ }
+ float		{ CTokFloat	_ }
++"__float128"	{ CTokFloat128	_ }
+ for		{ CTokFor	_ }
+ "_Generic"      { CTokGeneric   _ }
+ goto		{ CTokGoto	_ }
+@@ -872,6 +873,7 @@ basic_type_name
+   | "_Bool"			{% withNodeInfo $1 $ CBoolType }
+   | "_Complex"			{% withNodeInfo $1 $ CComplexType }
+   | "__int128"      {% withNodeInfo $1 $ CInt128Type }
++  | "__float128"      {% withNodeInfo $1 $ CFloat128Type }
+ 
+ 
+ -- A mixture of type qualifiers, storage class and basic type names in any
+diff --git a/src/Language/C/Parser/Tokens.hs b/src/Language/C/Parser/Tokens.hs
+index f9b6c1a..be5013e 100644
+--- a/src/Language/C/Parser/Tokens.hs
++++ b/src/Language/C/Parser/Tokens.hs
+@@ -92,6 +92,7 @@ data CToken = CTokLParen   !PosLength            -- `('
+             | CTokEnum     !PosLength            -- `enum'
+             | CTokExtern   !PosLength            -- `extern'
+             | CTokFloat    !PosLength            -- `float'
++            | CTokFloat128 !PosLength            -- `__float128'
+             | CTokFor      !PosLength            -- `for'
+             | CTokGeneric  !PosLength            -- `_Generic'
+             | CTokGoto     !PosLength            -- `goto'
+@@ -224,6 +225,7 @@ posLenOfTok (CTokElse     pos  ) = pos
+ posLenOfTok (CTokEnum     pos  ) = pos
+ posLenOfTok (CTokExtern   pos  ) = pos
+ posLenOfTok (CTokFloat    pos  ) = pos
++posLenOfTok (CTokFloat128 pos  ) = pos
+ posLenOfTok (CTokFor      pos  ) = pos
+ posLenOfTok (CTokGeneric  pos  ) = pos
+ posLenOfTok (CTokGoto     pos  ) = pos
+@@ -330,6 +332,7 @@ instance Show CToken where
+   showsPrec _ (CTokEnum     _  ) = showString "enum"
+   showsPrec _ (CTokExtern   _  ) = showString "extern"
+   showsPrec _ (CTokFloat    _  ) = showString "float"
++  showsPrec _ (CTokFloat128 _  ) = showString "__float128"
+   showsPrec _ (CTokFor      _  ) = showString "for"
+   showsPrec _ (CTokGeneric  _  ) = showString "_Generic"
+   showsPrec _ (CTokGoto     _  ) = showString "goto"
+diff --git a/src/Language/C/Pretty.hs b/src/Language/C/Pretty.hs
+index b7ce31e..aa32d5b 100644
+--- a/src/Language/C/Pretty.hs
++++ b/src/Language/C/Pretty.hs
+@@ -244,6 +244,7 @@ instance Pretty CTypeSpec where
+     pretty (CIntType _)         = text "int"
+     pretty (CLongType _)        = text "long"
+     pretty (CFloatType _)       = text "float"
++    pretty (CFloat128Type _)    = text "__float128"
+     pretty (CDoubleType _)      = text "double"
+     pretty (CSignedType _)      = text "signed"
+     pretty (CUnsigType _)       = text "unsigned"
+diff --git a/src/Language/C/Syntax/AST.hs b/src/Language/C/Syntax/AST.hs
+index 39ea2e5..b257b7e 100644
+--- a/src/Language/C/Syntax/AST.hs
++++ b/src/Language/C/Syntax/AST.hs
+@@ -434,6 +434,7 @@ data CTypeSpecifier a
+   | CIntType     a
+   | CLongType    a
+   | CFloatType   a
++  | CFloat128Type a
+   | CDoubleType  a
+   | CSignedType  a
+   | CUnsigType   a
+@@ -1028,6 +1029,7 @@ instance CNode t1 => CNode (CTypeSpecifier t1) where
+         nodeInfo (CIntType d) = nodeInfo d
+         nodeInfo (CLongType d) = nodeInfo d
+         nodeInfo (CFloatType d) = nodeInfo d
++        nodeInfo (CFloat128Type d) = nodeInfo d
+         nodeInfo (CDoubleType d) = nodeInfo d
+         nodeInfo (CSignedType d) = nodeInfo d
+         nodeInfo (CUnsigType d) = nodeInfo d
+@@ -1050,6 +1052,7 @@ instance Functor CTypeSpecifier where
+         fmap _f (CIntType a1) = CIntType (_f a1)
+         fmap _f (CLongType a1) = CLongType (_f a1)
+         fmap _f (CFloatType a1) = CFloatType (_f a1)
++        fmap _f (CFloat128Type a1) = CFloat128Type (_f a1)
+         fmap _f (CDoubleType a1) = CDoubleType (_f a1)
+         fmap _f (CSignedType a1) = CSignedType (_f a1)
+         fmap _f (CUnsigType a1) = CUnsigType (_f a1)
+@@ -1070,6 +1073,7 @@ instance Annotated CTypeSpecifier where
+         annotation (CIntType n) = n
+         annotation (CLongType n) = n
+         annotation (CFloatType n) = n
++        annotation (CFloat128Type n) = n
+         annotation (CDoubleType n) = n
+         annotation (CSignedType n) = n
+         annotation (CUnsigType n) = n
+@@ -1088,6 +1092,7 @@ instance Annotated CTypeSpecifier where
+         amap f (CIntType a_1) = CIntType (f a_1)
+         amap f (CLongType a_1) = CLongType (f a_1)
+         amap f (CFloatType a_1) = CFloatType (f a_1)
++        amap f (CFloat128Type a_1) = CFloat128Type (f a_1)
+         amap f (CDoubleType a_1) = CDoubleType (f a_1)
+         amap f (CSignedType a_1) = CSignedType (f a_1)
+         amap f (CUnsigType a_1) = CUnsigType (f a_1)



More information about the arch-commits mailing list