[PATCH] D84202: [clang][noderef] Enable -Wnoderef warning for CXX C-style casts

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 12:20:14 PDT 2020


leonardchan added a comment.

In D84202#2179618 <https://reviews.llvm.org/D84202#2179618>, @aaron.ballman wrote:

>> users can still disable the warning on line granularity with pragmas.
>
> This makes me a bit uncomfortable because those pragmas extremely ugly (and not easily portable). Also, this will break code for users who were previously doing something that was explicitly allowed (but not explicitly documented, at least). How often do users need to (legitimately, rather than accidentally) use the C-style cast like this?

For fuchsia's case at least, we want to make it more difficult for users of this to explicitly remove the attribute (so adding dirty pragmas might help be a deterrent), and the only ideal case this would be stripped is in tests. For now, we do purposely have C-style casts scattered about since we're incrementally turning on this warning for various drivers, but we're getting closer to remove all these casts in non-testing driver code.

I can't speak for other projects use cases though. Would it help to send out an RFC to see if any other users have strong opinions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84202/new/

https://reviews.llvm.org/D84202



More information about the cfe-commits mailing list