bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clang++ 11 compilation issues


From: Alexandre Duret-Lutz
Subject: Re: clang++ 11 compilation issues
Date: Wed, 13 Jan 2021 12:31:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]