The C standard says that calling memcpy, etc with null parameters is undefined behavior.
GCC (and clang) have attributes that allow us to mark the parameters of functions as "must not be null".
Define a mechanism to do this, and use it (for the first time) to mark the parameters of memcpy, memmove, memcmp and strncmp as "must not be null".
This gives us compile time checking for constant pointers, and hints to the code generator.
Note: This will not be a big win on systems that use glibc, because it marks the global functions ::memcpy, etc the same way. On Mac OS X, iOS, Android, FreeBSD, etc, this will make a bigger difference.
I will be adding tests as well; this post is to gather consensus that this is the right way to go.
typo here.