[GHC] #4931: hsc2hs emits invalid OPTIONS_GHC pragmas

GHC ghc-devs at haskell.org
Fri Oct 31 17:08:32 UTC 2014


#4931: hsc2hs emits invalid OPTIONS_GHC pragmas
-------------------------------------+-------------------------------------
              Reporter:  awson       |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  low         |        Milestone:  7.10.1
             Component:  hsc2hs      |          Version:  7.0.1
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * difficulty:   => Unknown


Comment:

 There are 2 possible solutions:

 * in hsc2hs, ignore `#define NAME VALUE` when `VALUE` contains a space.
 This could be done in the function `outHeaderHs` in `utils/hsc2hs/C.hs` as
 mentioned by @awson. I'm not sure this is good idea (wouldn't an error be
 better?), but note that #defines where `NAME` contains a `'('` are
 currently also ignored.

 * when using the OPTIONS pragma `-Dsymbol=value`, accept spaces inside
 `value` when `value` is quoted. This would need to be done in the function
 `getOptions'` in `compiler/main/HeaderInfo.hs`, by changing `(words str)`
 to something more complicated. Note that GHC already accepts spaces in
 `value` when the option is passed as a command line argument: `-D'"FOO
 BAR"'`

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


More information about the ghc-tickets mailing list