gh-91321: Add _Py_NULL macro (#92253)

Fix C++ compiler warnings: "zero as null pointer constant"
(clang -Wzero-as-null-pointer-constant).

* Add the _Py_NULL macro used by static inline functions to use
  nullptr in C++.
* Replace NULL with nullptr in _testcppext.cpp.
This commit is contained in:
Victor Stinner 2022-05-03 21:38:37 +02:00 committed by GitHub
parent 456cd513e3
commit 551d02b3e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 18 deletions

View file

@ -29,6 +29,8 @@ if not MS_WINDOWS:
'-Werror',
# Warn on old-style cast (C cast) like: (PyObject*)op
'-Wold-style-cast',
# Warn when using NULL rather than _Py_NULL in static inline functions
'-Wzero-as-null-pointer-constant',
]
else:
# Don't pass any compiler flag to MSVC