1
0

errata.h 934 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * errata functions
  3. *
  4. * This code is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU Library General Public License version 2.
  6. */
  7. #ifndef _ERRATA_H_
  8. #define _ERRATA_H_
  9. #define _ERRATA(erratum) errata("ERRATA_" # erratum)
  10. #define ERRATA(erratum) _ERRATA(erratum)
  11. #define _ERRATA_RELAXED(erratum) errata_relaxed("ERRATA_" # erratum)
  12. #define ERRATA_RELAXED(erratum) _ERRATA_RELAXED(erratum)
  13. static inline bool errata_force(void)
  14. {
  15. char *s = getenv("ERRATA_FORCE");
  16. return s && (*s == '1' || *s == 'y' || *s == 'Y');
  17. }
  18. static inline bool errata(const char *erratum)
  19. {
  20. char *s;
  21. if (errata_force())
  22. return true;
  23. s = getenv(erratum);
  24. return s && (*s == '1' || *s == 'y' || *s == 'Y');
  25. }
  26. static inline bool errata_relaxed(const char *erratum)
  27. {
  28. char *s;
  29. if (errata_force())
  30. return true;
  31. s = getenv(erratum);
  32. return !(s && (*s == '0' || *s == 'n' || *s == 'N'));
  33. }
  34. #endif