1 #ifndef NV_CORE_H
2 #error "Do not include this file directly."
3 #endif
4 
5 #include <stdint.h> // uint8_t, int8_t, ... uintptr_t
6 #include <stddef.h> // operator new, size_t, NULL
7 
8 #ifndef __STDC_VERSION__
9 #	define __STDC_VERSION__ 0
10 #endif
11 
12 // Function linkage
13 #define DLL_IMPORT
14 #if __GNUC__ >= 4
15 #   define DLL_EXPORT   __attribute__((visibility("default")))
16 #   define DLL_EXPORT_CLASS DLL_EXPORT
17 #else
18 #   define DLL_EXPORT
19 #   define DLL_EXPORT_CLASS
20 #endif
21 
22 // Function calling modes
23 #if NV_CPU_X86
24 #   define NV_CDECL     __attribute__((cdecl))
25 #   define NV_STDCALL   __attribute__((stdcall))
26 #else
27 #   define NV_CDECL
28 #   define NV_STDCALL
29 #endif
30 
31 #define NV_FASTCALL     __attribute__((fastcall))
32 //#if __GNUC__ > 3
33 // It seems that GCC does not assume always_inline implies inline. I think this depends on the GCC version :(
34 #define NV_FORCEINLINE  inline
35 //#else
36 // Some compilers complain that inline and always_inline are redundant.
37 //#define NV_FORCEINLINE  __attribute__((always_inline))
38 //#endif
39 #define NV_DEPRECATED   __attribute__((deprecated))
40 #define NV_THREAD_LOCAL __thread
41 
42 #if __GNUC__ > 2
43 #define NV_PURE     __attribute__((pure))
44 #define NV_CONST    __attribute__((const))
45 #else
46 #define NV_PURE
47 #define NV_CONST
48 #endif
49 
50 #define NV_NOINLINE __attribute__((noinline))
51 
52 // Define __FUNC__ properly.
53 #if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
54 #   if __GNUC__ >= 2
55 #       define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__
56 #   else
57 #       define __FUNC__ "<unknown>"
58 #   endif
59 #else
60 #   define __FUNC__ __PRETTY_FUNCTION__
61 #endif
62 
63 #define restrict    __restrict__
64