* [PATCH 0/3] Remove remaining LA_* macros
@ 2022-02-10 23:31 Tom Tromey
2022-02-10 23:31 ` [PATCH 1/3] Remove LA_PRINT_TYPE Tom Tromey
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Tom Tromey @ 2022-02-10 23:31 UTC (permalink / raw)
To: gdb-patches
Many of the old-style LA_* macros were removed back in 2020. However,
a few remain. This series removes these remaining macros, in favor of
simply writing out ordinary method calls.
Let me know what you think.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Remove LA_PRINT_TYPE
2022-02-10 23:31 [PATCH 0/3] Remove remaining LA_* macros Tom Tromey
@ 2022-02-10 23:31 ` Tom Tromey
2022-02-10 23:31 ` [PATCH 2/3] Remove LA_PRINT_CHAR Tom Tromey
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-02-10 23:31 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This removes the LA_PRINT_TYPE macro, in favor of using ordinary
method calls.
---
gdb/guile/scm-type.c | 3 ++-
gdb/language.h | 3 ---
gdb/python/py-type.c | 5 +++--
gdb/symmisc.c | 18 +++++++++---------
gdb/typeprint.c | 5 +++--
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 987660ceaf9..27d00f12a95 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -108,7 +108,8 @@ tyscm_type_name (struct type *type)
{
string_file stb;
- LA_PRINT_TYPE (type, "", &stb, -1, 0, &type_print_raw_options);
+ current_language->print_type (type, "", &stb, -1, 0,
+ &type_print_raw_options);
return stb.release ();
}
catch (const gdb_exception &except)
diff --git a/gdb/language.h b/gdb/language.h
index bfdade398e4..3930f5bd223 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -755,9 +755,6 @@ extern enum language set_language (enum language);
the current setting of working_lang, which the user sets
with the "set language" command. */
-#define LA_PRINT_TYPE(type,varstring,stream,show,level,flags) \
- (current_language->print_type(type,varstring,stream,show,level,flags))
-
#define LA_PRINT_CHAR(ch, type, stream) \
(current_language->printchar (ch, type, stream))
#define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options) \
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 9df667d2811..8613534d060 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -1025,8 +1025,9 @@ typy_str (PyObject *self)
try
{
- LA_PRINT_TYPE (type_object_to_type (self), "", &thetype, -1, 0,
- &type_print_raw_options);
+ current_language->print_type (type_object_to_type (self), "",
+ &thetype, -1, 0,
+ &type_print_raw_options);
}
catch (const gdb_exception &except)
{
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 160278b50a9..114d6bc5e53 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -525,8 +525,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
{
if (symbol->type ()->name ())
{
- LA_PRINT_TYPE (symbol->type (), "", outfile, 1, depth,
- &type_print_raw_options);
+ current_language->print_type (symbol->type (), "", outfile, 1, depth,
+ &type_print_raw_options);
}
else
{
@@ -536,8 +536,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
: (symbol->type ()->code () == TYPE_CODE_STRUCT
? "struct" : "union")),
symbol->linkage_name ());
- LA_PRINT_TYPE (symbol->type (), "", outfile, 1, depth,
- &type_print_raw_options);
+ current_language->print_type (symbol->type (), "", outfile, 1, depth,
+ &type_print_raw_options);
}
fprintf_filtered (outfile, ";\n");
}
@@ -548,11 +548,11 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
if (symbol->type ())
{
/* Print details of types, except for enums where it's clutter. */
- LA_PRINT_TYPE (symbol->type (), symbol->print_name (),
- outfile,
- symbol->type ()->code () != TYPE_CODE_ENUM,
- depth,
- &type_print_raw_options);
+ current_language->print_type (symbol->type (), symbol->print_name (),
+ outfile,
+ symbol->type ()->code () != TYPE_CODE_ENUM,
+ depth,
+ &type_print_raw_options);
fprintf_filtered (outfile, "; ");
}
else
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index f7a2ebac398..c15a9c6b59f 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -392,7 +392,8 @@ void
type_print (struct type *type, const char *varstring, struct ui_file *stream,
int show)
{
- LA_PRINT_TYPE (type, varstring, stream, show, 0, &default_ptype_flags);
+ current_language->print_type (type, varstring, stream, show, 0,
+ &default_ptype_flags);
}
/* Print TYPE to a string, returning it. The caller is responsible for
@@ -578,7 +579,7 @@ whatis_exp (const char *exp, int show)
printf_filtered (" */\n");
}
- LA_PRINT_TYPE (type, "", gdb_stdout, show, 0, &flags);
+ current_language->print_type (type, "", gdb_stdout, show, 0, &flags);
printf_filtered ("\n");
}
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] Remove LA_PRINT_CHAR
2022-02-10 23:31 [PATCH 0/3] Remove remaining LA_* macros Tom Tromey
2022-02-10 23:31 ` [PATCH 1/3] Remove LA_PRINT_TYPE Tom Tromey
@ 2022-02-10 23:31 ` Tom Tromey
2022-02-10 23:31 ` [PATCH 3/3] Remove LA_PRINT_STRING Tom Tromey
2022-02-11 1:18 ` [PATCH 0/3] Remove remaining LA_* macros Simon Marchi via Gdb-patches
3 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-02-10 23:31 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This removes the LA_PRINT_CHAR macro, in favor of using ordinary
method calls.
---
gdb/ada-valprint.c | 2 +-
gdb/c-valprint.c | 3 ++-
gdb/language.h | 2 --
gdb/typeprint.c | 2 +-
gdb/valprint.c | 2 +-
5 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index adab6b42f5b..a59c392bef4 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -402,7 +402,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
break;
case TYPE_CODE_CHAR:
- LA_PRINT_CHAR (val, type, stream);
+ current_language->printchar (val, type, stream);
break;
case TYPE_CODE_BOOL:
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index fadbc5b7022..047e5687b0a 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -409,7 +409,8 @@ c_value_print_int (struct value *val, struct ui_file *stream,
if (c_textual_element_type (type, options->format))
{
fputs_filtered (" ", stream);
- LA_PRINT_CHAR (unpack_long (type, valaddr), type, stream);
+ current_language->printchar (unpack_long (type, valaddr), type,
+ stream);
}
}
}
diff --git a/gdb/language.h b/gdb/language.h
index 3930f5bd223..4eb414bbe12 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -755,8 +755,6 @@ extern enum language set_language (enum language);
the current setting of working_lang, which the user sets
with the "set language" command. */
-#define LA_PRINT_CHAR(ch, type, stream) \
- (current_language->printchar (ch, type, stream))
#define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options) \
(current_language->printstr (stream, elttype, string, length, \
encoding, force_ellipses,options))
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index c15a9c6b59f..8cb34ad1921 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -647,7 +647,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
break;
case TYPE_CODE_CHAR:
- LA_PRINT_CHAR ((unsigned char) val, type, stream);
+ current_language->printchar ((unsigned char) val, type, stream);
break;
case TYPE_CODE_BOOL:
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 25e4a8dc8e1..07bc324be5d 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -791,7 +791,7 @@ generic_value_print_char (struct value *value, struct ui_file *stream,
else
fprintf_filtered (stream, "%d", (int) val);
fputs_filtered (" ", stream);
- LA_PRINT_CHAR (val, unresolved_type, stream);
+ current_language->printchar (val, unresolved_type, stream);
}
}
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] Remove LA_PRINT_STRING
2022-02-10 23:31 [PATCH 0/3] Remove remaining LA_* macros Tom Tromey
2022-02-10 23:31 ` [PATCH 1/3] Remove LA_PRINT_TYPE Tom Tromey
2022-02-10 23:31 ` [PATCH 2/3] Remove LA_PRINT_CHAR Tom Tromey
@ 2022-02-10 23:31 ` Tom Tromey
2022-02-11 1:18 ` [PATCH 0/3] Remove remaining LA_* macros Simon Marchi via Gdb-patches
3 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-02-10 23:31 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This removes the LA_PRINT_STRING macro, in favor of using ordinary
method calls.
---
gdb/c-valprint.c | 6 +++---
gdb/language.h | 9 ---------
gdb/valprint.c | 7 +++----
gdb/varobj.c | 4 ++--
4 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 047e5687b0a..0d30700c06d 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -277,7 +277,7 @@ c_value_print_array (struct value *val,
++temp_len)
;
- /* Force LA_PRINT_STRING to print ellipses if
+ /* Force printstr to print ellipses if
we've printed the maximum characters and
the next character is not \000. */
if (temp_len == options->print_max && temp_len < len)
@@ -292,8 +292,8 @@ c_value_print_array (struct value *val,
len = temp_len;
}
- LA_PRINT_STRING (stream, unresolved_elttype, valaddr, len,
- NULL, force_ellipses, options);
+ current_language->printstr (stream, unresolved_elttype, valaddr, len,
+ NULL, force_ellipses, options);
}
else
{
diff --git a/gdb/language.h b/gdb/language.h
index 4eb414bbe12..f2885000259 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -750,15 +750,6 @@ extern void language_info ();
extern enum language set_language (enum language);
\f
-/* This page contains functions that return things that are
- specific to languages. Each of these functions is based on
- the current setting of working_lang, which the user sets
- with the "set language" command. */
-
-#define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options) \
- (current_language->printstr (stream, elttype, string, length, \
- encoding, force_ellipses,options))
-
/* Test a character to decide whether it can be printed in literal form
or needs to be printed in another representation. For example,
in C the literal form of the character with octal value 141 is 'a'
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 07bc324be5d..d6ec64845f4 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2767,10 +2767,9 @@ val_print_string (struct type *elttype, const char *encoding,
But if we fetch something and then get an error, print the string
and then the error message. */
if (err == 0 || bytes_read > 0)
- {
- LA_PRINT_STRING (stream, elttype, buffer.get (), bytes_read / width,
- encoding, force_ellipsis, options);
- }
+ current_language->printstr (stream, elttype, buffer.get (),
+ bytes_read / width,
+ encoding, force_ellipsis, options);
if (err != 0)
{
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 80216a455e8..5617131da20 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2232,8 +2232,8 @@ varobj_value_get_print_value (struct value *value,
/* If the THEVALUE has contents, it is a regular string. */
if (!thevalue.empty ())
- LA_PRINT_STRING (&stb, type, (gdb_byte *) thevalue.c_str (),
- len, encoding.get (), 0, &opts);
+ current_language->printstr (&stb, type, (gdb_byte *) thevalue.c_str (),
+ len, encoding.get (), 0, &opts);
else if (string_print)
/* Otherwise, if string_print is set, and it is not a regular
string, it is a lazy string. */
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Remove remaining LA_* macros
2022-02-10 23:31 [PATCH 0/3] Remove remaining LA_* macros Tom Tromey
` (2 preceding siblings ...)
2022-02-10 23:31 ` [PATCH 3/3] Remove LA_PRINT_STRING Tom Tromey
@ 2022-02-11 1:18 ` Simon Marchi via Gdb-patches
3 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi via Gdb-patches @ 2022-02-11 1:18 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2022-02-10 18:31, Tom Tromey wrote:
> Many of the old-style LA_* macros were removed back in 2020. However,
> a few remain. This series removes these remaining macros, in favor of
> simply writing out ordinary method calls.
>
> Let me know what you think.
>
> Tom
>
>
Looks all good to me!
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-11 1:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 23:31 [PATCH 0/3] Remove remaining LA_* macros Tom Tromey
2022-02-10 23:31 ` [PATCH 1/3] Remove LA_PRINT_TYPE Tom Tromey
2022-02-10 23:31 ` [PATCH 2/3] Remove LA_PRINT_CHAR Tom Tromey
2022-02-10 23:31 ` [PATCH 3/3] Remove LA_PRINT_STRING Tom Tromey
2022-02-11 1:18 ` [PATCH 0/3] Remove remaining LA_* macros Simon Marchi via Gdb-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox