defsgnucdarwin.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef NV_CORE_H
  2. #error "Do not include this file directly."
  3. #endif
  4. #include <stdint.h> // uint8_t, int8_t, ... uintptr_t
  5. #include <stddef.h> // operator new, size_t, NULL
  6. #ifndef __STDC_VERSION__
  7. # define __STDC_VERSION__ 0
  8. #endif // __STDC_VERSION__
  9. // Function linkage
  10. #define DLL_IMPORT
  11. #if __GNUC__ >= 4
  12. # define DLL_EXPORT __attribute__((visibility("default")))
  13. # define DLL_EXPORT_CLASS DLL_EXPORT
  14. #else
  15. # define DLL_EXPORT
  16. # define DLL_EXPORT_CLASS
  17. #endif
  18. // Function calling modes
  19. #if NV_CPU_X86
  20. # define NV_CDECL __attribute__((cdecl))
  21. # define NV_STDCALL __attribute__((stdcall))
  22. #else
  23. # define NV_CDECL
  24. # define NV_STDCALL
  25. #endif
  26. #define NV_FASTCALL __attribute__((fastcall))
  27. #define NV_FORCEINLINE inline
  28. #define NV_DEPRECATED __attribute__((deprecated))
  29. #define NV_THREAD_LOCAL //ACS: there's no "__thread" or equivalent on iOS/OSX
  30. #if __GNUC__ > 2
  31. #define NV_PURE __attribute__((pure))
  32. #define NV_CONST __attribute__((const))
  33. #else
  34. #define NV_PURE
  35. #define NV_CONST
  36. #endif
  37. #define NV_NOINLINE __attribute__((noinline))
  38. // Define __FUNC__ properly.
  39. #if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
  40. # if __GNUC__ >= 2
  41. # define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
  42. # else
  43. # define __FUNC__ "<unknown>"
  44. # endif
  45. #else
  46. # define __FUNC__ __PRETTY_FUNCTION__
  47. #endif
  48. #define restrict __restrict__