From patchwork Mon Dec 15 15:01:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 4256 Received: (qmail 23377 invoked by alias); 15 Dec 2014 15:10:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23356 invoked by uid 89); 15 Dec 2014 15:10:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: [PATCH] S390: Get rid of format warning in bug-vfprintf-nargs.c Date: Mon, 15 Dec 2014 16:01:41 +0100 Lines: 43 Message-ID: References: <20141212211214.140332C3ADB@topped-with-meat.com> Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: <20141212211214.140332C3ADB@topped-with-meat.com> On 12/12/2014 10:12 PM, Roland McGrath wrote: > I think you can just cast the value to intptr_t. > Agreed. Here is the new patch version. Ok to commit? --- 2014-12-15 Stefan Liebler * stdio-common/bug-vfprintf-nargs.c (do_test): Cast value to intptr_t to avoid format warning for usage with PRIdPTR printing macro. diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c index c7e7f0b..7534967 100644 --- a/stdio-common/bug-vfprintf-nargs.c +++ b/stdio-common/bug-vfprintf-nargs.c @@ -65,7 +65,8 @@ do_test (void) test this on 32-bit systems. */ if (sizeof (long int) == 4) { - sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int)); + sprintf (buf, "%%1$d %%%" PRIdPTR "$d", + (intptr_t) (UINT32_MAX / sizeof (int))); if (format_failed (buf, "1 %$d") != 0) rc = 1; }