[GHC] #8869: External preprocessor not used after TH name quote

#8869: External preprocessor not used after TH name quote ----------------------------------+-------------------------- Reporter: myrix | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Keywords: | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: Other Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ----------------------------------+-------------------------- Module {{{ {-# LANGUAGE CPP, TemplateHaskell #-} module Main where main = do putStrLn $ show 'id putStrLn __FILE__ }}} fails to compile with external preprocessor: {{{
ghc -pgmP cpphs -optP --cpp Main.hs [1 of 1] Compiling Main ( Main.hs, Main.o )
Main.hs:7:12: Not in scope: `__FILE__' }}} {{{__FILE__}}} is not expanded: {{{
ghc -E -pgmP cpphs -optP --cpp Main.hs cat Main.hspp {-# LINE 1 "Main.hs" #-} #line 1 "Main.hs" {-# LANGUAGE CPP, TemplateHaskell #-}
module Main where main = do putStrLn $ show 'id putStrLn __FILE__ }}} Without external preprocessor (just {{{ghc Main.hs}}}) module compiles successfully. Move name quote after {{{__FILE__}}}, like this: {{{ {-# LANGUAGE CPP, TemplateHaskell #-} module Main where main = do putStrLn __FILE__ putStrLn $ show 'id }}} and it work with external preprocessor just fine: {{{
ghc -pgmP cpphs -optP --cpp Main.hs [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... ./Main Main.hs GHC.Base.id }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8869 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8869: External preprocessor not used after TH name quote -----------------------------+---------------------------------- Reporter: myrix | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Resolution: invalid | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Other | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -----------------------------+---------------------------------- Changes (by simonpj): * status: new => closed * resolution: => invalid Comment: I suspect that cpp treats the `'id` as opening a quotation, and doesn't interpret the __FILE__ inside that quote. So this isn't a bug in GHC, more just that cpp isn't doing what you want. Reopen if you think it's a bug in GHC Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8869#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC