diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2024-07-24 15:07:14 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2024-07-30 08:52:57 -0400 |
commit | 1cb8a69ec2955e736e24340ef476fed5abeb7703 (patch) | |
tree | 455e2660fbd9baef25503f966967702810efc008 /gdb/macrotab.h | |
parent | a7763df8fbabe0d364d7f1e418683ee460518998 (diff) | |
download | gdb-1cb8a69ec2955e736e24340ef476fed5abeb7703.zip gdb-1cb8a69ec2955e736e24340ef476fed5abeb7703.tar.gz gdb-1cb8a69ec2955e736e24340ef476fed5abeb7703.tar.bz2 |
gdb: use std::string vector for macro definition
Use std::vector<std::string> when defining macros, to avoid the manual
memory management.
With the use of std::vector, the separate `int argc` parameter is no
longer needed, we can use the size of the vector instead. However, for
some functions, this parameter had a dual function. For object-like
macros, it was interpreted as a `macro_special_kind` enum. For these
functions, remove `argc`, but add a new `special_kind` parameter.
Change-Id: Ice76a6863dfe598335e3b8d5d077513e50975cc5
Approved-By: Tom de Vries <tdevries@suse.de>
Diffstat (limited to 'gdb/macrotab.h')
-rw-r--r-- | gdb/macrotab.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gdb/macrotab.h b/gdb/macrotab.h index 789beed..d501595 100644 --- a/gdb/macrotab.h +++ b/gdb/macrotab.h @@ -242,26 +242,23 @@ struct macro_source_file *macro_lookup_inclusion Record in SOURCE's macro table that, at line number LINE in SOURCE, we #defined a preprocessor symbol named NAME, whose replacement string is REPLACEMENT. This function makes copies of NAME and - REPLACEMENT; the caller is responsible for freeing them. */ + REPLACEMENT. */ void macro_define_object (struct macro_source_file *source, int line, const char *name, const char *replacement); -/* Record an function-like #definition (i.e., one with a parameter list). +/* Record a function-like #definition (i.e., one with a parameter list). Record in SOURCE's macro table that, at line number LINE in SOURCE, - we #defined a preprocessor symbol named NAME, with ARGC arguments - whose names are given in ARGV, whose replacement string is REPLACEMENT. If - the macro takes a variable number of arguments, then ARGC should be - one greater than the number of named arguments, and ARGV[ARGC-1] - should be the string "...". This function makes its own copies of - NAME, ARGV, and REPLACEMENT; the caller is responsible for freeing - them. */ -void macro_define_function (struct macro_source_file *source, int line, - const char *name, int argc, const char **argv, + we #defined a preprocessor symbol named NAME, with argument names given by + ARGV, whose replacement string is REPLACEMENT. If the macro takes a variable + number of arguments, then the last element of ARGV should be the string + "...". This function makes copies of NAME, ARGV, and REPLACEMENT. */ +void macro_define_function (macro_source_file *source, int line, + const char *name, + const std::vector<std::string> &argv, const char *replacement); - /* Record an #undefinition. Record in SOURCE's macro table that, at line number LINE in SOURCE, we removed the definition for the preprocessor symbol named NAME. */ |