From: Alexandre Duret-Lutz <adl@lrde.epita.fr>
To: Florian Weimer <fweimer@redhat.com>
Cc: bug-gnulib@gnu.org
Subject: Re: clang++ 11 compilation issues
Date: Wed, 13 Jan 2021 12:31:22 +0100 [thread overview]
Message-ID: <87y2gxvzsl.fsf@lrde.epita.fr> (raw)
In-Reply-To: <87im82f1z9.fsf@oldenburg2.str.redhat.com> (Florian Weimer's message of "Tue, 12 Jan 2021 19:23:54 +0100")
Florian Weimer <fweimer@redhat.com> writes:
> Would you be able to check whether __null is in the preprocessed
> sources? If it is there (and the lack of further logged expansions
> suggests this), then this is a compiler bug. __null is not zero, and
> should be fine to use as a null pointer constant. This is why NULL is
> not defined as 0.
I can reproduce this without any preprocessing with clang 9, 10, and 11.
% cat foo.cc
int foo(char* msg_ctxt_id)
{
return msg_ctxt_id == __null;
}
% clang++-11 -Wzero-as-null-pointer-constant -c foo.cc
foo.cc:3:25: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
return msg_ctxt_id == __null;
^~~~~~
nullptr
1 warning generated.
% clang++-10 -Wzero-as-null-pointer-constant -c foo.cc
foo.cc:3:25: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
return msg_ctxt_id == __null;
^~~~~~
nullptr
1 warning generated.
% clang++-9 -Wzero-as-null-pointer-constant -c foo.cc
foo.cc:3:25: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
return msg_ctxt_id == __null;
^~~~~~
nullptr
1 warning generated.
--
Alexandre Duret-Lutz
next prev parent reply other threads:[~2021-01-13 11:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 10:37 clang++ 11 compilation issues Alexandre Duret-Lutz
2021-01-12 18:23 ` Florian Weimer
2021-01-13 11:31 ` Alexandre Duret-Lutz [this message]
2021-01-12 20:19 ` Bruno Haible
2021-01-13 21:04 ` Jeffrey Walton
2021-01-15 8:55 ` different CFLAGS for gnulib code? Bruno Haible
2021-01-15 9:20 ` Alexandre Duret-Lutz
2021-01-15 11:11 ` Paul Eggert
2021-01-15 16:36 ` Darshit Shah
2021-01-15 11:17 ` Simon Josefsson via Gnulib discussion list
2021-01-15 16:08 ` Jim Meyering
2021-01-17 12:55 ` Pádraig Brady
2021-01-14 0:37 ` clang++ 11 compilation issues Paul Eggert
2021-01-14 1:21 ` Bruno Haible
2021-01-14 1:55 ` Paul Eggert
2021-01-14 2:09 ` Bruno Haible
2021-01-14 18:21 ` Alexandre Duret-Lutz
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y2gxvzsl.fsf@lrde.epita.fr \
--to=adl@lrde.epita.fr \
--cc=bug-gnulib@gnu.org \
--cc=fweimer@redhat.com \
/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).