[PATCH] D11948: Add some macros to abstract marking of parameters as "not null", and use them in <cstring>

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 14:16:50 PDT 2015


chandlerc added a comment.

I agree with both Marshall and Hal.

However, I'm also not opposed to platforms opting out if this if they want to. If a particular platform wants to define the behavior of null pointers passed to these functions, that seems like a reasonable thing to support here. The two platforms that seem interested in supporting null pointers here are Android and FreeBSD, so I think we should disable this for those platforms.

But I want to point out and emphasize what Hal said: the compiler can *already do this*. Please make sure that both of those platforms configure Clang and LLVM to specially handle these routines to support null pointers. You're providing a conforming extension for your platform, but you can't *just* do that in the STL, you need to do that at every layer of the toolchain.

For Linux, given the *very* long precedent of glibc and GCC behavior, I'm confident we want these annotations. I'll let folks that actually support other platforms chime up for the cases they care about.


http://reviews.llvm.org/D11948





More information about the cfe-commits mailing list