diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-11-11 11:05:16 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-11-11 11:05:16 +0100 |
commit | fbc2537c0b2cbe947684bb39669643f1ef9d96c0 (patch) | |
tree | 2d8a8f0e78e4109437c615986e2e88b1ff78e61b /compiler/main | |
parent | 5eb56eddaaa7bef3da864f6cd297bad39d6bf76c (diff) | |
download | haskell-fbc2537c0b2cbe947684bb39669643f1ef9d96c0.tar.gz |
OPTIONS_GHC compiler flags may contain spaces (#4931)
When a .hsc contains `#define FOO "bar baz"`, hsc2hs emits:
{-# OPTIONS_GHC -optc-DFOO="bar baz" #-}
Make sure GHC can compile this, by tweaking `HeaderInfo.getOptions` a
bit.
Test Plan: driver/T4931
Reviewers: austin, bgamari
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1452
GHC Trac Issues: #4931
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/HeaderInfo.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index b4c3f81678..08c761994a 100644 --- a/compiler/main/HeaderInfo.hs +++ b/compiler/main/HeaderInfo.hs @@ -236,8 +236,9 @@ getOptions' dflags toks parseToks (open:close:xs) | IToptions_prag str <- getToken open , ITclose_prag <- getToken close - = map (L (getLoc open)) (words str) ++ - parseToks xs + = case toArgs str of + Left err -> panic ("getOptions'.parseToks: " ++ err) + Right args -> map (L (getLoc open)) args ++ parseToks xs parseToks (open:close:xs) | ITinclude_prag str <- getToken open , ITclose_prag <- getToken close |