From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mRXFDiJgOGGlTwAAWB0awg (envelope-from ) for ; Wed, 08 Sep 2021 03:02:58 -0400 Received: by simark.ca (Postfix, from userid 112) id EBDDA1EE22; Wed, 8 Sep 2021 03:02:57 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D12DE1EDDB for ; Wed, 8 Sep 2021 03:02:51 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC535385043F for ; Wed, 8 Sep 2021 07:02:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC535385043F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631084569; bh=z5J6HQZnH5TK5LHSGFjO2QyzwP7B+95BoFmlW7yrMBQ=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=onhVLlvCsKXF3RRNKrgcWqENNy+QNB5dOJbJJERtMF4mZr+KpyJRS4fTF85X5YEtc Xx/gVLoj//ZDPW9he7p7+jSTP6lRmlV2E0O69Kja4qutO5UV3yksj2n/CijMvYw9eK iTYpTWRU+StX+UOmlz67ou3aws3frR8YVWxTFsys= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id CC17B386181F for ; Wed, 8 Sep 2021 07:02:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC17B386181F Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1283A221EE; Wed, 8 Sep 2021 07:02:11 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id E3999137FE; Wed, 8 Sep 2021 07:02:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id 2/r7NfJfOGFlPgAAGKfGzw (envelope-from ); Wed, 08 Sep 2021 07:02:10 +0000 Subject: Re: [PATCH][gdb/build] Fix build with undefined CXX_STD_THREAD To: Christian Biesinger References: <20210907145006.GA4878@delia> Message-ID: <8c09dea9-6a28-d838-842c-72876db50697@suse.de> Date: Wed, 8 Sep 2021 09:02:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------784ACDF94FF79ED7BC05DFF0" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Tom Tromey , gdb-patches Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------784ACDF94FF79ED7BC05DFF0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 9/7/21 6:12 PM, Christian Biesinger wrote: > BTW, it seems https://sourceware.org/bugzilla/show_bug.cgi?id=28312 > was filed for this. > Thanks, I've added a Bug tag. Pushed as attached. I've rewritten it a bit to avoid introducing a 3rd printf. Thanks, - Tom --------------784ACDF94FF79ED7BC05DFF0 Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-build-Fix-build-with-undefined-CXX_STD_THREAD.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdb-build-Fix-build-with-undefined-CXX_STD_THREAD.patch" [gdb/build] Fix build with undefined CXX_STD_THREAD 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. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28312 --- gdb/maint.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/gdb/maint.c b/gdb/maint.c index cbd7d4ed47b..8f8bdc87be8 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -871,14 +871,23 @@ 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"), - gdb::thread_pool::g_thread_pool->thread_count ()); - else - fprintf_filtered (file, _("The number of worker threads GDB " - "can use is %d.\n"), - n_worker_threads); + { + fprintf_filtered (file, _("The number of worker threads GDB " + "can use is unlimited (currently %zu).\n"), + gdb::thread_pool::g_thread_pool->thread_count ()); + return; + } +#endif + + int report_threads = 0; +#if CXX_STD_THREAD + report_threads = n_worker_threads; +#endif + fprintf_filtered (file, _("The number of worker threads GDB " + "can use is %d.\n"), + report_threads); } --------------784ACDF94FF79ED7BC05DFF0--