#7430: GHC API reports CPP errors in confusing ways
----------------------------+-----------------------------------------------
Reporter:  MikolajKonarski  |          Owner:                  
    Type:  bug              |         Status:  new             
Priority:  normal           |      Component:  GHC API         
 Version:  7.6.1            |       Keywords:                  
      Os:  Linux            |   Architecture:  Unknown/Multiple
 Failure:  Other            |      Blockedby:                  
Blocking:                   |        Related:                  
----------------------------+-----------------------------------------------
 When there is a CPP error, the GHC API provides a normal error message
 (such as in case of type errors), e.g.,
 {{{
 error: missing binary operator before token "("
 }}}
 but it does not say it's a CPP error. In addition (and unlike for type
 errors), GHC API throws an exception, e.g.,
 {{{
 phase `C pre-processor' failed (exitcode = 1)
 }}}
 which states the error comes from CPP, but is otherwise uninformative and
 not tied in any way to the normal error message.

 Ideally, all the information would be in the error message and the
 exception that disrupts the normal control flow would not be thrown.

 Here's how to reproduce this: in the following repo (uh, just realised
 it's a rather large repo)
 {{{
 https://github.com/Mikolaj/ghc/tree/CPPrunGhc
 }}}
 run
 {{{
 ghc --make GhcRun.hs -package ghc-7.6.1
 }}}
 and then
 {{{
 ./GhcRun
 }}}
 You should get
 {{{
 Normal error message:
 Severity: SevError  SrcSpan: RealSrcSpan (SrcSpanPoint {srcSpanFile =
 "Ticks.hs", srcSpanLine = 1, srcSpanCol = 0})  MsgDoc:  error: missing
 binary operator before token "("

 Exception:
 GhcRun: phase `C pre-processor' failed (exitcode = 1)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7430>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to