public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix cygwin build error
@ 2021-03-15 13:35 Christian Biesinger
  2021-03-15 16:47 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Biesinger @ 2021-03-15 13:35 UTC (permalink / raw)
  To: gdb-patches

With "gcc version 10.2.0 (GCC)" on cygwin, I get this build error:
  CXX    windows-nat.o
In file included from ../../gdb/../gdbsupport/common-defs.h:129,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/windows-nat.c:24:
../../gdb/windows-nat.c: In function ‘void windows_init_thread_list()’:
../../gdb/windows-nat.c:513:17: error: zero-length gnu_printf format string [-Werror=format-zero-length]
  513 |   DEBUG_EVENTS ("");
      |                 ^~
../../gdb/../gdbsupport/common-debug.h:65:43: note: in definition of macro ‘debug_prefixed_printf_cond’
   65 |  debug_prefixed_printf (module, __func__, fmt, ##__VA_ARGS__); \
      |                                           ^~~
../../gdb/windows-nat.c:513:3: note: in expansion of macro ‘DEBUG_EVENTS’
  513 |   DEBUG_EVENTS ("");
      |   ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors

This was introduced in 4ef367bffd73d50002339deba40983530ccb9d15, which removed
the function name from this debug message:
-  DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
+  DEBUG_EVENTS ("");

This patch just restores the function name. This will probably be easier to
understand as well.

gdb/ChangeLog:

2021-03-15  Christian Biesinger  <cbiesinger@google.com>

	* windows-nat.c (windows_init_thread_list): Add function name to
	debug log.
---
 gdb/windows-nat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 8f6fb3ddcdf..269c41a3097 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -510,7 +510,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb, bool main_thread_p)
 static void
 windows_init_thread_list (void)
 {
-  DEBUG_EVENTS ("");
+  DEBUG_EVENTS ("windows_init_thread_list");
   init_thread_list ();
 
   for (windows_thread_info *here : thread_list)
-- 
2.31.0.rc2.261.g7f71774620-goog


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

* Re: [PATCH] Fix cygwin build error
  2021-03-15 13:35 [PATCH] Fix cygwin build error Christian Biesinger
@ 2021-03-15 16:47 ` Simon Marchi
  2021-03-16 15:50   ` Christian Biesinger
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2021-03-15 16:47 UTC (permalink / raw)
  To: Christian Biesinger, gdb-patches



On 2021-03-15 9:35 a.m., Christian Biesinger via Gdb-patches wrote:
> With "gcc version 10.2.0 (GCC)" on cygwin, I get this build error:
>   CXX    windows-nat.o
> In file included from ../../gdb/../gdbsupport/common-defs.h:129,
>                  from ../../gdb/defs.h:28,
>                  from ../../gdb/windows-nat.c:24:
> ../../gdb/windows-nat.c: In function ‘void windows_init_thread_list()’:
> ../../gdb/windows-nat.c:513:17: error: zero-length gnu_printf format string [-Werror=format-zero-length]
>   513 |   DEBUG_EVENTS ("");
>       |                 ^~
> ../../gdb/../gdbsupport/common-debug.h:65:43: note: in definition of macro ‘debug_prefixed_printf_cond’
>    65 |  debug_prefixed_printf (module, __func__, fmt, ##__VA_ARGS__); \
>       |                                           ^~~
> ../../gdb/windows-nat.c:513:3: note: in expansion of macro ‘DEBUG_EVENTS’
>   513 |   DEBUG_EVENTS ("");
>       |   ^~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
> 
> This was introduced in 4ef367bffd73d50002339deba40983530ccb9d15, which removed
> the function name from this debug message:
> -  DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
> +  DEBUG_EVENTS ("");
> 
> This patch just restores the function name. This will probably be easier to
> understand as well.
> 
> gdb/ChangeLog:
> 
> 2021-03-15  Christian Biesinger  <cbiesinger@google.com>
> 
> 	* windows-nat.c (windows_init_thread_list): Add function name to
> 	debug log.
> ---
>  gdb/windows-nat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 8f6fb3ddcdf..269c41a3097 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -510,7 +510,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb, bool main_thread_p)
>  static void
>  windows_init_thread_list (void)
>  {
> -  DEBUG_EVENTS ("");
> +  DEBUG_EVENTS ("windows_init_thread_list");
>    init_thread_list ();
>  
>    for (windows_thread_info *here : thread_list)
> 

The function name is already included by debug_prefixed_printf_cond, so
this will appear as

  windows_init_thread_list: windows_init_thread_list

What I've used so far for debug prints that just want to say that a
given function gets called is "called", I suggest you use that:

  DEBUG_EVENTS ("called");

This is ok to push either way.

Simon

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

* Re: [PATCH] Fix cygwin build error
  2021-03-15 16:47 ` Simon Marchi
@ 2021-03-16 15:50   ` Christian Biesinger
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Biesinger @ 2021-03-16 15:50 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On Mon, Mar 15, 2021 at 5:47 PM Simon Marchi <simon.marchi@polymtl.ca> wrote:
> On 2021-03-15 9:35 a.m., Christian Biesinger via Gdb-patches wrote:
> > With "gcc version 10.2.0 (GCC)" on cygwin, I get this build error:
> >   CXX    windows-nat.o
> > In file included from ../../gdb/../gdbsupport/common-defs.h:129,
> >                  from ../../gdb/defs.h:28,
> >                  from ../../gdb/windows-nat.c:24:
> > ../../gdb/windows-nat.c: In function ‘void windows_init_thread_list()’:
> > ../../gdb/windows-nat.c:513:17: error: zero-length gnu_printf format string [-Werror=format-zero-length]
> >   513 |   DEBUG_EVENTS ("");
> >       |                 ^~
> > ../../gdb/../gdbsupport/common-debug.h:65:43: note: in definition of macro ‘debug_prefixed_printf_cond’
> >    65 |  debug_prefixed_printf (module, __func__, fmt, ##__VA_ARGS__); \
> >       |                                           ^~~
> > ../../gdb/windows-nat.c:513:3: note: in expansion of macro ‘DEBUG_EVENTS’
> >   513 |   DEBUG_EVENTS ("");
> >       |   ^~~~~~~~~~~~
> > cc1plus: all warnings being treated as errors
> >
> > This was introduced in 4ef367bffd73d50002339deba40983530ccb9d15, which removed
> > the function name from this debug message:
> > -  DEBUG_EVENTS (("gdb: windows_init_thread_list\n"));
> > +  DEBUG_EVENTS ("");
> >
> > This patch just restores the function name. This will probably be easier to
> > understand as well.
> >
> > gdb/ChangeLog:
> >
> > 2021-03-15  Christian Biesinger  <cbiesinger@google.com>
> >
> >       * windows-nat.c (windows_init_thread_list): Add function name to
> >       debug log.
> > ---
> >  gdb/windows-nat.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> > index 8f6fb3ddcdf..269c41a3097 100644
> > --- a/gdb/windows-nat.c
> > +++ b/gdb/windows-nat.c
> > @@ -510,7 +510,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb, bool main_thread_p)
> >  static void
> >  windows_init_thread_list (void)
> >  {
> > -  DEBUG_EVENTS ("");
> > +  DEBUG_EVENTS ("windows_init_thread_list");
> >    init_thread_list ();
> >
> >    for (windows_thread_info *here : thread_list)
> >
>
> The function name is already included by debug_prefixed_printf_cond, so
> this will appear as
>
>   windows_init_thread_list: windows_init_thread_list
>
> What I've used so far for debug prints that just want to say that a
> given function gets called is "called", I suggest you use that:
>
>   DEBUG_EVENTS ("called");
>
> This is ok to push either way.

Thank you, I pushed this with that change & a corresponding update to
the commit message.

Christian

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

end of thread, other threads:[~2021-03-16 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 13:35 [PATCH] Fix cygwin build error Christian Biesinger
2021-03-15 16:47 ` Simon Marchi
2021-03-16 15:50   ` Christian Biesinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).