malcolmwallace / cpphs

The C pre-processor, implemented in Haskell.
2 stars 0 forks source link

cpphs fails to parse an `#if` directive #26

Open coot opened 2 years ago

coot commented 2 years ago

The code is compiled with:

   cpp-options: -DMIN_VERSION_GHC(x,y)=MIN_VERSION_GLASGOW_HASKELL(x,y,0,0)

And cpphs trips over

#if !MIN_VERSION_GHC(8,10)

(ref), with the following error:

cpphs: Cannot parse #if directive in file lib/GhcTags/Ghc.hs  at line 5 col 1:
    expected ) got *
CallStack (from HasCallStack):

  error, called at ./Language/Preprocessor/Cpphs/CppIfdef.hs:192:0: error:
Error:     28 in main:Language.Preprocessor.Cpphs.CppIfdef
cpphs: Cannot parse #if directive in file lib/GhcTags/Tag.hs  at line 52 col 1:
    expected ) got *
CallStack (from HasCallStack):

  error, called at ./Language/Preprocessor/Cpphs/CppIfdef.hs:192:0: error:
Error:     28 in main:Language.Preprocessor.Cpphs.CppIfdef

lib/GhcTags/Ghc.hs:1:1: error:
Error:     `cpphs' failed in phase `C pre-processor'. (Exit code: 1)
  |
1 | {-# LANGUAGE CPP                 #-}
  | ^

lib/GhcTags/Tag.hs:1:1: error:
Error:     `cpphs' failed in phase `C pre-processor'. (Exit code: 1)
  |
1 | {-# LANGUAGE CPP                 #-}
  | ^
Error: cabal: Failed to build ghc-tags-core-0.4.1.0 (which is required by
exe:gtp-check from ghc-tags-plugin-0.5.1.0 and test:test from
ghc-tags-core-0.4.1.0).

Here's CI log: https://github.com/coot/ghc-tags-plugin/actions/runs/3085403434/jobs/4988652786#step:15:1