From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uDJTOmKQTGFoFwAAWB0awg (envelope-from ) for ; Thu, 23 Sep 2021 10:34:10 -0400 Received: by simark.ca (Postfix, from userid 112) id EC1EE1EE25; Thu, 23 Sep 2021 10:34:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 F219C1EE14 for ; Thu, 23 Sep 2021 10:34:09 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AEFFD385840A for ; Thu, 23 Sep 2021 14:34:09 +0000 (GMT) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by sourceware.org (Postfix) with ESMTPS id 93EE63858D34 for ; Thu, 23 Sep 2021 14:33:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 93EE63858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f52.google.com with SMTP id d6so17704145wrc.11 for ; Thu, 23 Sep 2021 07:33:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GZwuhpTgJibc9tXW2lZQ3ZeIVb2AIvDZRgF+LBu/evo=; b=ZqFXA/8s6jGyDi3CPd0tLpBMdJc3stVq9MVi44qGyFP+C5tj2YxzGQAnA+AYFqFsvP WX8F9Q6MQx5cL+JmBN5a06vrQCW34bg1KeVpx5LjKlocK0b2PAmSDMcEWy7roD9yCXza bDqxUULzWL848711ECLZLH0mi9YVR7LzHCtUX1kvZfpXY92aPFmqggeiHMy48RUs91iv ZolXw9+66iwOLKEegDquP+7LUSOtp8fP39XlmsyiFtjfg4sARLyXoxWC4VD71tkwfBrE /RO/nfuV8AcEVuQMVlkNJjKZsde0Doo7RxdG8WrYj3KeHwmhO59wfjWyEJdT2nuJtB7E 5ZSA== X-Gm-Message-State: AOAM532tNmzEZenIgtHiC2ozUHQrdiF8YsuBq5pQvq0lZef8+4H7Oxlx OzNf0/EYtNsVPrEaKBI2dWHksgzhed0= X-Google-Smtp-Source: ABdhPJy1l+Kr3Cs7erMSuaVXeGX5kYhb34fmtOxJzkfbFgyCFBaQ153Nl8dup2/vh7nOXPfGcwLVvg== X-Received: by 2002:a05:600c:b41:: with SMTP id k1mr16784495wmr.4.1632407636791; Thu, 23 Sep 2021 07:33:56 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:46bc:d03b:7b3a:2227? ([2001:8a0:f932:6a00:46bc:d03b:7b3a:2227]) by smtp.gmail.com with ESMTPSA id c8sm5715303wru.30.2021.09.23.07.33.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Sep 2021 07:33:55 -0700 (PDT) Subject: Re: [PATCH, master+11][gdb/build] Add CXX_DIALECT to CXX From: Pedro Alves To: Simon Marchi , Tom de Vries , gdb-patches@sourceware.org References: <20210908121519.GA17723@delia> <73d742e2-c0c5-d641-83cb-ea12bc24cade@polymtl.ca> Message-ID: <765b79ca-2f03-b22b-482d-9325b1dbe2f2@palves.net> Date: Thu, 23 Sep 2021 15:33:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <73d742e2-c0c5-d641-83cb-ea12bc24cade@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-09-23 3:27 p.m., 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? > > 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 Thanks for raising this aspect. I had been meaning to reply raising it, and ask where that original motivation is still a concern, as it wasn't clear from the patch description. Pedro Alves > > 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. > > Simon >