From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.22]) by sourceware.org (Postfix) with ESMTPS id E0F82385800A for ; Wed, 6 Oct 2021 00:06:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0F82385800A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=clisp.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=clisp.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1633478740; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4S3KtRZDHg8eTB5c8n6a0/DxfoB/dNFWyCUqWVEPpXE=; b=Mgh4LjgfWChCi97KncTIv3UV0SiyURVsfQZi/tinte9dGF4MPNuUJ7gncWh9yMCg+4 ztyOPPkNdKL9gjf41BJG56O6vU6Kg+aDbjLHVFDMGvNBYstlYRw5fty+kwTQ7oYHSz6x Mnzj0jwARx0we1xrSG78CljX78VdP8L1jxS8DjFZv7zoimnGT9Q5EhGrGbuqNxLWpQYL AhkZx1Nj6qttfG5m86w/a7W5xAIcH4vtKXhmcOvuT/GlJsoHkFGMAC3GUv9VyAf0lyI2 cCHnodl28sSYuVDKuD/lexRQq8Na0MMJsl0quOghY/93UBPfm9uremZLJAkQ5V/x4g0H 5ugA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94z26ll5ip69olkVub7VDqFSiXC8Jy5TTCjXi" X-RZG-CLASS-ID: mo00 Received: from omega.localnet by smtp.strato.de (RZmta 47.33.8 AUTH) with ESMTPSA id 6080fbx9605dJJq (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 6 Oct 2021 02:05:39 +0200 (CEST) From: Bruno Haible To: gdb-patches@sourceware.org, bug-gnulib@gnu.org Subject: Re: [PATCH] gdb: Fix build error on macOS Date: Wed, 06 Oct 2021 02:05:39 +0200 Message-ID: <4235743.lh7rkWDJqb@omega> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 06 Oct 2021 00:06:08 -0000 Enze Li wrote: > > PR build/28413 notes that the gdb master fails to build on macOS. The build fails due to the combination of '-Werror' and a useful warning emitted by Gnulib. But Gnulib does not support '-Werror'. To fix the issue, you need to filter out the '-Werror' option. Or not add it in the first place. > > Based on De Morgan's law, the expression > > !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) > > is equal to (!defined __GNUC__ || defined __clang__ || !__OPTIMIZE). > > The expression above looks weird, maybe there are some problems with > > this way of judging. When any one of the conditions is established, the > > subsequent judgment will be ignored. > > > > This patch works around the issue by rewriting the expression of > > judgment after referring to the nearby notes. This text does not explain what the patch does. > > --- a/gnulib/import/c++defs.h > > +++ b/gnulib/import/c++defs.h > > @@ -286,7 +286,7 @@ > > _GL_CXXALIASWARN_2 (func, namespace) > > /* To work around GCC bug , > > we enable the warning only when not optimizing. */ > > -# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) > > +# if defined __GNUC__ && !defined __clang__ && !__OPTIMIZE__ > > # define _GL_CXXALIASWARN_2(func,namespace) \ > > _GL_WARN_ON_USE (func, \ > > "The symbol ::" #func " refers to the system function. " \ The previous code enables a useful warning for clang, and does not enable it for GCC because that would trigger a GCC bug. Your patch swaps the cases of clang and GCC. Thus it removes a useful warning for clang builds, and triggers a known GCC bug in the GCC builds. > > @@ -314,7 +314,7 @@ > > _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) > > /* To work around GCC bug , > > we enable the warning only when not optimizing. */ > > -# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) > > +# if defined __GNUC__ && !defined __clang__ && !__OPTIMIZE__ > > # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ > > _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ > > "The symbol ::" #func " refers to the system function. " \ Likewise. So, the patch is bad on all accounts. Bruno