From: Bruno Haible <bruno@clisp.org>
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 [thread overview]
Message-ID: <4235743.lh7rkWDJqb@omega> (raw)
In-Reply-To: <MEAP282MB02930A087E3B8FFD7A31DC6ADDAF9@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM>
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 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
> > 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 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
> > 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
prev parent reply other threads:[~2021-10-06 0:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 10:03 Enze Li via Gdb-patches
2021-10-04 16:14 ` Simon Marchi via Gdb-patches
2021-10-05 8:23 ` Enze Li via Gdb-patches
2021-10-05 4:51 ` Enze Li via Gdb-patches
2021-10-06 0:05 ` Bruno Haible [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4235743.lh7rkWDJqb@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox