-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-Wzero-as-null-pointer-constant hits a few places #1323
Comments
There is no nullptr in C++98 |
Is there a temporary fix for this? |
I commented in the LLVM bugzilla about this: |
In this discussion it is said that NULL macro is still warned (with "-Wzero-as-null-pointer-constant") since it is integer zero constant. From the README.md:
So, if the c++98 support will be dropped in future releases, can we just replace all NULLs with nullptr? |
@barkovv I do not see your point. I think it's a Clang bug that it warns for this in "system headers" (which is also the title of the linked bug). GCC gets it right. |
C++98 is already dropped in the master |
@martin-ejdestig @gennadiycivil The NULL -> nullptr migration seems to be simple (for e.g. "$ sed -i 's/NULL/nullptr/g' *.{h, cpp}"). However the manual control is required because "NULL" string can be part of function name or a comment. |
@barkovv thank you very much, yes please prepare the PR. We have done this work in most places with clang-modernize but there are still a few left. |
@barkovv The point is that Clang should not warn about code the user does not control (system headers). It skips many other warnings in system headers, as does GCC, but for this particular case Clang warns even in system headers. A bit off topic so I will not respond further. Anyway, if you fix it directly in googletest, the point is moot. |
I've successfully done the replacement as suggested above by @barkovv. |
"Merged" indicates that this issue is already fixed and the fix will be packaged in the upcoming release for your disto. |
Compiling with Clang 5.0.0, with libc++ and flag
-Wzero-as-null-pointer-constant
hits a few usages of NULL:I presume it'd be a good choice to change from NULL to nullptr, but I'm not sure about how many other places would need to be changed as well, and whether the change is worth it.
The text was updated successfully, but these errors were encountered: