summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-zero-nullptr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other ↵Roman Lebedev2017-10-261-3/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than NULL. Summary: The warning was initially introduced in D32914 by @thakis, and the concerns were raised there, and later in rL302247 and PR33771. I do believe that it makes sense to relax the diagnostic e.g. in this case, when the expression originates from the system header, which can not be modified. This prevents adoption for the diagnostic for codebases which use pthreads (`PTHREAD_MUTEX_INITIALIZER`), gtest, etc. As @malcolm.parsons suggests, it *may* make sense to also not warn for the template types, but it is not obvious to me how to do that in here. Though, it still makes sense to complain about `NULL` macro. While there, add more tests. Reviewers: dblaikie, thakis, rsmith, rjmccall, aaron.ballman Reviewed By: thakis Subscribers: Rakete1111, hans, cfe-commits, thakis, malcolm.parsons Tags: #clang Differential Revision: https://reviews.llvm.org/D38954 llvm-svn: 316662
* Ignore implicity casts for zero-as-null-pointer-constant warningErich Keane2017-10-251-0/+7
| | | | | | | | | | The repro in https://bugs.llvm.org/show_bug.cgi?id=34362 caused the left nullptr to be cast to a int* implicitly, which resulted diagnosing this falsely. Differential Revision: https://reviews.llvm.org/D39301 llvm-svn: 316605
* Introduce Wzero-as-null-pointer-constant.Nico Weber2017-05-051-0/+27
Add an opt-in warning that fires when 0 is used as a null pointer. gcc has this warning, and there's some demand for it. https://reviews.llvm.org/D32914 llvm-svn: 302247
OpenPOWER on IntegriCloud