From e7f1092c0b5efe110006638faf9c6e40b22a6ccc Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 4 Aug 2007 19:24:31 +0000 Subject: [PATCH] We now need to pass a version to extensionsToGHCFlag --- compiler/main/HeaderInfo.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index 233ed1c..717a847 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 @@ -33,6 +34,7 @@ import Maybes import Bag ( emptyBag, listToBag ) import Distribution.Compiler +import Distribution.Version import Control.Exception import Control.Monad @@ -176,11 +178,16 @@ 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 + = case reads (unpackFS ext) of + [] -> languagePragParseError l + (okExt,""):_ -> + case readVersion cProjectVersion of + Just version -> + case extensionsToGHCFlag version [okExt] of + ([],[opt]) -> L l opt + _ -> unsupportedExtnError l okExt + Nothing -> + panic ("Can't parse version: " ++ show cProjectVersion) languagePragParseError loc = pgmError (showSDoc (mkLocMessage loc ( -- 1.7.10.4