[GHC] #13844: Surprising behavior with CPP extension

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[GHC] #13844: Surprising behavior with CPP extension

GHC - devs mailing list
#13844: Surprising behavior with CPP extension
-------------------------------------+-------------------------------------
           Reporter:  deech          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The CPP language extension performs macro substitutions in Haskell
 comments. I see why it does but it seems like eliding the comments before
 pre-processing would be less surprising. Eg. compiling:

 {{{#!hs
 {-# LANGUAGE CPP -#}

 -- | Some folder foo/bar/*
 }}}

 gives the error:
 {{{
 error: unterminated comment
 -- | Some folder foo/bar/*
 }}}

 because the `/*` in the comment is interpreted as starting a C comment.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13844: Surprising behavior with CPP extension

GHC - devs mailing list
#13844: Surprising behavior with CPP extension
-------------------------------------+-------------------------------------
        Reporter:  deech             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 Mmm, this is unfortunate. Eliding comments prior to pre-processing is not
 trivial but could be done. We would need a simple parser which would also
 produce `#line` pragmas to ensure that line information is correct in the
 post-CPP parse.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13844: Surprising behavior with CPP extension

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13844: Surprising behavior with CPP extension
-------------------------------------+-------------------------------------
        Reporter:  deech             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by pggiarrusso):

 Docs for cpphs say "Macros are never expanded within Haskell comments":
 http://projects.haskell.org/cpphs/#diff. Any chance that helps?

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13844: Surprising behavior with CPP extension

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13844: Surprising behavior with CPP extension
-------------------------------------+-------------------------------------
        Reporter:  deech             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 `cpphs` works very differently than `cpp` internally, so I'd be surprised
 if the techniques that `cpphs` are using to accomplish that would be
 applicable to `cpp`.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #13844: Surprising behavior with CPP extension

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13844: Surprising behavior with CPP extension
-------------------------------------+-------------------------------------
        Reporter:  deech             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hvr):

 Fwiw, this is old news. Here's an old proposal of mine that could lead us
 out of this misery: Proposal/NativeCpp

 Just needs somebody to implement it... :-)

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets