[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 23:00:31 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 Rufflewind):

 > What do you mean by "masks the problem"?

 As in it will only hide the problem when the column number is obviously
 wrong (exceeds the length of the original line).

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

 I think gcc has some internal magic with its cpp (and same for clang).  If
 you compile using `gcc -E wat.c | gcc -x c -` you will run into exactly
 the same bug here.

 {{{
 wat.c: In function ‘main’:
 wat.c:4:12: warning: return makes integer from pointer without a cast
 [-Wint-conversion]
      FOO
             ^
 }}}

 cpp simply does not provide ghc with adequate line information to
 determine the correct column.

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


More information about the ghc-tickets mailing list