public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/build] Fix build with undefined CXX_STD_THREAD
@ 2021-09-07 14:50 Tom de Vries
  2021-09-07 15:19 ` Tom de Vries
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2021-09-07 14:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Hi,

When building gdb on openSUSE Leap 42.3, we trigger the case that
CXX_STD_THREAD is undefined, and run into:
...
gdb/maint.c: In function ‘void maintenance_show_worker_threads \
  (ui_file*, int, cmd_list_element*, const char*)’:
gdb/maint.c:877:14: error: ‘gdb::thread_pool’ has not been declared
         gdb::thread_pool::g_thread_pool->thread_count ());
              ^
Makefile:1647: recipe for target 'maint.o' failed
make[1]: *** [maint.o] Error 1
...

Fix this by handling the undefined CXX_STD_THREAD case in
maintenance_show_worker_threads, such that we get:
...
$ gdb -q -batch -ex "maint show worker-thread"
The number of worker threads GDB can use is 0.
...

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/build] Fix build with undefined CXX_STD_THREAD

---
 gdb/maint.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gdb/maint.c b/gdb/maint.c
index cbd7d4ed47b..56a197c2a14 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -871,6 +871,7 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
 				 struct cmd_list_element *c,
 				 const char *value)
 {
+#if CXX_STD_THREAD
   if (n_worker_threads == -1)
     fprintf_filtered (file, _("The number of worker threads GDB "
 			      "can use is unlimited (currently %zu).\n"),
@@ -879,6 +880,10 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
     fprintf_filtered (file, _("The number of worker threads GDB "
 			      "can use is %d.\n"),
 		      n_worker_threads);
+#else
+  fprintf_filtered (file, _("The number of worker threads GDB "
+			    "can use is 0.\n"));
+#endif
 }
 
 \f

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

end of thread, other threads:[~2021-09-08  8:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 14:50 [PATCH][gdb/build] Fix build with undefined CXX_STD_THREAD Tom de Vries
2021-09-07 15:19 ` Tom de Vries
2021-09-07 16:12   ` Christian Biesinger
2021-09-08  7:02     ` Tom de Vries
2021-09-08  8:06   ` Tom de Vries

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).