[GHC] #14113: Error message carets point at the wrong places in the presence of CPP macros

GHC ghc-devs at haskell.org
Mon Aug 14 22:32:24 UTC 2017


#14113: Error message carets point at the wrong places in the presence of CPP
macros
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Replying to [comment:1 Rufflewind]:
 > One could prevent the caret from pointing past the actual line, but that
 only masks the problem under certain circumstances.

 What do you mean by "masks the problem"?

 I'd be content with a solution similar to how `gcc` handles CPP macros
 when displaying carets:

 {{{#!c
 #define FOO return "wat";

 int main() {
   FOO
 }
 }}}

 {{{
 $ gcc wat.c
 wat.c: In function ‘main’:
 wat.c:1:20: warning: return makes integer from pointer without a cast
 [-Wint-conversion]
  #define FOO return "wat";
                     ^
 wat.c:4:3: note: in expansion of macro ‘FOO’
    FOO
    ^~~
 }}}

 But I'm not familiar with how tightly integrated `gcc` and `cpp` are (as
 opposed to GHC and `cpp`).

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14113#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list