Skip to content

Commit

Permalink
GHC 9.10 compat in testsuite: CPP symbols don't get passed to CC as
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses4ever committed May 28, 2024
1 parent 72fdfba commit 9ee65a0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
8 changes: 0 additions & 8 deletions cabal-testsuite/PackageTests/CCompilerOverride/foo.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@

#ifndef NOERROR1
#error "NOERROR1 was not passed"
#endif

#ifndef NOERROR2
#error "NOERROR2 was not passed"
#endif

#ifndef NOERROR3
#error "NOERROR3 was not passed"
#endif

#ifndef NOERROR4
#error "NOERROR4 was not passed"
#endif
Expand Down
2 changes: 1 addition & 1 deletion cabal-testsuite/PackageTests/CCompilerOverride/my.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ executable foo
main-is: Main.hs
c-sources: foo.c
build-depends: base
ghc-options: -DNOERROR4
ghc-options: -optc=-DNOERROR4
cc-options: -DNOERROR5 -march=native
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Setup configure
Configuring my-0.1...
Warning: [misplaced-c-opt] Instead of 'ghc-options: -DNOERROR4' use 'cpp-options: -DNOERROR4'
# Setup build
1 change: 0 additions & 1 deletion cabal-testsuite/PackageTests/CCompilerOverride/setup.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Setup configure
Configuring my-0.1...
Warning: [misplaced-c-opt] Instead of 'ghc-options: -DNOERROR4' use 'cpp-options: -DNOERROR4'
# Setup build
8 changes: 5 additions & 3 deletions cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import Test.Cabal.Prelude
-- Test that all the respective defines -DNOERROR... specified in various ways
-- all end up routed to the C compiler. Otherwise the C file we depend on will
-- not compile.
--
-- This has been largely gutted, as ghc 9.10 no longer passes through most
-- of the defines we were testing; see
-- https://gitlab.haskell.org/ghc/ghc/-/commit/8ff3134ed4aa323b0199ad683f72165e51a59ab6
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 8.8"
isWin <- isWindows
Expand All @@ -14,9 +18,7 @@ main = setupAndCabalTest $ do
pwd ++ "/custom-cc" ++ if isWin then win_suffix else ""

setup "configure"
[ "--ghc-option=-DNOERROR1"
, "--ghc-option=-optc=-DNOERROR2"
, "--ghc-option=-optP=-DNOERROR3"
[ "--ghc-option=-optc=-DNOERROR2"
, "--with-gcc=" ++ customCC
]
setup "build" ["-v2"]

0 comments on commit 9ee65a0

Please sign in to comment.