diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2023-10-25 08:58:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 11:58:28 -0400 |
commit | cd29e19e9476e221015d895618512717d872a83b (patch) | |
tree | 14d2b4489cb4bf21991c7d36f7b25d20dadbd380 /lldb/unittests/ScriptInterpreter/Python | |
parent | c9c9bf0f20fd820b86fac35113bbd8049ff4e72a (diff) | |
download | llvm-cd29e19e9476e221015d895618512717d872a83b.zip llvm-cd29e19e9476e221015d895618512717d872a83b.tar.gz llvm-cd29e19e9476e221015d895618512717d872a83b.tar.bz2 |
[Sema] -Wzero-as-null-pointer-constant: don't warn for __null (#69126)
The implementation of -Wzero-as-null-pointer-constant was done before
the following fix has been committed to GCC:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=752e7593b0f19af233a0b7e72daab8413662b605;hp=298434c916c14e8adca2cab8a746aee29038c5b3
As a result, clang and gcc diverge on the use of `__null` and,
consequently, on the use of `NULL` on systems like Linux/macOS where
`NULL` is defined as `__null`.
This is a problem for compatibility between gcc and clang, particularly
for code bases that support C++98 or for single-source libraries that
are implemented in C, but compiled as C++ via inclusion into a C++
translation unit. Code like this can not be changed to use `nullptr`, as
it needs to maintain compatibility with C before C23 or C++ before
C++11, but warns on the use of `NULL` in clang.
The warning `Wzero-as-null-pointer-constant` is still useful with this
change, as it allows to change `0` to `NULL`, which fixes
gcc warnings and helps the reader distinguish between pointers and
non-pointers. Users who require a full C++11 modernization pass can
still use clang-tidy for that purpose.
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python')
0 files changed, 0 insertions, 0 deletions