Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdbsupport/common-inferior.c: Fix mingw build
@ 2025-03-31 11:13 Lancelot SIX
  2025-03-31 12:23 ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Lancelot SIX @ 2025-03-31 11:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: aburgess, Lancelot SIX

A recent change (512ca2fca4b "gdb: split up
construct_inferior_arguments") introduced a build failure for mingw:

      CXX      common-inferior.o
    .../gdb/gdbsupport/common-inferior.cc: In function ‘std::string escape_characters(const char*, const char*)’:
    .../gdb/gdbsupport/common-inferior.cc:62:20: error: ‘argv’ was not declared in this scope; did you mean ‘arg’?
       62 |       if (strpbrk (argv[i], special))
          |                    ^~~~
          |                    arg
    .../gdb/gdbsupport/common-inferior.cc:62:25: error: ‘i’ was not declared in this scope
       62 |       if (strpbrk (argv[i], special))
          |                         ^

This patch fixes that.

Change-Id: I07ade607bc4516627b433085b07d9d198d8e4b4a
---
 gdbsupport/common-inferior.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbsupport/common-inferior.cc b/gdbsupport/common-inferior.cc
index 4b868294062..e544780bd4b 100644
--- a/gdbsupport/common-inferior.cc
+++ b/gdbsupport/common-inferior.cc
@@ -59,7 +59,7 @@ escape_characters (const char *arg, const char *special)
 #ifdef __MINGW32__
       bool quoted = false;
 
-      if (strpbrk (argv[i], special))
+      if (strpbrk (arg, special))
 	{
 	  quoted = true;
 	  result += quote;

base-commit: 7109ea04ac79f641c48b6a1e6a2f3fc38a83c2ed
-- 
2.43.0


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

* Re: [PATCH] gdbsupport/common-inferior.c: Fix mingw build
  2025-03-31 11:13 [PATCH] gdbsupport/common-inferior.c: Fix mingw build Lancelot SIX
@ 2025-03-31 12:23 ` Tom de Vries
  2025-03-31 13:06   ` Lancelot SIX
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2025-03-31 12:23 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches; +Cc: aburgess

On 3/31/25 13:13, Lancelot SIX wrote:
> A recent change (512ca2fca4b "gdb: split up
> construct_inferior_arguments") introduced a build failure for mingw:
> 
>        CXX      common-inferior.o
>      .../gdb/gdbsupport/common-inferior.cc: In function ‘std::string escape_characters(const char*, const char*)’:
>      .../gdb/gdbsupport/common-inferior.cc:62:20: error: ‘argv’ was not declared in this scope; did you mean ‘arg’?
>         62 |       if (strpbrk (argv[i], special))
>            |                    ^~~~
>            |                    arg
>      .../gdb/gdbsupport/common-inferior.cc:62:25: error: ‘i’ was not declared in this scope
>         62 |       if (strpbrk (argv[i], special))
>            |                         ^
> 
> This patch fixes that.
> 

Hi Lancelot,

thanks for fixing this.

I've reproduced the problem, and verified that the patch fixes it.

I've looked at the patch introducing the problem, and I agree with the fix.

Approved-By: Tom de Vries <tdevries@suse.de>

FWIW, there's a pre-existing style issue here, the strpbrk should be 
explicitly tested against nullptr, but I noticed the same issue in 
another file, so I propose that we leave this patch as is, and that I 
follow up with a patch taking care of that issue in both files.

Thanks,
- Tom

> Change-Id: I07ade607bc4516627b433085b07d9d198d8e4b4a
> ---
>   gdbsupport/common-inferior.cc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdbsupport/common-inferior.cc b/gdbsupport/common-inferior.cc
> index 4b868294062..e544780bd4b 100644
> --- a/gdbsupport/common-inferior.cc
> +++ b/gdbsupport/common-inferior.cc
> @@ -59,7 +59,7 @@ escape_characters (const char *arg, const char *special)
>   #ifdef __MINGW32__
>         bool quoted = false;
>   
> -      if (strpbrk (argv[i], special))
> +      if (strpbrk (arg, special))
>   	{
>   	  quoted = true;
>   	  result += quote;
> 
> base-commit: 7109ea04ac79f641c48b6a1e6a2f3fc38a83c2ed


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

* Re: [PATCH] gdbsupport/common-inferior.c: Fix mingw build
  2025-03-31 12:23 ` Tom de Vries
@ 2025-03-31 13:06   ` Lancelot SIX
  0 siblings, 0 replies; 3+ messages in thread
From: Lancelot SIX @ 2025-03-31 13:06 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: aburgess


> Hi Lancelot,
> 
> thanks for fixing this.
> 
> I've reproduced the problem, and verified that the patch fixes it.
> 
> I've looked at the patch introducing the problem, and I agree with the fix.
> 
> Approved-By: Tom de Vries <tdevries@suse.de>
> 
> FWIW, there's a pre-existing style issue here, the strpbrk should be
> explicitly tested against nullptr, but I noticed the same issue in
> another file, so I propose that we leave this patch as is, and that I
> follow up with a patch taking care of that issue in both files.
> 
> Thanks,
> - Tom

Thanks,

I pushed that initial fix as 7b34a95034f.

Best,
Lancelot.

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

end of thread, other threads:[~2025-03-31 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-31 11:13 [PATCH] gdbsupport/common-inferior.c: Fix mingw build Lancelot SIX
2025-03-31 12:23 ` Tom de Vries
2025-03-31 13:06   ` Lancelot SIX

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