Add compile-time checks
Opened this issue · 0 comments
jvoisin commented
Something like:
void *memcpy(void *d, const void *s, size_t __n) {
if (__builtin_constant_p(__n) && __n > __bos(od)) {
compile-time-error!
}
}
Apparently, the trick everyone is using to make the compiler choke is this one:
#define __errordecl(name, msg) extern void name(void) __attribute__((__error__(msg)))
#define __warnattr(msg) __attribute__((__warning__(msg)))
This should be used only when warning_if
isn't supported.