Re: D language support

Joel Brobecker
2010-04-21T15:57:07Z

> gdb/ChangeLog:
> D language support.
> * Makefile.in (SFILES): Add d-lang.c d-valprint.c.
> (COMMON_OBS): Add d-lang.o d-valprint.o.
> (HFILES_NO_SRCDIR): Add d-lang.h.
> * c-lang.c (c_emit_char, exp_descriptor_c): Make public.
> * c-lang.h (c_emit_char, exp_descriptor_c): Add declaration.
> * d-lang.c: New file.
> * d-lang.h: New file.
> * d-valprint.c: New file.
> * defs.h (enum language): Add language_d.
> * dwarf2read.c (set_cu_language): Add DW_LANG_D.
> * language.c (binop_result_type, integral_type, character_type)
> (string_type, boolean_type, structured_type): Add language_d.
> * symfile.c (init_filename_language_table): Add language_d.
> * symtab.c: Include d-lang.h.
> (symbol_init_language_specific, symbol_find_demangled_name)
> (symbol_natural_name, lookup_symbol_in_language)
> (symbol_demangled_name, symbol_matches_domain): Add language_d.
> gdb/doc/ChangeLog:
> * gdb.texinfo: Add mention about D language support.
> gdb/testsuite/ChangeLog:
> * gdb.base/default.exp: Fix "set language" test.

Overall, looks good to me, but I have a question on a couple of globals
and a few last formatting nits. We will also need to add an entry in
the NEWS file, but that can be done separately.

> +extern void c_emit_char (int c, struct type *type, struct ui_file *stream, int quoter);

This line exceeds the 78 characters limit - can you split it in two?

> +static const char *mangled_str;

I think this part needs to be rethinked, or at least I don't understand
why this needs to be a global. Can you elaborate?

Similarly, I do not understand why ...
> +/* Temporary obstack used for holding strings. */
> +static struct obstack tempbuf;
... needs to be a global?

I will not necessarily object to the code being checked in as is;
this is, after all, an implementation detail local to this language,
but if we can look at this, and fix it if applicable, let's do it now.

> + if (gsymbol->language == language_d
> + || gsymbol->language == language_auto)
> + {
> + demangled =
> + d_demangle(mangled, 0);

Can you join the last two lines?

--
Joel