From patchwork Mon Sep 20 12:54:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 65204 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 D4207B70B8 for ; Mon, 20 Sep 2010 22:54:29 +1000 (EST) Received: (qmail 21076 invoked by alias); 20 Sep 2010 12:54:28 -0000 Received: (qmail 21065 invoked by uid 22791); 20 Sep 2010 12:54:27 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Sep 2010 12:54:23 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id C2DFF8655F; Mon, 20 Sep 2010 14:54:20 +0200 (CEST) Date: Mon, 20 Sep 2010 14:54:20 +0200 (CEST) From: Richard Guenther To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][2/2] Crude debug language selection for LTO In-Reply-To: <4C939C10.9000402@redhat.com> Message-ID: References: <4C939C10.9000402@redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 Fri, 17 Sep 2010, Jason Merrill wrote: > On 09/17/2010 07:14 AM, Richard Guenther wrote: > > + else if (strncmp (common_lang, "GNU C", 5) == 0 > > + && strncmp (TRANSLATION_UNIT_LANGUAGE (t), "GNU C", 5) == > > 0) > > + /* Mixing C and C++ is ok, use C++ in that case. */ > > + common_lang = "GNU C++"; > > Seems like this will give you C++ from mixing C and C. Ooops, true. Fixed with the following incremental patch. Is allocating comp_unit_die lazily like done in that patch ok with you? Thanks, Richard. Index: trunk/gcc/dwarf2out.c =================================================================== --- trunk.orig/gcc/dwarf2out.c 2010-09-20 14:54:13.000000000 +0200 +++ trunk/gcc/dwarf2out.c 2010-09-20 14:53:13.000000000 +0200 @@ -19622,11 +19622,13 @@ gen_compile_unit_die (const char *filena continue; if (!common_lang) common_lang = TRANSLATION_UNIT_LANGUAGE (t); + else if (strcmp (common_lang, TRANSLATION_UNIT_LANGUAGE (t)) == 0) + ; else if (strncmp (common_lang, "GNU C", 5) == 0 && strncmp (TRANSLATION_UNIT_LANGUAGE (t), "GNU C", 5) == 0) /* Mixing C and C++ is ok, use C++ in that case. */ common_lang = "GNU C++"; - else if (strcmp (common_lang, TRANSLATION_UNIT_LANGUAGE (t)) != 0) + else { /* Fall back to C. */ common_lang = NULL;