Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH][gdb] Fix regoff_t incompatibility
@ 2021-04-13 12:21 Tom de Vries
  2021-04-13 12:39 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-04-13 12:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Hi,

I did an experiment with importing the regex module in gnulib, and trying to
build gdb.

The first problem I ran into was that:
- regoff_t was defined as long int, and
- the address of a regoff_t variable i in ui_file_style::parse was passed
  as int * to function extended_color.

Fix this by changing the types of some function parameters of functions
read_semi_number and extended_color from int * to regoff_t *.

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb] Fix regoff_t incompatibility

gdb/ChangeLog:

2021-04-13  Tom de Vries  <tdevries@suse.de>

	* ui-style.c (read_semi_number, extended_color): Change idx parameter
	type to regoff_t *.

---
 gdb/ui-style.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index 7deb4ac363f..2fda9d13fd3 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -169,7 +169,7 @@ ui_file_style::to_ansi () const
    characters read and put the number into *NUM.  */
 
 static bool
-read_semi_number (const char *string, int *idx, long *num)
+read_semi_number (const char *string, regoff_t *idx, long *num)
 {
   if (string[*idx] != ';')
     return false;
@@ -186,7 +186,7 @@ read_semi_number (const char *string, int *idx, long *num)
    sequence; that is, and 8- or 24- bit color.  */
 
 static bool
-extended_color (const char *str, int *idx, ui_file_style::color *color)
+extended_color (const char *str, regoff_t *idx, ui_file_style::color *color)
 {
   long value;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][gdb] Fix regoff_t incompatibility
  2021-04-13 12:21 [PATCH][gdb] Fix regoff_t incompatibility Tom de Vries
@ 2021-04-13 12:39 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2021-04-13 12:39 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Tom Tromey, gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> gdb/ChangeLog:

Tom> 2021-04-13  Tom de Vries  <tdevries@suse.de>

Tom> 	* ui-style.c (read_semi_number, extended_color): Change idx parameter
Tom> 	type to regoff_t *.

Looks good.  Thank you.  Given that ui_file_style::parse is already
using regoff_t, I think this patch would qualify as an obvious fix.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-13 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 12:21 [PATCH][gdb] Fix regoff_t incompatibility Tom de Vries
2021-04-13 12:39 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox