[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch-1.6 distcheck failure: printf %* and integer type

From: Ralf Wildenhues
Subject: branch-1.6 distcheck failure: printf %* and integer type
Date: Fri, 27 Nov 2009 20:39:53 +0100
User-agent: Mutt/1.5.20 (2009-08-09)

Hi Eric,

I need the following patch to get branch-1.6 M4 to pass distcheck on

cc1: warnings being treated as errors
../../src/builtin.c: In function 'm4_maketemp':
../../src/builtin.c:1674: warning: field precision should have type 'int', but 
argument 3 has type 'size_t' [-Wformat]
../../src/macro.c:750: warning: format '%d' expects type 'int', but argument 4 
has type 'size_t' [-Wformat]


2009-11-27  Ralf Wildenhues  <address@hidden>

        Fix -Wformat warnings.
        * src/builtin.c (m4_maketemp): Cast printf %*d length argument
        to int.
        * src/macro.c (adjust_refcount): Cast size_t to unsigned long,
        adjust printf format string.

diff --git a/src/builtin.c b/src/builtin.c
index ea27f74..9795837 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -1671,7 +1671,7 @@ m4_maketemp (struct obstack *obs, int argc, 
macro_arguments *argv)
       if (len - i < pid_len)
        obstack_grow (obs, pid + pid_len - (len - i), len - i);
-       obstack_printf (obs, "%.*d%s", len - i - pid_len, 0, pid);
+       obstack_printf (obs, "%.*d%s", (int)(len - i - pid_len), 0, pid);
     mkstemp_helper (obs, me, ARG (1), ARG_LEN (1));
diff --git a/src/macro.c b/src/macro.c
index 403a90d..8f588d3 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -746,8 +746,8 @@ adjust_refcount (int level, bool increase)
   if (debug_macro_level
-    xfprintf (debug, "m4debug: level %d refcount=%d\n", level,
-             stacks[level].refcount);
+    xfprintf (debug, "m4debug: level %d refcount=%lu\n", level,
+             (unsigned long) stacks[level].refcount);
   return stacks[level].refcount;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]