We find it more valuable to warn on all instances we're removing the noderef attribute from a pointer. This patch removes the type holes where we initially didn't warn on C-style casts. For instances where removing noderef is intended, users can still disable the warning on line granularity with pragmas.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
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?
Good to know. And yeah, the pragma may be a good deterrent, but I was trying to understand whether the casts are *necessary* in some circumstances (e.g., are we forcing users to write these pragmas for correct code?). It sounds like the answer is that the casts aren't necessary?
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?
It could help, but I'm not ready to insist yet. I'm mostly worried that this attribute has been available for 2+ years and I have no idea how widely used it is and what the usage patterns are. If you have evidence to suggest that this shouldn't be disruptive and that altering code to fit the new restriction is easy, that would help me feel more comfortable too.