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: 4218 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; }