From c939b58e0d4fff3c1b79e317cf17a48bcff52816 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 25 Feb 2010 13:35:37 +0100
Subject: [PATCH] Fix unused-do-binds for ghc 6.12

GHC 6.12 has some new warnings, which are valid in most cases except
(IMHO) printf usage.
---
 Ganeti/HTools/CLI.hs       | 2 +-
 Ganeti/HTools/ExtLoader.hs | 1 +
 hbal.hs                    | 4 ++--
 hscan.hs                   | 2 +-
 hspace.hs                  | 9 +++++----
 5 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Ganeti/HTools/CLI.hs b/Ganeti/HTools/CLI.hs
index 474ab5a18..df9bbc82b 100644
--- a/Ganeti/HTools/CLI.hs
+++ b/Ganeti/HTools/CLI.hs
@@ -359,7 +359,7 @@ parseOpts argv progname options =
               printf "%s %s\ncompiled with %s %s\nrunning on %s %s\n"
                      progname Version.version
                      compilerName (Data.Version.showVersion compilerVersion)
-                     os arch
+                     os arch :: IO ()
               exitWith ExitSuccess
             return (po, args)
       (_, _, errs) -> do
diff --git a/Ganeti/HTools/ExtLoader.hs b/Ganeti/HTools/ExtLoader.hs
index b828a7b3c..0d72d6f90 100644
--- a/Ganeti/HTools/ExtLoader.hs
+++ b/Ganeti/HTools/ExtLoader.hs
@@ -124,6 +124,7 @@ loadExternalData opts = do
          Ok x -> return x
          Bad s -> do
            hPrintf stderr "Error: failed to load data. Details:\n%s\n" s
+               :: IO ()
            exitWith $ ExitFailure 1
       )
   let (fix_msgs, fixed_nl) = Loader.checkData loaded_nl il
diff --git a/hbal.hs b/hbal.hs
index 635fc3c29..b3b6c7653 100644
--- a/hbal.hs
+++ b/hbal.hs
@@ -206,7 +206,7 @@ main = do
 
   when (length offline_wrong > 0) $ do
          hPrintf stderr "Wrong node name(s) set as offline: %s\n"
-                     (commaJoin offline_wrong)
+                     (commaJoin offline_wrong) :: IO ()
          exitWith $ ExitFailure 1
 
   let nm = Container.map (\n -> if elem (Node.idx n) offline_indices
@@ -328,7 +328,7 @@ main = do
          when (verbose > 3) $
               do
                 printf "Original: mem=%d disk=%d\n"
-                       (Cluster.csFmem ini_cs) (Cluster.csFdsk ini_cs)
+                       (Cluster.csFmem ini_cs) (Cluster.csFdsk ini_cs) :: IO ()
                 printf "Final:    mem=%d disk=%d\n"
                        (Cluster.csFmem fin_cs) (Cluster.csFdsk fin_cs)
   when oneline $
diff --git a/hscan.hs b/hscan.hs
index 44985ae15..de5b1a415 100644
--- a/hscan.hs
+++ b/hscan.hs
@@ -145,7 +145,7 @@ writeData _ name _ (Bad err) =
     printf "\nError for %s: failed to load data. Details:\n%s\n" name err
 
 writeData nlen name opts (Ok (nl, il, adata)) = do
-  printf "%-*s " nlen name
+  printf "%-*s " nlen name :: IO ()
   hFlush stdout
   let shownodes = optShowNodes opts
       odir = optOutPath opts
diff --git a/hspace.hs b/hspace.hs
index 429288816..d69f4d33b 100644
--- a/hspace.hs
+++ b/hspace.hs
@@ -173,7 +173,7 @@ printResults fin_nl num_instances allocs sreason = do
        do
          hPrintf stderr "ERROR: internal inconsistency, allocated (%d)\
                         \ != counted (%d)\n" (num_instances + allocs)
-                                 (Cluster.csNinst fin_stats)
+                                 (Cluster.csNinst fin_stats) :: IO ()
          exitWith $ ExitFailure 1
 
   printKeys $ printStats PFinal fin_stats
@@ -244,11 +244,12 @@ main = do
 
   when (length offline_wrong > 0) $ do
          hPrintf stderr "Error: Wrong node name(s) set as offline: %s\n"
-                     (commaJoin offline_wrong)
+                     (commaJoin offline_wrong) :: IO ()
          exitWith $ ExitFailure 1
 
   when (req_nodes /= 1 && req_nodes /= 2) $ do
-         hPrintf stderr "Error: Invalid required nodes (%d)\n" req_nodes
+         hPrintf stderr "Error: Invalid required nodes (%d)\n"
+                                            req_nodes :: IO ()
          exitWith $ ExitFailure 1
 
   let nm = Container.map (\n -> if elem (Node.idx n) offline_indices
@@ -288,7 +289,7 @@ main = do
                     (rspecCpu spx) "ADMIN_down" [] (-1) (-1)
       exitifbad val = (case val of
                          Bad s -> do
-                           hPrintf stderr "Failure: %s\n" s
+                           hPrintf stderr "Failure: %s\n" s :: IO ()
                            exitWith $ ExitFailure 1
                          Ok x -> return x)
 
-- 
GitLab