From patchwork Mon Feb 14 18:52:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 83147 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 75D88B70ED for ; Tue, 15 Feb 2011 05:52:59 +1100 (EST) Received: (qmail 9650 invoked by alias); 14 Feb 2011 18:52:57 -0000 Received: (qmail 9638 invoked by uid 22791); 14 Feb 2011 18:52:55 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 18:52:51 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1EIqn1s022025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Feb 2011 13:52:49 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1EIqmop008038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 14 Feb 2011 13:52:49 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p1EIqmNs013440 for ; Mon, 14 Feb 2011 19:52:48 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p1EIqmKT013438 for gcc-patches@gcc.gnu.org; Mon, 14 Feb 2011 19:52:48 +0100 Date: Mon, 14 Feb 2011 19:52:48 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix bootstrap on pre-2.10 glibc (PR bootstrap/47736) Message-ID: <20110214185248.GP30899@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi! User field has been added into struct printf_info only for glibc 2.10+. We actually never use it unless HAVE_PRINTF_HOOKS, so we don't need to initialize it either. The patch below just initializes everything to 0 so that individual fields don't have to be initialized one by one, then we don't have to touch info.user and check whether it is present or not. The configure snippet just double checks that the field exists. Tested on glibc 2.12.2 and with hand edited printf.h to simulate older glibcs. 2011-02-14 Jakub Jelinek PR bootstrap/47736 * configure.ac (HAVE_PRINTF_HOOKS): Test if printf_info struct has user field. * printf/quadmath-printf.c (quadmath_snprintf): Clear whole info field instead of setting individual fields to 0. Don't set info.user to -1. * configure: Regenerated. Jakub --- libquadmath/configure.ac.jj 2011-02-14 17:28:39.000000000 +0100 +++ libquadmath/configure.ac 2011-02-14 19:14:25.281464520 +0100 @@ -241,6 +241,7 @@ extern int flt128_printf_fp (FILE *, con int pa_flt128 = register_printf_type (flt128_va); int mod_Q = register_printf_modifier (L"Q"); int res = register_printf_specifier ('f', flt128_printf_fp, flt128_ais); +struct printf_info info = { .user = -1 }; ], [quadmath_printf_hooks=yes],[quadmath_printf_hooks=no]) AC_MSG_RESULT($quadmath_printf_hooks) --- libquadmath/printf/quadmath-printf.c.jj 2011-02-14 16:13:33.000000000 +0100 +++ libquadmath/printf/quadmath-printf.c 2011-02-14 19:12:59.678433319 +0100 @@ -121,15 +121,16 @@ quadmath_snprintf (char *str, size_t siz return -1; /* Clear information structure. */ - info.alt = 0; + memset (&info, '\0', sizeof info); + /* info.alt = 0; info.space = 0; info.left = 0; info.showsign = 0; info.group = 0; info.i18n = 0; - info.extra = 0; + info.extra = 0; */ info.pad = ' '; - info.wide = 0; + /* info.wide = 0; */ /* Check for spec modifiers. */ do @@ -180,7 +181,7 @@ quadmath_snprintf (char *str, size_t siz va_start (ap, format); /* Get the field width. */ - info.width = 0; + /* info.width = 0; */ if (*format == '*') { /* The field width is given in an argument. @@ -213,11 +214,11 @@ quadmath_snprintf (char *str, size_t siz } /* Check for type modifiers. */ - info.is_long_double = 0; + /* info.is_long_double = 0; info.is_short = 0; info.is_long = 0; info.is_char = 0; - info.user = -1; + info.user = 0; */ /* We require Q modifier. */ if (*format++ != 'Q') --- libquadmath/configure.jj 2011-02-14 17:28:55.000000000 +0100 +++ libquadmath/configure 2011-02-14 19:14:45.609429566 +0100 @@ -12555,6 +12555,7 @@ main () int pa_flt128 = register_printf_type (flt128_va); int mod_Q = register_printf_modifier (L"Q"); int res = register_printf_specifier ('f', flt128_printf_fp, flt128_ais); +struct printf_info info = { .user = -1 }; ; return 0;