[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.
The warning was initially introduced in D32914 by @thakis,
and the concerns were raised there, and later in rL302247
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
Differential Revision: https://reviews.llvm.org/D38954
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316662 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 5f17d5ca46b48156b96f81e7c32d381a0ca65b41)
4 files changed