From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7497 invoked by alias); 29 Jan 2010 20:23:07 -0000 Received: (qmail 7489 invoked by uid 22791); 29 Jan 2010 20:23:06 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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; Fri, 29 Jan 2010 20:23:01 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0TKMxiA014015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 29 Jan 2010 15:22:59 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0TKMx38026454; Fri, 29 Jan 2010 15:22:59 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o0TKMw56011835; Fri, 29 Jan 2010 15:22:58 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id D175B379973; Fri, 29 Jan 2010 13:22:57 -0700 (MST) From: Tom Tromey To: Sami Wagiaalla Cc: GDB Patches Subject: Re: [patch] Add namespace aliasing support. References: <4B630D3F.8010507@redhat.com> Reply-To: tromey@redhat.com Date: Fri, 29 Jan 2010 20:23:00 -0000 In-Reply-To: <4B630D3F.8010507@redhat.com> (Sami Wagiaalla's message of "Fri, 29 Jan 2010 11:30:55 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00651.txt.bz2 >>>>> "Sami" == Sami Wagiaalla writes: Sami> 2010-01-29 Sami Wagiaalla Sami> * cp-support.h: Added char* alias element to using_direct data Sami> struct. Sami> (cp_add_using): Added char* alias argument. Sami> (cp_add_using_directive): Ditto. Sami> * cp-namespace.c: Updated with the above changes. Sami> (cp_lookup_symbol_imports): Check for aliases. Sami> * dwarf2read.c (read_import_statement): Figure out local alias Sami> for the import and pass it on to cp_add_using. Sami> (read_namespace): Pass alias argument to cp_add_using. Sami> 2010-01-29 Sami Wagiaalla Lots of formatting nits, plus one slightly more substantial comment. Sami> +cp_add_using_directive (const char *dest, const char *src, const char* alias) "char *", not "char*". Sami> + scope DEST. ALIAS is the name of the imported namespace in the current Sami> + scope. If ALIAS is an empty string then the namespace is known by its Sami> + original name. Two spaces after a period. Only one space between "string then". Sami> + retval->alias = savestring (alias, strlen(alias)); Space before open paren. Sami> + else if (strcmp ("", current->alias) == 0) It is more idiomatic in C to use NULL rather than the empty string as a special value. Please make this change. Sami> + { Sami> + /* If this import statement creates no alias, pass current->inner as Sami> + NAMESPACE to direct the search towards the imported namespace. */ Sami> + sym = cp_lookup_symbol_imports (current->import_src, The code here should be indented 2 spaces beyond the open brace, not lined up with it. Sami> + namespace IMPORT_DEST. These form a linked list; NEXT is the next element Sami> + of the list. ALIAS is set to a non empty string if the imported namespace Sami> + has been aliased. The period rule again. Sami> + import_alias = dwarf2_name (die, cu); Sami> + if (import_alias == NULL) Sami> + { Sami> + import_alias = ""; Sami> + } This code will be going away, but just FYI, don't brace a single statement. Tom