Commit 2ee1db60 authored by rcook's avatar rcook Committed by Ben Gamari
Browse files

Fixes #12504: Double-escape paths used to build call to hsc_line

In outHsLine, paths passed to construct invocations of hsc_line must be
escaped twice in order to generate a properly escaped string literal
that will end up in the eventual LINE pragma emitted by this code. This
is especially important on Windows paths, where backslashes would
otherwise be treated as C escape sequences and result in the incorrect
Windows paths.

Adds test case to verify that hsc2hs properly escapes file paths in LINE

Updates the hsc2hs submodule.


Reviewers: erikd, hvr, austin, bgamari, Phyx

Reviewed By: erikd, Phyx

Subscribers: thomie, Phyx, mpickering

Differential Revision:

GHC Trac Issues: #12504
parent ef784c55
......@@ -790,6 +790,7 @@ mk/ghcconfig*_test___spaces_ghc*
......@@ -40,3 +40,14 @@ T10272:
'$(HSC2HS)' --cross-compile $@.hsc
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@
.PHONY: T12504
'$(HSC2HS)' T12504/path/to/$@.hsc
ifeq "$(WINDOWS)" "YES"
grep '{-# LINE 1 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs
grep '{-# LINE 2 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs
grep '{-# LINE 1 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs
grep '{-# LINE 2 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs
{-# LINE 1 "T12504/path/to/T12504.hsc" #-}
{-# LINE 2 "T12504/path/to/T12504.hsc" #-}
module Main (main) where
main :: IO ()
main = putStrLn "hello world"
......@@ -35,3 +35,9 @@ test('T10272',
[extra_clean(['T10272.hs', 'T10272_hsc_make.c'])],
['$MAKE -s --no-print-directory T10272'])
['$MAKE -s --no-print-directory T12504'])
Subproject commit 5119aebacaca75d983b4d7db32a6305b7f8651dd
Subproject commit f5ae016e5a69ebf42d612805e51afd9227df9389
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment