summaryrefslogtreecommitdiff
path: root/gdb/macrotab.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-07-18 20:55:33 +0000
committerTom Tromey <tromey@redhat.com>2008-07-18 20:55:33 +0000
commit841edd2e8e5b0ace46bac925dfa97be9e8e63f1d (patch)
tree477ba6fc0e08f0d6b4438e983369c7600d815eb1 /gdb/macrotab.h
parent77e32f560ca48ecd355665642c4163bb1e415a8e (diff)
downloadgdb-841edd2e8e5b0ace46bac925dfa97be9e8e63f1d.tar.gz
gdb
PR gdb/855: * NEWS: Add entry for macro commands. * Makefile.in (macrocmd.o): Add gdb_string.h. * macroscope.h (user_macro_scope): Declare. (default_macro_scope): Update documentation. (macro_user_macros): Declare. * c-lang.c (c_preprocess_and_parse): Always attempt macro lookup. Use user_macro_scope. (null_macro_lookup): Remove. * macrotab.h (macro_callback_fn): Declare. (macro_for_each): Likewise. (macro_allow_redefinitions): Likewise. * macrotab.c (foreach_macro): New function (macro_for_each): Likewise. (struct macro_table) <redef_ok>: New field. (macro_allow_redefinitions): New function. (new_macro_table): Update. (macro_define_function): Likewise. (macro_define_object): Likewise. * macroscope.c (user_macro_scope): New function. (default_macro_scope): Use it. (macro_user_macros): New global. (standard_macro_lookup): Look in macro_user_macros. (_initialize_macroscope): New function. * macroexp.h (macro_is_whitespace, macro_is_digit, macro_is_identifier_nondigit): Declare. * macroexp.c (macro_is_whitespace): Rename. No longer static. (macro_is_digit): Likewise. (macro_is_identifier_nondigit): Likewise. (get_identifier): Update. (get_pp_number): Likewise. (get_token): Likewise. * macrocmd.c (skip_ws): New function. (extract_identifier): Likewise. (free_macro_definition_ptr): Likewise. (user_macros): Remove. (macro_define_command): Implement. (_initialize_macrocmd): Update. (macro_undef_command): Implement. (print_one_macro): New function. (macro_list_command): Implement. gdb/doc * gdb.texinfo (Macros): Update. Use @code rather than @command. gdb/testsuite * gdb.base/macscp.exp: Add macro tests.
Diffstat (limited to 'gdb/macrotab.h')
-rw-r--r--gdb/macrotab.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/gdb/macrotab.h b/gdb/macrotab.h
index eb546bccf7f..5ff36ea2cd6 100644
--- a/gdb/macrotab.h
+++ b/gdb/macrotab.h
@@ -72,6 +72,8 @@ struct bcache;
/* A table of all the macro definitions for a given compilation unit. */
struct macro_table;
+/* The definition of a single macro. */
+struct macro_definition;
/* A source file that participated in a compilation unit --- either a
main file, or an #included file. If a file is #included more than
@@ -189,6 +191,11 @@ struct macro_source_file *macro_set_main (struct macro_table *table,
/* Return the main source file of the macro table TABLE. */
struct macro_source_file *macro_main (struct macro_table *table);
+/* Mark the macro table TABLE so that macros defined in this table can
+ be redefined without error. Note that it invalid to call this if
+ TABLE is allocated on an obstack. */
+void macro_allow_redefinitions (struct macro_table *table);
+
/* Record a #inclusion.
Record in SOURCE's macro table that, at line number LINE in SOURCE,
@@ -247,7 +254,6 @@ void macro_define_function (struct macro_source_file *source, int line,
void macro_undef (struct macro_source_file *source, int line,
const char *name);
-
/* Different kinds of macro definitions. */
enum macro_kind
{
@@ -298,5 +304,13 @@ struct macro_source_file *(macro_definition_location
const char *name,
int *definition_line));
+/* Callback function when walking a macro table. NAME is the name of
+ the macro, and DEFINITION is the definition. */
+typedef void (*macro_callback_fn) (const char *name,
+ const struct macro_definition *definition);
+
+/* Call the function FN for each macro in the macro table TABLE. */
+void macro_for_each (struct macro_table *table, macro_callback_fn fn);
+
#endif /* MACROTAB_H */