From 26c294bd1b8d95b421487294863eb1560b65580d Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 28 Feb 2023 11:04:33 +1030 Subject: [PATCH] chew.c printf of intptr_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Seen when building binutils with gcc -m32 on x86_64-linux. chew.c: In function ‘print’: chew.c:1434:59: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘intptr_t’ {aka ‘int’} [-Wformat=] 1434 | fprintf (stderr, "print: illegal print destination `%ld'\n", *isp); | ~~^ ~~~~ | | | | | intptr_t {aka int} | long int | %d * chew.c: Include inttypes.h. (print): Use PRIdPTR for *isp. --- bfd/doc/chew.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index e8478969d64..5257bf42361 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -91,6 +91,7 @@ #include #include #include +#include #define DEF_SIZE 5000 #define STACK 50 @@ -1431,7 +1432,7 @@ print (void) else if (*isp == 2) write_buffer (tos, stderr); else - fprintf (stderr, "print: illegal print destination `%ld'\n", *isp); + fprintf (stderr, "print: illegal print destination `%" PRIdPTR "'\n", *isp); isp--; tos--; icheck_range (); -- 2.30.2