2
0

features.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef _FEATURES_H
  2. #define _FEATURES_H
  3. #ifdef _ALL_SOURCE
  4. #define _GNU_SOURCE 1
  5. #endif
  6. #if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
  7. && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
  8. && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
  9. #define _BSD_SOURCE 1
  10. #define _XOPEN_SOURCE 700
  11. #endif
  12. #if __STDC_VERSION__ >= 199901L
  13. #define __restrict restrict
  14. #elif !defined(__GNUC__)
  15. #define __restrict
  16. #endif
  17. #if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
  18. #define __inline inline
  19. #endif
  20. #if __STDC_VERSION__ >= 201112L
  21. #elif defined(__GNUC__)
  22. #define _Noreturn __attribute__((__noreturn__))
  23. #else
  24. #define _Noreturn
  25. #endif
  26. /* Convenience macros to test the versions of glibc and gcc.
  27. Use them like this:
  28. #if __GNUC_PREREQ (2,8)
  29. ... code requiring gcc 2.8 or later ...
  30. #endif
  31. Note - they won't work for gcc1 or glibc1, since the _MINOR macros
  32. were not defined then. */
  33. #if defined __GNUC__ && defined __GNUC_MINOR__
  34. # define __GNUC_PREREQ(maj, min) \
  35. ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  36. #else
  37. # define __GNUC_PREREQ(maj, min) 0
  38. #endif
  39. #include <sys/glibc-types.h>
  40. #endif