[commit: ghc] wip/nfs-locking: Add support for empty YES/NO flags (treat empty as NO). (8b1feb5)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:37:41 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/8b1feb5b13fc1c9848f2f0e39f271e5c1fb39c27/ghc

>---------------------------------------------------------------

commit 8b1feb5b13fc1c9848f2f0e39f271e5c1fb39c27
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Sep 21 00:57:40 2015 +0100

    Add support for empty YES/NO flags (treat empty as NO).


>---------------------------------------------------------------

8b1feb5b13fc1c9848f2f0e39f271e5c1fb39c27
 src/Oracles/Config/Flag.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Oracles/Config/Flag.hs b/src/Oracles/Config/Flag.hs
index b73a687..d520a85 100644
--- a/src/Oracles/Config/Flag.hs
+++ b/src/Oracles/Config/Flag.hs
@@ -16,6 +16,8 @@ data Flag = CrossCompiling
           | SplitObjectsBroken
           | SupportsPackageKey
 
+-- Note, if a flag is set to empty string we treat it as set to NO. This seems
+-- fragile, but some flags do behave like this, e.g. GccIsClang.
 flag :: Flag -> Action Bool
 flag f = do
     key <- return $ case f of
@@ -28,7 +30,7 @@ flag f = do
         SupportsPackageKey -> "supports-package-key"
     value <- askConfigWithDefault key . putError
         $ "\nFlag '" ++ key ++ "' not set in configuration files."
-    unless (value == "YES" || value == "NO") . putError
+    unless (value == "YES" || value == "NO" || value == "") . putError
         $ "\nFlag '" ++ key ++ "' is set to '" ++ value
         ++ "' instead of 'YES' or 'NO'."
     return $ value == "YES"



More information about the ghc-commits mailing list