packages feed

aihc-cpp 1.0.0.1 → 1.0.0.2

raw patch · 51 files changed

+286/−67 lines, 51 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -6,6 +6,15 @@  ## [Unreleased] +## [1.0.0.2] - 2026-05-27++### Fixed++- Removed the internal `cpp-progress` executable from the published Cabal+  package so Hackage lists `aihc-cpp` as library-only.+- Included the CPP progress fixtures in the source distribution so Hackage can+  run the package test suite and report coverage.+ ## [1.0.0.1] - 2026-05-27  ### Fixed
aihc-cpp.cabal view
@@ -1,10 +1,15 @@ cabal-version: 3.8 name: aihc-cpp-version: 1.0.0.1+version: 1.0.0.2 build-type: Simple license: Unlicense license-file: LICENSE extra-doc-files: CHANGELOG.md+extra-source-files:+  test/Test/Fixtures/progress/*.hs+  test/Test/Fixtures/progress/*.tsv+  test/Test/Fixtures/progress/includes/*.inc+ author: David Himmelstrup maintainer: lemmih@gmail.com category: Development@@ -63,29 +68,6 @@     tasty >=1.5 && <1.6,     tasty-hunit >=0.10 && <0.11,     tasty-quickcheck >=0.11.1 && <0.12,-    text >=1.2 && <2.2,--  ghc-options: -Wall-  default-language: Haskell2010--executable cpp-progress-  scope: private-  hs-source-dirs:-    app/cpp-progress-    test--  main-is: Main.hs-  other-modules:-    Test.Progress--  build-depends:-    aihc-cpp >=1.0 && <1.1,-    base >=4.16 && <5,-    bytestring >=0.10.8 && <0.13,-    containers >=0.5 && <0.8,-    cpphs >=1.20 && <1.21,-    directory >=1.2.3 && <1.5,-    filepath >=1.3.0.1 && <1.6,     text >=1.2 && <2.2,    ghc-options: -Wall
− app/cpp-progress/Main.hs
@@ -1,43 +0,0 @@-module Main (main) where--import System.Environment (getArgs)-import System.Exit (exitFailure, exitSuccess)-import Test.Progress (CaseMeta (..), Outcome (..), evaluateCase, loadManifest, progressSummary)--main :: IO ()-main = do-  args <- getArgs-  let strict = "--strict" `elem` args-  cases <- loadManifest-  outcomes <- mapM evaluateCase cases-  let (passN, xfailN, xpassN, failN) = progressSummary outcomes-      totalN = passN + xfailN + xpassN + failN-      completion = pct (passN + xpassN) totalN-  putStrLn "Haskell CPP preprocessor progress"-  putStrLn "==============================="-  putStrLn ("PASS      " <> show passN)-  putStrLn ("XFAIL     " <> show xfailN)-  putStrLn ("XPASS     " <> show xpassN)-  putStrLn ("FAIL      " <> show failN)-  putStrLn ("TOTAL     " <> show totalN)-  putStrLn ("COMPLETE  " <> show completion <> "%")--  mapM_ printFail [(m, d) | (m, OutcomeFail, d) <- outcomes]-  mapM_ printXPass [(m, d) | (m, OutcomeXPass, d) <- outcomes]--  if failN == 0 && (not strict || xpassN == 0)-    then exitSuccess-    else exitFailure--printFail :: (CaseMeta, String) -> IO ()-printFail (meta, details) =-  putStrLn ("FAIL " <> caseId meta <> " [" <> caseCategory meta <> "] " <> details)--printXPass :: (CaseMeta, String) -> IO ()-printXPass (meta, details) =-  putStrLn ("XPASS " <> caseId meta <> " [" <> caseCategory meta <> "] " <> details)--pct :: Int -> Int -> Double-pct done totalN-  | totalN <= 0 = 0.0-  | otherwise = fromIntegral (done * 10000 `div` totalN) / 100.0
+ test/Test/Fixtures/progress/comment-stripping-c89.hs view
@@ -0,0 +1,3 @@+{- haskell comment - should be kept -}+/* C89 comment - should be stripped */+// eol comment - should be kept
+ test/Test/Fixtures/progress/define-basic.hs view
@@ -0,0 +1,2 @@+#define FOO answer+FOO
+ test/Test/Fixtures/progress/elseif-branch.hs view
@@ -0,0 +1,8 @@+#define X 1+#if 0+none+#elif X+yes+#else+no+#endif
+ test/Test/Fixtures/progress/endif-balance.hs view
@@ -0,0 +1,4 @@+#define FLAG 1+#ifdef FLAG+ok+#endif
+ test/Test/Fixtures/progress/error-directive.hs view
@@ -0,0 +1,2 @@+#error this is an error+value
+ test/Test/Fixtures/progress/function-macro-basic.hs view
@@ -0,0 +1,2 @@+#define ADD(x,y) x + y+ADD(1, 2)
+ test/Test/Fixtures/progress/function-macro-c-block-comment.hs view
@@ -0,0 +1,2 @@+#define WRAP(x) x /* keep spacing */ + x+f = WRAP(1)
+ test/Test/Fixtures/progress/function-macro-guard-patterns.hs view
@@ -0,0 +1,8 @@+#define GUARD(WORD) (size - 1) <= fromIntegral (maxBound :: WORD)+#define PUTSUM(WORD) GUARD(WORD) = putSum (0 :: WORD) (fromIntegral size)+#define GETSUM(WORD) GUARD(WORD) = (get :: Get WORD) >>= checkGetSum (fromIntegral size)++instance ( PutSum        a, PutSum        b+         , SumSize       a, SumSize       b) => GSerializePut (a :+: b) where+    gPut | PUTSUM(Word8) | PUTSUM(Word16) | PUTSUM(Word32) | PUTSUM(Word64)+         | otherwise = sizeError "encode" size
+ test/Test/Fixtures/progress/hpp-file-macro-string-pattern.hs view
@@ -0,0 +1,7 @@+{-# LANGUAGE LambdaCase #-}++f = \case+  "__FILE__" -> "literal __FILE__ should stay untouched"+  x -> x++g = __FILE__
+ test/Test/Fixtures/progress/if-arithmetic.hs view
@@ -0,0 +1,5 @@+#if (2 + 3 * 4) == 14+ok+#else+bad+#endif
+ test/Test/Fixtures/progress/if-boolean-and.hs view
@@ -0,0 +1,6 @@+#define A 1+#if A && 1+yes+#else+no+#endif
+ test/Test/Fixtures/progress/if-comparison.hs view
@@ -0,0 +1,5 @@+#if 4 >= 3+ok+#else+bad+#endif
+ test/Test/Fixtures/progress/if-defined-bare.hs view
@@ -0,0 +1,6 @@+#define FEATURE 1+#if defined FEATURE+bare-defined+#else+missing+#endif
+ test/Test/Fixtures/progress/if-defined-paren.hs view
@@ -0,0 +1,6 @@+#define FEATURE 1+#if defined(FEATURE)+paren-defined+#else+missing+#endif
+ test/Test/Fixtures/progress/ifdef-true.hs view
@@ -0,0 +1,6 @@+#define FLAG 1+#ifdef FLAG+enabled+#else+disabled+#endif
+ test/Test/Fixtures/progress/ifndef-true.hs view
@@ -0,0 +1,5 @@+#ifndef FLAG+enabled+#else+disabled+#endif
+ test/Test/Fixtures/progress/include-basic.hs view
@@ -0,0 +1,3 @@+root-start+#include "includes/value.inc"+root-end
+ test/Test/Fixtures/progress/includes/value.inc view
@@ -0,0 +1,2 @@+#define VALUE included+VALUE
+ test/Test/Fixtures/progress/indented-hash-operator.hs view
@@ -0,0 +1,2 @@+f = (d+    # reflectY)
+ test/Test/Fixtures/progress/isndef-alias.hs view
@@ -0,0 +1,5 @@+#isndef FEATURE+missing+#else+present+#endif
+ test/Test/Fixtures/progress/language-pragma-closing-line.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE+    DataKinds+  , DeriveGeneric+  , OverloadedStrings+#-}++module Example where++x :: Int+x = 1
+ test/Test/Fixtures/progress/line-directive-file-and-number.hs view
@@ -0,0 +1,6 @@+#line 200 "generated.hs"+__LINE__+__FILE__+#line 42 "rewritten.hs"+__LINE__+__FILE__
+ test/Test/Fixtures/progress/line-directive-number-only.hs view
@@ -0,0 +1,3 @@+#line 123+__LINE__+__FILE__
+ test/Test/Fixtures/progress/macro-c-block-comment-literal.hs view
@@ -0,0 +1,4 @@+#define HET 0x68657462 /* 'h' 'e' 't' 'b' */+f x = case x of+  HET -> ()+  _ -> ()
+ test/Test/Fixtures/progress/macro-comment-replacement.hs view
@@ -0,0 +1,3 @@+#  define DEBUG_TRACE(s)    {- nothing -}+DEBUG_TRACE+  (id)
+ test/Test/Fixtures/progress/macro-expansion-not-in-string.hs view
@@ -0,0 +1,3 @@+#define HELLO world+HELLO+"HELLO"
+ test/Test/Fixtures/progress/macro-expansion.hs view
@@ -0,0 +1,3 @@+#define A B+#define B C+A
+ test/Test/Fixtures/progress/macro-in-comment-with-line-comment-marker.hs view
@@ -0,0 +1,6 @@+#define A 1+{-+-- line comment marker inside block comment+#define B 2+-}+A B
+ test/Test/Fixtures/progress/macro-in-comment.hs view
@@ -0,0 +1,5 @@+#define A 1+{-+#define B 2+-}+A B
+ test/Test/Fixtures/progress/macro-in-inline-block-comment.hs view
@@ -0,0 +1,3 @@+#define A 1+#define B 2+A {- B -} B
+ test/Test/Fixtures/progress/macro-in-line-comment.hs view
@@ -0,0 +1,4 @@+#define A 1+#define B 2+A -- B+B
+ test/Test/Fixtures/progress/macro-multiline-args.hs view
@@ -0,0 +1,5 @@+#define DEBUG(s) {- -}++DEBUG("line1" +++      "line2" +++      "line3")
+ test/Test/Fixtures/progress/macro-multiline-string-comma.hs view
@@ -0,0 +1,8 @@+#define DEBUG_TRACE(s) {- nothing -}++happyDoAction i tk st =+  DEBUG_TRACE("state: " ++ show st +++              ", token: " ++ show i +++              ", action: ")+  case action of+    Done -> done
+ test/Test/Fixtures/progress/macro-multiline-string-parens.hs view
@@ -0,0 +1,6 @@+#define DEBUG_TRACE(s) {- nothing -}++happySimulateReduce r st sts =+  DEBUG_TRACE("simulate reduction of rule " ++ show r ++ ", (nested)")+  let result = reduce r st sts+  in result
+ test/Test/Fixtures/progress/macro-name-in-string.hs view
@@ -0,0 +1,3 @@+#define X 123+X+"X"
+ test/Test/Fixtures/progress/manifest.tsv view
@@ -0,0 +1,47 @@+# id	category	path	expected	reason+define-basic	macro	define-basic.hs	pass+undef-basic	macro	undef-basic.hs	pass+macro-expansion	macro	macro-expansion.hs	pass+include-basic	include	include-basic.hs	pass+ifdef-true	conditionals	ifdef-true.hs	pass+ifndef-true	conditionals	ifndef-true.hs	pass+if-boolean-and	conditionals	if-boolean-and.hs	pass+if-arithmetic	conditionals	if-arithmetic.hs	pass+if-comparison	conditionals	if-comparison.hs	pass+elseif-branch	conditionals	elseif-branch.hs	pass+warning-directive	diagnostics	warning-directive.hs	pass+error-directive	diagnostics	error-directive.hs	pass+isndef-alias	conditionals	isndef-alias.hs	pass+endif-balance	conditionals	endif-balance.hs	pass+pkg-ad	pkg	pkg-ad.hs	pass+multiline-define	macro	multiline-define.hs	pass+multiline-define-long	macro	multiline-define-long.hs	pass+if-defined-paren	conditionals	if-defined-paren.hs	pass+if-defined-bare	conditionals	if-defined-bare.hs	pass+nested-if-blocks	conditionals	nested-if-blocks.hs	pass+predefined-line-file	macro	predefined-line-file.hs	pass+function-macro-basic	macro	function-macro-basic.hs	pass+function-macro-guard-patterns	macro	function-macro-guard-patterns.hs	pass+line-directive-file-and-number	diagnostics	line-directive-file-and-number.hs	pass+line-directive-number-only	diagnostics	line-directive-number-only.hs	pass+language-pragma-closing-line	lexing	language-pragma-closing-line.hs	pass+indented-hash-operator	lexing	indented-hash-operator.hs	pass+macro-in-comment	lexing	macro-in-comment.hs	pass+macro-in-inline-block-comment	lexing	macro-in-inline-block-comment.hs	pass+macro-in-line-comment	lexing	macro-in-line-comment.hs	pass+macro-in-comment-with-line-comment-marker	lexing	macro-in-comment-with-line-comment-marker.hs	pass+unterminated-string-in-comment	lexing	unterminated-string-in-comment.hs	pass+comment-stripping-c89	lexing	comment-stripping-c89.hs	pass+predefined-in-string	macro	predefined-in-string.hs	pass+macro-name-in-string	macro	macro-name-in-string.hs	pass+macro-expansion-not-in-string	macro	macro-expansion-not-in-string.hs	pass+hpp-file-macro-string-pattern	macro	hpp-file-macro-string-pattern.hs	pass+rules-pragma-cpp-branch	lexing	rules-pragma-cpp-branch.hs	pass+macro-multiline-args	macro	macro-multiline-args.hs	pass+macro-multiline-string-comma	macro	macro-multiline-string-comma.hs	pass+macro-multiline-string-parens	macro	macro-multiline-string-parens.hs	pass+stringify-paste-pair	macro	stringify-paste-pair.hs	pass+macro-comment-replacement	macro	macro-comment-replacement.hs	pass+thyme-lens-comment-paste	macro	thyme-lens-comment-paste.hs	pass+macro-c-block-comment-literal	macro	macro-c-block-comment-literal.hs	pass+function-macro-c-block-comment	macro	function-macro-c-block-comment.hs	pass
+ test/Test/Fixtures/progress/multiline-define-long.hs view
@@ -0,0 +1,7 @@+#define LONG_MACRO \+    first line \+    second line \+    third line++main = do+    putStrLn LONG_MACRO
+ test/Test/Fixtures/progress/multiline-define.hs view
@@ -0,0 +1,3 @@+#define FOO 1 \+            + 2+main = print FOO
+ test/Test/Fixtures/progress/nested-if-blocks.hs view
@@ -0,0 +1,12 @@+#define OUTER 1+#define INNER 1+#if OUTER+outer-true+#if INNER+inner-true+#else+inner-false+#endif+#else+outer-false+#endif
+ test/Test/Fixtures/progress/pkg-ad.hs view
@@ -0,0 +1,6 @@+#define MODULE \+module Numeric.AD.Internal.Kahn.Double+#define IMPORTS+#define AD_EXPORT KahnDouble(..)+#define AD_TYPE KahnDouble+#define SCALAR_TYPE Double
+ test/Test/Fixtures/progress/predefined-in-string.hs view
@@ -0,0 +1,4 @@+"__FILE__"+"__LINE__"+__FILE__+__LINE__
+ test/Test/Fixtures/progress/predefined-line-file.hs view
@@ -0,0 +1,2 @@+__LINE__+__FILE__
+ test/Test/Fixtures/progress/rules-pragma-cpp-branch.hs view
@@ -0,0 +1,16 @@+{-# RULES++"enumFromTo<Int> [Bundle]"+  enumFromTo = enumFromTo_int :: Monad m => Int -> Int -> Bundle m v Int++#if WORD_SIZE_IN_BITS > 32++"enumFromTo<Int64> [Bundle]"+  enumFromTo = enumFromTo_intlike :: Monad m => Int64 -> Int64 -> Bundle m v Int64    #-}++#else++"enumFromTo<Int32> [Bundle]"+  enumFromTo = enumFromTo_intlike :: Monad m => Int32 -> Int32 -> Bundle m v Int32    #-}++#endif
+ test/Test/Fixtures/progress/stringify-paste-pair.hs view
@@ -0,0 +1,2 @@+#define PAIR(a,b) (# a, b #)+PAIR(a,b)
+ test/Test/Fixtures/progress/thyme-lens-comment-paste.hs view
@@ -0,0 +1,3 @@+#define LENS(S,F,A) {-# INLINE _/**/F #-}; _/**/F :: LensP S A; _/**/F = lens F $ \ S {..} F/**/_ -> S {F = F/**/_, ..}+LENS(Foo,bar,Baz)+LENS(Foo,bar,Baz{-comment-})
+ test/Test/Fixtures/progress/undef-basic.hs view
@@ -0,0 +1,3 @@+#define FOO answer+#undef FOO+FOO
+ test/Test/Fixtures/progress/unterminated-string-in-comment.hs view
@@ -0,0 +1,3 @@+#define A 1+{- " -}+A
+ test/Test/Fixtures/progress/warning-directive.hs view
@@ -0,0 +1,2 @@+#warning this is a warning+value