Commit b51510d9 authored by Clint Adams's avatar Clint Adams
Browse files

language-c: Upgrading from 0.6.1 to 0.7.1

parent 09d17269
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
haskell-language-c (0.6.1-3) UNRELEASED; urgency=medium
haskell-language-c (0.7.1-1) unstable; urgency=medium

  [ Ilias Tsitsimpis ]
  * Change Priority to optional. Since Debian Policy version 4.0.1,
    priority extra has been deprecated.
  * Use the HTTPS form of the copyright-format URL
  * Modify d/watch and Source field in d/copyright to use HTTPS
  * Declare compliance with Debian policy 4.1.1

 -- Ilias Tsitsimpis <iliastsi@debian.org>  Wed, 01 Nov 2017 12:14:37 +0200
  [ Clint Adams ]
  * New upstream release

 -- Clint Adams <clint@debian.org>  Tue, 23 Jan 2018 20:33:52 -0500

haskell-language-c (0.6.1-2) unstable; urgency=medium

+0 −177
Original line number Diff line number Diff line
From 2021974d7eb48d71a66b1d235287ab83ef1ee2a5 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i@maskray.me>
Date: Sun, 30 Jul 2017 23:34:20 -0700
Subject: [PATCH] Add `__float128` (#33)

* 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

* Update `__float128` tests in parse_dg
---
 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 +++++
 test/harness/parse_dg/expect_fail.txt  | 17 -----------------
 test/harness/parse_dg/expect_parse.txt | 17 +++++++++++++++++
 8 files changed, 33 insertions(+), 21 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 c176b01..bb18f89 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?\.@hexdigits|@hexdigits\.
 @binexp    = [pP][\+\-]?@digits
 
-@floatsuffix    = [fFlL]
+-- Suffixes `qQwW` are GNU floating type extensions: <https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html>
+@floatsuffix    = [fFlLqQwW]
 @floatgnusuffix = @floatsuffix@gnusuffix?|@gnusuffix@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 895cda2..517892b 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 d40f605..ed778e3 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 2fbe4c4..ce98cf3 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)
+0 −1
Original line number Diff line number Diff line
2021974d7eb48d71a66b1d235287ab83ef1ee2a5.patch