X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FHeaderInfo.hs;h=51e491e9ac5567598eacd98832b29234de0e60a4;hb=e2390e76b2f1f2beecd9a0d308c4890a56ae8bca;hp=233ed1c35867faf20a9acb47bb7ed542d7e3339a;hpb=b1ab4b8a607addc4d097588db5761313c996a41f;p=ghc-hetmet.git diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index 233ed1c..51e491e 100644 --- a/compiler/main/HeaderInfo.hs +++ b/compiler/main/HeaderInfo.hs @@ -22,6 +22,7 @@ import Module ( ModuleName, moduleName ) import PrelNames ( gHC_PRIM, mAIN_NAME ) import StringBuffer ( StringBuffer(..), hGetStringBuffer, hGetStringBufferBlock , appendStringBuffers ) +import Config import SrcLoc import DynFlags import ErrUtils @@ -32,8 +33,6 @@ import Panic import Maybes import Bag ( emptyBag, listToBag ) -import Distribution.Compiler - import Control.Exception import Control.Monad import System.Exit @@ -176,11 +175,13 @@ getOptions' buf filename checkExtension :: Located FastString -> Located String checkExtension (L l ext) - = case reads (unpackFS ext) of - [] -> languagePragParseError l - (okExt,""):_ -> case extensionsToGHCFlag [okExt] of - ([],[opt]) -> L l opt - _ -> unsupportedExtnError l okExt +-- Checks if a given extension is valid, and if so returns +-- its corresponding flag. Otherwise it throws an exception. + = let ext' = unpackFS ext in + if ext' `elem` supportedLanguages + || ext' `elem` (map ("No"++) supportedLanguages) + then L l ("-X"++ext') + else unsupportedExtnError l ext' languagePragParseError loc = pgmError (showSDoc (mkLocMessage loc ( @@ -189,7 +190,7 @@ languagePragParseError loc = unsupportedExtnError loc unsup = pgmError (showSDoc (mkLocMessage loc ( text "unsupported extension: " <> - (text.show) unsup))) + text unsup))) optionsErrorMsgs :: [String] -> [Located String] -> FilePath -> Messages