[commit: hsc2hs] master: Fix error when cross-compiling during GHC build. (a281856)

git at git.haskell.org git at git.haskell.org
Sun Apr 5 19:58:16 UTC 2015


Repository : ssh://git@git.haskell.org/hsc2hs

On branch  : master
Link       : http://git.haskell.org/hsc2hs.git/commitdiff/a281856375beaf9082010c445599446faad6beb9

>---------------------------------------------------------------

commit a281856375beaf9082010c445599446faad6beb9
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Fri Apr 3 19:38:32 2015 +1100

    Fix error when cross-compiling during GHC build.
    
    When `hsc2hs` is built and used in the GHC build process and GHC
    is being built as a cross compiler, the build process calls `hsc2hs`
    with `--cflag=-Werror=unused-but-set-variable` but some of the
    generated code failed with this error turned on.
    
    Closes: https://ghc.haskell.org/trac/ghc/ticket/10237


>---------------------------------------------------------------

a281856375beaf9082010c445599446faad6beb9
 CrossCodegen.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CrossCodegen.hs b/CrossCodegen.hs
index bb275ff..c1d627d 100644
--- a/CrossCodegen.hs
+++ b/CrossCodegen.hs
@@ -544,9 +544,9 @@ runCompileBooleanTest (ZCursor s above below) booleanTest = do
                (concatMap outHeaderCProg' above) ++
                outHeaderCProg' s ++
                -- the test
-               "void _hsc2hs_test() {\n" ++
+               "int _hsc2hs_test() {\n" ++
                "  static int test_array[1 - 2 * !(" ++ booleanTest ++ ")];\n" ++
-               "  test_array[0] = 0;\n" ++
+               "  return test_array[0];\n" ++
                "}\n" ++
                (concatMap outHeaderCProg' below)
     runCompileTest test



More information about the ghc-commits mailing list