From patchwork Tue Jun 29 20:35:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 57318 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 BACE2B6EEC for ; Wed, 30 Jun 2010 06:35:55 +1000 (EST) Received: (qmail 14074 invoked by alias); 29 Jun 2010 20:35:52 -0000 Received: (qmail 13997 invoked by uid 22791); 29 Jun 2010 20:35:51 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 29 Jun 2010 20:35:45 +0000 Received: (qmail 29032 invoked from network); 29 Jun 2010 20:35:43 -0000 Received: from unknown (HELO localhost) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Jun 2010 20:35:43 -0000 Date: Tue, 29 Jun 2010 13:35:43 -0700 From: Nathan Froyd To: Joern Rennecke Cc: gcc-patches@gcc.gnu.org, Richard Guenther Subject: Re: RFA (middle-end): Fix PR other/44034 Message-ID: <20100629203543.GQ22606@codesourcery.com> References: <20100526114501.naowcook48wo0kwg-nzlynne@webmail.spamcop.net> <20100528121743.sj8wuutpdwo8ggkc-nzlynne@webmail.spamcop.net> <20100607181903.vsr8r9994w8sk4o0-nzlynne@webmail.spamcop.net> <20100608230324.rh3qk1dp9usgswsg-nzlynne@webmail.spamcop.net> <20100618052748.g619w9g8cgcgcwsw-nzlynne@webmail.spamcop.net> <20100618073622.z33i7h0t4c04cwgc-nzlynne@webmail.spamcop.net> <20100628154608.qp5i7s17hcgcgwo8-nzlynne@webmail.spamcop.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100628154608.qp5i7s17hcgcgwo8-nzlynne@webmail.spamcop.net> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) 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 On Mon, Jun 28, 2010 at 03:46:08PM -0400, Joern Rennecke wrote: > * target.def, doc/tm.texi.in, genhooks.c: New files. > > +static void > +emit_findices (const char *doc, const char *hook_name) > +{ > + const char *end = strstr (doc, "\n\n"); > + const char *fcode; > + > + while ((fcode = strstr (doc, "@Fcode{")) && (!end || fcode < end)) > + { > + fcode += strlen ("@Fcode{"); > + doc = strchr (fcode, '}'); > + if (!doc) > + fatal ("Malformed @Fcode for hook %s\n", hook_name); > + printf ("@findex %.*s\n", doc - fcode, fcode); This construct, and others like it, cause bootstrap failures on x86-64 linux, because doc - fcode is a long and the field precision is supposed to be an integer. The patch below permits me to continue building, will commit as obvious once things finish. -Nathan * genhooks.c (emit_findices): Cast field precision to int. (emit_documentation): Likewise. diff --git a/gcc/genhooks.c b/gcc/genhooks.c index 66d3633..a9eecd7 100644 --- a/gcc/genhooks.c +++ b/gcc/genhooks.c @@ -52,7 +52,7 @@ emit_findices (const char *doc, const char *hook_name) doc = strchr (fcode, '}'); if (!doc) fatal ("Malformed @Fcode for hook %s\n", hook_name); - printf ("@findex %.*s\n", doc - fcode, fcode); + printf ("@findex %.*s\n", (int) (doc - fcode), fcode); doc = fcode; } } @@ -238,9 +238,9 @@ emit_documentation (const char *in_fname) /* Type names like 'int' are followed by a space, sometimes also by '*'. 'void' should appear only in "(void)". */ if (*e == ' ' || *e == '*' || *q == '(') - printf ("%.*s", e - q + 1, q); + printf ("%.*s", (int) (e - q + 1), q); else - printf ("@var{%.*s}%c", e - q, q, *e); + printf ("@var{%.*s}%c", (int) (e - q), q, *e); } /* POD-valued hooks sometimes come in groups with common documentation.*/ @@ -265,8 +265,8 @@ emit_documentation (const char *in_fname) /* Print paragraph, emitting @Fcode as @code. */ for (; (fcode = strstr (doc, "@Fcode{")) && fcode < p_end; doc = fcode + 2) - printf ("%.*s@", fcode - doc, doc); - printf ("%.*s", p_end - doc, doc); + printf ("%.*s@", (int) (fcode - doc), doc); + printf ("%.*s", (int) (p_end - doc), doc); /* Emit function indices for next paragraph. */ emit_findices (p_end, name); }