From: Elena Zannoni <ezannoni@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Symplify macro in symtab.h
Date: Wed, 23 Oct 2002 11:16:00 -0000 [thread overview]
Message-ID: <15798.59073.572696.330826@localhost.redhat.com> (raw)
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 <ezannoni@redhat.com>
* 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
next reply other threads:[~2002-10-23 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-23 11:16 Elena Zannoni [this message]
2002-10-23 12:54 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15798.59073.572696.330826@localhost.redhat.com \
--to=ezannoni@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox