From patchwork Tue Oct 19 12:52:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 68329 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]) by ozlabs.org (Postfix) with SMTP id 42967B70A7 for ; Tue, 19 Oct 2010 23:53:21 +1100 (EST) Received: (qmail 26212 invoked by alias); 19 Oct 2010 12:53:19 -0000 Received: (qmail 26202 invoked by uid 22791); 19 Oct 2010 12:53:18 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Oct 2010 12:53:12 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 45ABA38E; Tue, 19 Oct 2010 14:53:09 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id F6Rlfaoc1cj2; Tue, 19 Oct 2010 14:52:29 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 485BF389; Tue, 19 Oct 2010 14:52:29 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id o9JCqSbB024241; Tue, 19 Oct 2010 14:52:28 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Bruce Korb Subject: [fixincludes, testsuite] Fix g++.dg/warn/miss-format-1.C on Solaris 8/9 (PR c++/46024) Date: Tue, 19 Oct 2010 14:52:28 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org As described in the PR, g++.dg/warn/miss-format-1.C fails on Solaris 8 and 9 in various ways. The worst is i386-pc-solaris2.8: FAIL: g++.dg/warn/miss-format-1.C printf attribute warning (test for warnings, line 17) FAIL: g++.dg/warn/miss-format-1.C printf attribute warning 2 (test for warnings, line 42) FAIL: g++.dg/warn/miss-format-1.C (test for excess errors) Excess errors: /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/warn/miss-format-1.C:26:18: error: 'vscanf' was not declared in this scope The excess errors can be fixed by enclosing the target list in braces. The missing attribute warning happens because on i386 (unlike sparc, which uses the default, void *) va_list is char *, which doesn't match with C++: #ifdef __STDC__ typedef void *__va_list; #else typedef char *__va_list; #endif The FAILs don't occur on Solaris 10+ because that version of has the equivalent of #ifdef __GNUC__ typedef __builtin_va_list __gnuc_va_list; typedef __builtin_va_list __va_list; #endif I'm introducing an equivalent change via fixincludes. Bootstrapped without regressions on i386-pc-solaris2.10 and i386-pc-solaris2.9. sparc-sun-solaris2.8 and sparc-sun-solaris2.10 bootstraps still running. Ok for mainline, 4.4 and 4.5 branches? Rainer 2010-06-19 Rainer Orth fixincludes: PR c++/46024 * inclhack.def (solaris_sys_va_list): New fix. * fixincl.x: Regenerate. * tests/base/sys/va_list.h: New test. gcc/testsuite: PR c++/46024 * g++.dg/warn/miss-format-1.C: Enclose dg-error target list in braces. diff -r 96768db556ed fixincludes/inclhack.def --- a/fixincludes/inclhack.def Mon Oct 18 23:09:29 2010 +0200 +++ b/fixincludes/inclhack.def Tue Oct 19 14:41:59 2010 +0200 @@ -3694,6 +3694,34 @@ /* + * On Solaris 8 and 9, __va_list needs to become a typedef for + * __builtin_va_list to make -Wmissing-format-attribute work. + */ +fix = { + hackname = solaris_sys_va_list; + files = sys/va_list.h; + mach = '*-*-solaris2.[89]'; + select = "#if.*__STDC__.*\n" + "typedef void \\*__va_list;\n" + "#else\n" + "typedef char \\*__va_list;\n" + "#endif"; + + c_fix = format; + c_fix_arg = "#ifdef __GNUC__\n" + "typedef __builtin_va_list __va_list;\n" + "#else\n" + "%0\n" + "#endif"; + test_text = "#if defined(__STDC__) && !defined(__ia64)\n" + "typedef void *__va_list;\n" + "#else\n" + "typedef char *__va_list;\n" + "#endif"; +}; + + +/* * a missing semi-colon at the end of the statsswtch structure definition. */ fix = { diff -r 96768db556ed fixincludes/tests/base/sys/va_list.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fixincludes/tests/base/sys/va_list.h Tue Oct 19 14:41:59 2010 +0200 @@ -0,0 +1,22 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/sys/va_list.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( SOLARIS_SYS_VA_LIST_CHECK ) +#ifdef __GNUC__ +typedef __builtin_va_list __va_list; +#else +#if defined(__STDC__) && !defined(__ia64) +typedef void *__va_list; +#else +typedef char *__va_list; +#endif +#endif +#endif /* SOLARIS_SYS_VA_LIST_CHECK */ diff -r 96768db556ed gcc/testsuite/g++.dg/warn/miss-format-1.C --- a/gcc/testsuite/g++.dg/warn/miss-format-1.C Mon Oct 18 23:09:29 2010 +0200 +++ b/gcc/testsuite/g++.dg/warn/miss-format-1.C Tue Oct 19 14:41:59 2010 +0200 @@ -4,7 +4,7 @@ /* { dg-options "-Wmissing-format-attribute" } */ /* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */ /* VxWorks does not provide vscanf, either in kernel or RTP mode. */ -/* { dg-error "not declared" "" { target *-*-solaris2.8 *-*-vxworks* alpha*-dec-osf5* } 26 } */ +/* { dg-error "not declared" "" { target { *-*-solaris2.8 *-*-vxworks* alpha*-dec-osf5* } } 26 } */ #include #include