Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compile-time checks #26

Open
jvoisin opened this issue Oct 3, 2023 · 0 comments
Open

Add compile-time checks #26

jvoisin opened this issue Oct 3, 2023 · 0 comments
Labels
good first issue Good for newcomers

Comments

@jvoisin
Copy link
Owner

jvoisin commented Oct 3, 2023

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.

@jvoisin jvoisin added the good first issue Good for newcomers label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant