public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Enze Li <lienze2010@hotmail.com>
To: bug-gnulib@gnu.org
Cc: gdb@sourceware.org, simon.marchi@polymtl.ca
Subject: [PATCH] Fix a wrong expression
Date: Tue,  5 Oct 2021 17:10:58 +0800	[thread overview]
Message-ID: <MEAP282MB0293CF0A623BA0841334F67EDDAF9@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM> (raw)

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. 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.

* lib/c++defs.h (_GL_CXXALIASWARN_2, _GL_CXXALIASWARN1_2): Don't enable
the GCC workaround to clang.
---
 lib/c++defs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/c++defs.h b/lib/c++defs.h
index a47b61a00..b982b88f6 100644
--- a/lib/c++defs.h
+++ b/lib/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. " \
@@ -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. " \
-- 
2.30.2


             reply	other threads:[~2021-10-05  9:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  9:10 Enze Li [this message]
2021-10-06  0:06 ` Bruno Haible

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=MEAP282MB0293CF0A623BA0841334F67EDDAF9@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM \
    --to=lienze2010@hotmail.com \
    --cc=bug-gnulib@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).