[GHC] #10044: Wrong line number reported with CPP and line beginning with #

#10044: Wrong line number reported with CPP and line beginning with # -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- If I compile {{{ {-# LANGUAGE CPP #-} module Bug where {- # hi there! -} * }}} I'm told of a parse error for the `*` on line 10. But that `*` is line 9! The problem is that, with `CPP` on, the line number counter gets confused if a line begins with a #, perhaps after whitespace. I actually hit this and was confused in real code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10044 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10044: Wrong line number reported with CPP and line beginning with # -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton): Looks like a bug in clang's C preprocessor (I get the expected behavior with gcc's): {{{ rwbarton@morphism:/tmp$ clang -E -x assembler-with-cpp Bug.hs # 1 "Bug.hs" # 1 "<built-in>" 1 # 1 "Bug.hs" 2 {-# LANGUAGE CPP #-} module Bug where {- # hi there! -} * }}} Why did it add a blank line after `# hi there!`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10044#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10044: Wrong line number reported with CPP and line beginning with # -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc2 Resolution: | Keywords: cpp Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by hvr): * keywords: => cpp -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10044#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10044: Wrong line number reported with CPP and line beginning with # -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc2 Resolution: | Keywords: cpp Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by gridaphobe): * cc: gridaphobe (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10044#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10044: Wrong line number reported with CPP and line beginning with # -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc2 Resolution: | Keywords: cpp, clang Operating System: MacOS X | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * keywords: cpp => cpp, clang * os: Unknown/Multiple => MacOS X -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10044#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC