_info.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "config.h"
  4. /**
  5. * build_assert - routines for build-time assertions
  6. *
  7. * This code provides routines which will cause compilation to fail should some
  8. * assertion be untrue: such failures are preferable to run-time assertions,
  9. * but much more limited since they can only depends on compile-time constants.
  10. *
  11. * These assertions are most useful when two parts of the code must be kept in
  12. * sync: it is better to avoid such cases if possible, but seconds best is to
  13. * detect invalid changes at build time.
  14. *
  15. * For example, a tricky piece of code might rely on a certain element being at
  16. * the start of the structure. To ensure that future changes don't break it,
  17. * you would catch such changes in your code like so:
  18. *
  19. * Example:
  20. * char *foo_string(struct foo *foo)
  21. * {
  22. * // This trick requires that the string be first in the structure
  23. * BUILD_ASSERT(offsetof(struct foo, string) == 0);
  24. * return (char *)foo;
  25. * }
  26. */
  27. int main(int argc, char *argv[])
  28. {
  29. if (argc != 2)
  30. return 1;
  31. if (strcmp(argv[1], "depends") == 0)
  32. /* Nothing. */
  33. return 0;
  34. return 1;
  35. }