On 25 July 2015 at 01:15, Trevor Saunders <tbsau...@tbsaunde.org> wrote: > I'd actually expect reasonable cases to be fairly common. For example
I added it to -Wall, I guess we'll see... not sure how many users of returns_nonnull are out there. In all your cases there is no reason to prefer NULL rather than, say, (T*)0xdeadbeef. Moreover, moving the warning to the ME does not guarantee that no false positives will be emitted either. It also does not guarantee that no false positives will be introduced by optimization that did not exist in the user code. And optimizations may remove trivial true positives, which seems even worse. > So at some point we're just talking semantics of words, but I think you > could make a credible argument that clang doesn't have a true -O0 mode. > I'm no expert on clang internals, but I think the place they draw a line > between what is a front end and what is a back is farther back than > where gcc draws it, but that's basically just a guess. I think they make a distinction between dataflow analysis and code transformation. Clang does dataflow analysis on the AST without changing the code (I think it can even do interprocedural dataflow), but it leaves the succession of analysis and transformation passes to LLVM, which does not do warnings. I do not know the precise details of how all this works, but it seems to work better and faster than what GCC does right now for Wuninitialized. Cheers, Manuel.