From patchwork Fri Nov 5 19:41:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basile Starynkevitch X-Patchwork-Id: 70287 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 9AD4D1007D2 for ; Sat, 6 Nov 2010 06:41:50 +1100 (EST) Received: (qmail 18444 invoked by alias); 5 Nov 2010 19:41:49 -0000 Received: (qmail 18436 invoked by uid 22791); 5 Nov 2010 19:41:48 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp-105-friday.noc.nerim.net (HELO mallaury.nerim.net) (62.4.17.105) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Nov 2010 19:41:43 +0000 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by mallaury.nerim.net (Postfix) with ESMTPS id D10E5153417; Fri, 5 Nov 2010 20:41:40 +0100 (CET) Received: from glinka.lesours ([192.168.0.1] helo=glinka) by hector.lesours with smtp (Exim 4.72) (envelope-from ) id 1PESAO-0004p3-6z; Fri, 05 Nov 2010 20:41:40 +0100 Date: Fri, 5 Nov 2010 20:41:56 +0100 From: Basile Starynkevitch To: laurynas.biveinis@gmail.com Cc: gcc-patches@gcc.gnu.org Subject: misc gengtype micro-patch (computing fn in get_output_file_for_structure) Message-Id: <20101105204156.a8dfec12.basile@starynkevitch.net> 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 The following patch seems to correct a bug in get_output_file_for_structure. Otherwise, could anyone explain why the original thing worked? I suspect it is it was never called with a TYPE_PARAM_STRUCT, or for some other reason I cannot understand. ############## gcc/ChangeLog entry 2010-11-05 Basile Starynkevitch * gengtype (get_output_file_for_structure): Fix computation of file name for a TYPE_PARAM_STRUCT ############## Ok for trunk? Index: gcc/gengtype.c =================================================================== --- gcc/gengtype.c (revision 166376) +++ gcc/gengtype.c (working copy) @@ -2637,9 +2637,14 @@ output_type_enum (outf_p of, type_p s) static outf_p get_output_file_for_structure (const_type_p s, type_p *param) { - const char *fn = s->u.s.line.file; + const char *fn; int i; + if (UNION_OR_STRUCT_P (s)) + fn = s->u.s.line.file; + else if (s->kind == TYPE_PARAM_STRUCT) + fn = s->u.param_struct.line.file; + /* This is a hack, and not the good kind either. */ for (i = NUM_PARAM - 1; i >= 0; i--) if (param && param[i] && param[i]->kind == TYPE_POINTER