compiler-warnings icon indicating copy to clipboard operation
compiler-warnings copied to clipboard

Wzero-as-null-pointer-constant missing

Open hauntsaninja opened this issue 7 years ago • 5 comments

My clang-5.0(.1) has -Wzero-as-null-pointer-constant, but it's missing from this list.

hauntsaninja avatar Oct 24 '17 00:10 hauntsaninja

I thought -Wzero-as-null-pointer-constant was only supported by gcc. Xcode 9's clang ("Apple LLVM version 9.0.0 (clang-900.0.38)") on macOS doesn't recognize -Wzero-as-null-pointer-constant and I don't see "zero-as-null-pointer-constant" in the llvm GitHub repo:

https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/DiagnosticGroups.td

cpeterso avatar Oct 24 '17 00:10 cpeterso

Here's the commit in which it appears to have been introduced: https://github.com/llvm-mirror/clang/commit/dc1f3e5a2b9639e3ceb052cd291b3cd58e7c17ae

It's hard to tell which LLVM clang version Xcode's clang is based off of. This repo uses LLVM's version numbering too, so it might just be best to ignore Apple LLVM for now.

hauntsaninja avatar Oct 24 '17 05:10 hauntsaninja

Unfortunately that is part of include/clang/Basic/DiagnosticSemaKinds.td file that my TableGen parsers can't fully parse.

Barro avatar Oct 28 '17 19:10 Barro

I just took some time to rewrite the clang parser in my fork to use llvm-tblgen, since that tool can now grok the entire Diagnostic.td tree and emit JSON. The new parser picked up zero-as-null-pointer-constant and a large handful of other options.

Along the way I also Dockerized the build so that you don't need to install as many build dependencies in your host environment (most notably, an unreleased version of llvm).

https://github.com/pkolbus/compiler-warnings

@Barro - if either or both of these seem interesting, feel free to cherry-pick. Or I can prepare a PR- let me know.

P.S. https://gist.github.com/yamaya/2924292 provides a rough mapping of Xcode to LLVM versions; from the comments it looks like Xcode 9 is somewhere around clang 4.

pkolbus avatar Aug 19 '18 03:08 pkolbus

I have been thinking about using llvm-tablegen too, but good to see that someone else has already come into the same conclusion regarding it. And Python 3 compatibility too (with the same antlr version updates in my local copy of the repository). From the response time you can see that I don't look at my Github notifications that often. So a patch would be an option, but I can also look at your fork and try to incorporate the changes that you have done with this.

As for dockerizing the build, I don't really like the dependency on Docker as you basically then require administrative rights on the machine to do the build.

Barro avatar Sep 16 '18 15:09 Barro