From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11690 invoked by alias); 23 Oct 2002 18:16:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11682 invoked from network); 23 Oct 2002 18:16:05 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 23 Oct 2002 18:16:05 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g9NHsfw23797 for ; Wed, 23 Oct 2002 13:54:41 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9NIG4f22261 for ; Wed, 23 Oct 2002 14:16:04 -0400 Received: from localhost.redhat.com (IDENT:GQVp/3BWHnQvQnk0ZiQ3+24WEMwpvxJE@tooth.toronto.redhat.com [172.16.14.29]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9NIG4007187 for ; Wed, 23 Oct 2002 14:16:04 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id C3DBDFF79; Wed, 23 Oct 2002 14:13:21 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15798.59073.572696.330826@localhost.redhat.com> Date: Wed, 23 Oct 2002 11:16:00 -0000 To: gdb-patches@sources.redhat.com Subject: [PATCH] Symplify macro in symtab.h X-SW-Source: 2002-10/txt/msg00465.txt.bz2 This patch "removes" the large macro SYMBOL_INIT_LANGUAGE_SPECIFIC. It doesn't really get rid of it, because the first parameter can be a partial symbol, a minimal symbol, or a full symbol, and we need to still let the macro pass into the function the common ginfo field of the p/m/symbol structure. Similar approach had been taken earlier for the SYMBOL_INIT_DEMANGLED_NAME macro. Elena 2002-10-23 Elena Zannoni * symtab.c (symbol_init_language_specific): New function. * symtab.h (SYMBOL_INIT_LANGUAGE_SPECIFIC): Simplify macro, by turning most of it into a function. (symbol_init_language_specific): Export. Index: symtab.h =================================================================== RCS file: /cvs/uberbaum/gdb/symtab.h,v retrieving revision 1.46 diff -u -p -r1.46 symtab.h --- symtab.h 21 Oct 2002 19:11:50 -0000 1.46 +++ symtab.h 23 Oct 2002 18:07:16 -0000 @@ -139,32 +139,12 @@ extern CORE_ADDR symbol_overlayed_addres #define SYMBOL_CPLUS_DEMANGLED_NAME(symbol) \ (symbol)->ginfo.language_specific.cplus_specific.demangled_name -/* Macro that initializes the language dependent portion of a symbol +/* Initializes the language dependent portion of a symbol depending upon the language for the symbol. */ - -#define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \ - do { \ - SYMBOL_LANGUAGE (symbol) = language; \ - if (SYMBOL_LANGUAGE (symbol) == language_cplus \ - || SYMBOL_LANGUAGE (symbol) == language_java \ - ) \ - { \ - SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \ - } \ - else if (SYMBOL_LANGUAGE (symbol) == language_objc) \ - { \ - SYMBOL_OBJC_DEMANGLED_NAME (symbol) = NULL; \ - } \ - /* OBSOLETE else if (SYMBOL_LANGUAGE (symbol) == language_chill) */ \ - /* OBSOLETE { */ \ - /* OBSOLETE SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; */ \ - /* OBSOLETE } */ \ - else \ - { \ - memset (&(symbol)->ginfo.language_specific, 0, \ - sizeof ((symbol)->ginfo.language_specific)); \ - } \ - } while (0) +#define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \ + (symbol_init_language_specific (&(symbol)->ginfo, (language))) +extern void symbol_init_language_specific (struct general_symbol_info *symbol, + enum language language); #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \ (symbol_init_demangled_name (&symbol->ginfo, (obstack))) Index: symtab.c =================================================================== RCS file: /cvs/uberbaum/gdb/symtab.c,v retrieving revision 1.70 diff -u -p -r1.70 symtab.c --- symtab.c 20 Sep 2002 14:58:58 -0000 1.70 +++ symtab.c 23 Oct 2002 18:15:12 -0000 @@ -385,6 +385,33 @@ gdb_mangle_name (struct type *type, int } +/* Initialize the language dependent portion of a symbol + depending upon the language for the symbol. */ +void +symbol_init_language_specific (struct general_symbol_info *gsymbol, + enum language language) +{ + gsymbol->language = language; + if (gsymbol->language == language_cplus + || gsymbol->language == language_java) + { + gsymbol->language_specific.cplus_specific.demangled_name = NULL; + } + else if (gsymbol->language == language_objc) + { + gsymbol->language_specific.objc_specific.demangled_name = NULL; + } + /* OBSOLETE else if (SYMBOL_LANGUAGE (symbol) == language_chill) */ + /* OBSOLETE { */ + /* OBSOLETE SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; */ + /* OBSOLETE } */ + else + { + memset (&gsymbol->language_specific, 0, + sizeof (gsymbol->language_specific)); + } +} + /* Initialize a symbol's mangled name. */ /* Try to initialize the demangled name for a symbol, based on the