From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Udk7IQ4pW2HPdQAAWB0awg (envelope-from ) for ; Mon, 04 Oct 2021 12:17:18 -0400 Received: by simark.ca (Postfix, from userid 112) id 777AF1EE1A; Mon, 4 Oct 2021 12:17:18 -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 B58881E813 for ; Mon, 4 Oct 2021 12:17:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B89E3857817 for ; Mon, 4 Oct 2021 16:17:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B89E3857817 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633364237; bh=nQO57UB2lTva4csz0/s74WkgP4N4d1+QamQc2KLh0z0=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lC3Oic0R4cYKar1OwrlvgK1Iczll2/as3UWjUlIgD5gIqG0Hqy9DqijGDtFO7IY1y rYJCQ1WVkNvEPRIULLaSnAiEu09VpJGO860aWei66iG8eFZayZIlwIGZd1ZpqnOFE2 SPmdVc8znJOd5jcXeC2SMZg00yJoR4pU9Gw0qxt8= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id BBE42385800F for ; Mon, 4 Oct 2021 16:16:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BBE42385800F Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 194GGrK3028514 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Oct 2021 12:16:57 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 194GGrK3028514 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id EFFDF1E813; Mon, 4 Oct 2021 12:16:52 -0400 (EDT) Message-ID: Date: Mon, 4 Oct 2021 12:16:52 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH, master+11][gdb/build] Add CXX_DIALECT to CXX Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20210908121519.GA17723@delia> <73d742e2-c0c5-d641-83cb-ea12bc24cade@polymtl.ca> <6cb21c7a-5701-2909-7142-ef9b7296ad3e@suse.de> In-Reply-To: <6cb21c7a-5701-2909-7142-ef9b7296ad3e@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 4 Oct 2021 16:16:53 +0000 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: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-10-04 09:58, Tom de Vries wrote: > On 9/27/21 2:59 PM, Tom de Vries via Gdb-patches wrote: >> On 9/23/21 4:27 PM, Simon Marchi wrote: >>> >>> On 2021-09-08 8:15 a.m., Tom de Vries wrote: >>>> Hi, >>>> >>>> The problem reported in PR28318 is that when using a gcc version that (while >>>> supporting c++11) does not support c++11 by default, the configure test for >>>> std::thread support will fail. >>>> >>>> If gdb would use the default AX_CXX_COMPILE_STDCXX from autoconf, then we'd >>>> have: >>>> ... >>>> CXX="g++ -std=gnu++11" >>>> ... >>>> and the test for std::thread support would succeed. >>>> >>>> Instead, gdb uses a custom AX_CXX_COMPILE_STDCXX (see commit 0bcda685399) >>>> which does: >>>> ... >>>> CXX=g++ >>>> CXX_DIALECT=-std=gnu++11 >>>> ... >>>> >>>> We could add $CXX_DIALECT to the test for std::thread support, but that would >>>> have to be repeated for each added c++ support test. >>>> >>>> Instead, fix this by doing: >>>> ... >>>> CXX="g++ -std=gnu++11" >>>> CXX_DIALECT=-std=gnu++11 >>>> ... >>>> >>>> The code added in gdb/ax_cxx_compile_stdcxx.m4 is copied from the default >>>> AX_CXX_COMPILE_STDCXX from autoconf. >>> From autoconf-archive? >>> >> Yes, updated. >> >>> At first glance, it looks like CXX_DIALECT would not be needed anymore, >>> since it's only used to be appended to CXX in Makefiles. So now it >>> would end up twice in the command-line, which is not harmful but not >>> useful. >>> >>> However, if we look at the original explanation of why we have this >>> local modification: >>> >>> We need to tweak AX_CXX_COMPILE_STDCXX a bit though. Pristine >>> upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly. >>> That doesn't work for us, because the top level Makefile passes CXX >>> down to subdirs, and that overrides whatever gdb/Makefile may set CXX >>> to. The result would be that a make invocation from the build/gdb/ >>> directory would use "g++ -std=gnu++11" as expected, while a make >>> invocation at the top level would not. >>> >>> So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it >>> to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX) >>> (CXX_DIALECT)' to compile/link. >>> >>> https://gitlab.com/gnutools/binutils-gdb/-/commit/0bcda68539948828795564b35a497dc69c27f768 >>> >>> So it sounds like we need both (and your patch is correct): >>> >>> - the switch in CXX for the std::thread tests (and other tests) >>> - the switch in CXX_DIALECT so it can be appended in Makefiles, to >>> counteract the fact that the top-level Makefile overrides CXX >>> >>> This should probably be explained in the comment, because that situation >>> is strange, and people might wonder why we end up with two -std=... >>> switches, and might try to "fix" it. >> Ack, I've rewritten the commit log to make this more clear (and copied >> part of you comments). >> >> Any further comments? >> > > I'll commit this tomorrow, unless there are further comments. > > Thanks, > - Tom That LGTM, thanks. Simon