From patchwork Tue May 8 00:10:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sterling Augustine X-Patchwork-Id: 157492 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 EE9A2B6FAF for ; Tue, 8 May 2012 10:10:52 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1337040653; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=WptS+qU hn+6/B9iVypk4dfFm0ow=; b=vXILJu/a+Lsw5T33FdwHATDLCdCwkPy3VTtxc5o vEu9I547TD0E+3jUX6o0HY1ZTG9KrPKVfs+Sa4rMouppwAw9Qxe1UEmEQXzrtcmM w6Ca1gK/tdoy0n1JC1HbQIjblmVUy9QPLoiU03YB/jcbneRylXn/WR9fOjiUNxqA oA6c= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pjp0SNzUaeVCE0prDU4fahErJCOOa2hea8OiY+IzqIHvU/7xVKgr2PqAkg4LDt SSXPfgeWxfTxUSdWOgg1C261qDPqgbSewmbCcbGlfu/TpO9F9liEgg4fdzMhEETi s3VHHZWXkN+HT0DPcBgqKBzcsMGnf7bWJx78FE/OgvShA=; Received: (qmail 26962 invoked by alias); 8 May 2012 00:10:28 -0000 Received: (qmail 26903 invoked by uid 22791); 8 May 2012 00:10:18 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_CX, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ey0-f201.google.com (HELO mail-ey0-f201.google.com) (209.85.215.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 May 2012 00:10:05 +0000 Received: by eaai13 with SMTP id i13so83265eaa.2 for ; Mon, 07 May 2012 17:10:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=xqbPOEZDjtrX1u/PqE+9YzTQiDn4DVBgPSPjiwpiALQ=; b=GuTd6thnIqOJmcCj7XzPeJguQkc1e89HfiuUVCk6LWBDiLBYsxchdprieJ0agXC9aU gVlOuZ6chOJhZjcEJ2bzLbMMv5vrNhaHEYbNJhg62Nkzsc0fXHJFcgub7afQtTr0GblG wxZzQkqfV0TbH5LUQUHeKnYeQ17dZT0M9WVSZLEFdUC0y7nvsPgdLBmAJsAuODzKVOQf 1tzMdP2i3CamW93lZWO3G/ZcTTB5YRPhpLiWm0AAhuzTGb99NiYttaEU5QrUsfrYmlP+ mBYOoQDBUETe8ahOCftMwqU9Xapd79YkGQsUU8IaILOqinBF45nPTk22PJdFG9cRTy2d KbuA== Received: by 10.213.107.193 with SMTP id c1mr3059354ebp.6.1336435803892; Mon, 07 May 2012 17:10:03 -0700 (PDT) Received: by 10.213.107.193 with SMTP id c1mr3059348ebp.6.1336435803721; Mon, 07 May 2012 17:10:03 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id t8si18990599eef.1.2012.05.07.17.10.03 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 07 May 2012 17:10:03 -0700 (PDT) Received: from sterling.mtv.corp.google.com (sterling.mtv.corp.google.com [172.18.111.14]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 8422C5C0066; Mon, 7 May 2012 17:10:03 -0700 (PDT) Received: by sterling.mtv.corp.google.com (Postfix, from userid 135279) id B3183160A7C; Mon, 7 May 2012 17:10:02 -0700 (PDT) To: reply@codereview.appspotmail.com,gcc-patches@gcc.gnu.org Subject: [C++ Patch and pubnames 2/2] Adjust c decl pretty printer to match demangler (issue6195056) Message-Id: <20120508001002.B3183160A7C@sterling.mtv.corp.google.com> Date: Mon, 7 May 2012 17:10:02 -0700 (PDT) From: saugustine@google.com (Sterling Augustine) X-Gm-Message-State: ALoCoQkztAhGq1wUOwlmsYStCZTKUDb8FDovRzdrXaS/HjLA/0/7H7McTMk9W7tlwnpt9GBskQxJPoLlVsKZFb72ZUstYhI+aeBj9E0NpQk/9xRm6J7jg7sAceLXWG+WBu+IpNRQf/maQAgDIPbE8vaJaFvznmXuAPnXHxqUWjCynu9Gtsk1HhQ= 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 This is the second in the series of patches to make c decl pretty printing more closely match the demangler. A full explanation is here: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00512.html OK for mainline? Sterling 2012-05-07 Sterling Augustine * c-family/c-pretty-print.c (pp_c_specifier_qualifier_list): Move call to pp_c_type_qualifier_list from start to end of function. * cp/error.c (dump_decl): Change "{anonymous}" to "(anonymous namespace)" (lang_decl_name): Handle "(anonymous namespace)" correctly. --- This patch is available for review at http://codereview.appspot.com/6195056 Index: c-family/c-pretty-print.c =================================================================== --- c-family/c-pretty-print.c (revision 187271) +++ c-family/c-pretty-print.c (working copy) @@ -446,8 +446,6 @@ pp_c_specifier_qualifier_list (c_pretty_printer *p { const enum tree_code code = TREE_CODE (t); - if (TREE_CODE (t) != POINTER_TYPE) - pp_c_type_qualifier_list (pp, t); switch (code) { case REFERENCE_TYPE: @@ -494,6 +492,8 @@ pp_c_specifier_qualifier_list (c_pretty_printer *p pp_simple_type_specifier (pp, t); break; } + if (TREE_CODE (t) != POINTER_TYPE) + pp_c_type_qualifier_list (pp, t); } /* parameter-type-list: Index: cp/error.c =================================================================== --- cp/error.c (revision 187271) +++ cp/error.c (working copy) @@ -1028,7 +1028,7 @@ dump_decl (tree t, int flags) dump_scope (CP_DECL_CONTEXT (t), flags); flags &= ~TFF_UNQUALIFIED_NAME; if (DECL_NAME (t) == NULL_TREE) - pp_cxx_ws_string (cxx_pp, M_("{anonymous}")); + pp_cxx_ws_string (cxx_pp, M_("(anonymous namespace)")); else pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t)); } @@ -2596,6 +2596,8 @@ lang_decl_name (tree decl, int v, bool translate) if (TREE_CODE (decl) == FUNCTION_DECL) dump_function_name (decl, TFF_PLAIN_IDENTIFIER); + else if (DECL_NAME (decl) == NULL && TREE_CODE (decl) == NAMESPACE_DECL) + pp_string (cxx_pp, M_("(anonymous namespace)")); else dump_decl (DECL_NAME (decl), TFF_PLAIN_IDENTIFIER);