[commit: ghc] master: rts: Add format attribute to barf (4d1c3b7)

git at git.haskell.org git at git.haskell.org
Tue Feb 6 19:22:10 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4d1c3b72ec27c8e51fb40809bba3ce35246a2966/ghc

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

commit 4d1c3b72ec27c8e51fb40809bba3ce35246a2966
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Feb 6 13:27:35 2018 -0500

    rts: Add format attribute to barf
    
    Test Plan: Validate
    
    Reviewers: erikd, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4374


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

4d1c3b72ec27c8e51fb40809bba3ce35246a2966
 includes/rts/Messages.h | 3 ++-
 rts/Capability.c        | 2 +-
 rts/Schedule.c          | 2 +-
 rts/Threads.c           | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/includes/rts/Messages.h b/includes/rts/Messages.h
index 2a6a84b..206d40f 100644
--- a/includes/rts/Messages.h
+++ b/includes/rts/Messages.h
@@ -40,7 +40,8 @@
  * expected to return.
  */
 void barf(const char *s, ...)
-   GNUC3_ATTRIBUTE(__noreturn__);
+   GNUC3_ATTRIBUTE(__noreturn__)
+   GNUC3_ATTRIBUTE(format(printf, 1, 2));
 
 void vbarf(const char *s, va_list ap)
    GNUC3_ATTRIBUTE(__noreturn__);
diff --git a/rts/Capability.c b/rts/Capability.c
index 0fcb0c9..03b2a86 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -362,7 +362,7 @@ void initCapabilities (void)
         }
         n_numa_nodes = logical;
         if (logical == 0) {
-            barf("%s: available NUMA node set is empty");
+            barf("available NUMA node set is empty");
         }
     }
 
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 8002ac3..349a778 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -271,7 +271,7 @@ schedule (Capability *initialCapability, Task *task)
         }
         break;
     default:
-        barf("sched_state: %d", sched_state);
+        barf("sched_state: %ld", sched_state);
     }
 
     scheduleFindWork(&cap);
diff --git a/rts/Threads.c b/rts/Threads.c
index b09dfa8..b769177 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -876,7 +876,7 @@ printThreadBlockage(StgTSO *tso)
     debugBelch("is blocked on an STM operation");
     break;
   default:
-    barf("printThreadBlockage: strange tso->why_blocked: %d for TSO %d (%d)",
+    barf("printThreadBlockage: strange tso->why_blocked: %d for TSO %d (%p)",
          tso->why_blocked, tso->id, tso);
   }
 }



More information about the ghc-commits mailing list