From patchwork Fri Dec 12 14:46:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 420503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 14A991400F1 for ; Sat, 13 Dec 2014 01:46:36 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=EMz3jKcDaVk0fUn4Jl2qZ0ACf/c+Y myw3KWLa9ZmwJ771aPOvSvRH5+7HvoJvbmHx+cE1OCpjZ9aWYw9yEoRtqFOzyjo3 DT86Qoq9h9ghYCvCFLg/ss0zV1p7AOO/UGH/CJQ16ISWSMWj0By9A1IoYGU29+dp IjYdK81fS11Dzc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:mime-version :content-type; s=default; bh=gLQ72SMpFY7D2UEMQRfZve4HNco=; b=gNW XdZtKSw9TFjg8639VFfajnthQRzx55GJ84LyTtyahykUz4F2dZyBN0X+dom1J084 oaqFN+sebcYnEn4wBr6VtWlRoJmpi8L6ZFLj2G1sPk/LzKSvqfOOy16RDFG6kSQ7 7oz7P9LkdMUFQ3Nj0p0TAiGhMRPaD85C1wGM1hvg= Received: (qmail 26911 invoked by alias); 12 Dec 2014 14:46:31 -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 26900 invoked by uid 89); 12 Dec 2014 14:46:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, 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: [PATCH] S390: Get rid of format warning in bug-vfprintf-nargs.c Date: Fri, 12 Dec 2014 15:46:12 +0100 Lines: 54 Message-ID: Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 Hi, on 31bit s390 i get the following warning/error: gcc bug-vfprintf-nargs.c -c ... bug-vfprintf-nargs.c: In function ‘do_test’: bug-vfprintf-nargs.c:68:7: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=] sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int)); This patch suppresses the format warning with the diagnostic control pragmas. Thus the behaviour of this testcase isn´t changed. Ok to commit? Bye Stefan --- 2014-12-12 Stefan Liebler * stdio-common/bug-vfprintf-nargs.c (do_test): Disable format warning with diagnostic control pragma. diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c index c7e7f0b..7406b7a 100644 --- a/stdio-common/bug-vfprintf-nargs.c +++ b/stdio-common/bug-vfprintf-nargs.c @@ -24,6 +24,7 @@ #include #include #include +#include static int format_failed (const char *fmt, const char *expected) @@ -65,7 +66,13 @@ do_test (void) test this on 32-bit systems. */ if (sizeof (long int) == 4) { + /* On S390 31bit, gcc emits the warning: + format ‘%d’ expects argument of type ‘int’, + but argument 3 has type ‘long unsigned int’. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (5, "-Wformat"); sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int)); + DIAG_POP_NEEDS_COMMENT; if (format_failed (buf, "1 %$d") != 0) rc = 1; }