summaryrefslogtreecommitdiffhomepage
path: root/include/psxtypes/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'include/psxtypes/compiler')
-rw-r--r--include/psxtypes/compiler/__nt_compiler_clang.h108
-rw-r--r--include/psxtypes/compiler/__nt_compiler_gcc.h129
-rw-r--r--include/psxtypes/compiler/__nt_compiler_msvc.h109
-rw-r--r--include/psxtypes/compiler/__psx_compiler_gcc.h93
4 files changed, 439 insertions, 0 deletions
diff --git a/include/psxtypes/compiler/__nt_compiler_clang.h b/include/psxtypes/compiler/__nt_compiler_clang.h
new file mode 100644
index 0000000..531153e
--- /dev/null
+++ b/include/psxtypes/compiler/__nt_compiler_clang.h
@@ -0,0 +1,108 @@
+#ifndef _PSXTYPES_NT_COMPILER_CLANG_H_
+#define _PSXTYPES_NT_COMPILER_CLANG_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __CLANG__
+#define __COMPILER_DEPENDENT_SUFFIX__ __clang
+
+
+/* NTVER: the bare minimum */
+#ifndef NTVER
+ #define NTVER 0x0500
+#elif (NTVER < 0x0500)
+ #error __^@^__: NTVER: minimum supported NT version is 0x0500.
+#endif
+
+
+/* x86 processor model */
+#if (_M_IX86 == 900)
+ #define __X86_MODEL 986
+#elif (_M_IX86 == 800)
+ #define __X86_MODEL 886
+#elif (_M_IX86 == 700)
+ #define __X86_MODEL 786
+#elif (_M_IX86 == 600)
+ #define __X86_MODEL 686
+#elif (_M_IX86 == 500)
+ #define __X86_MODEL 586
+#elif (_M_IX86 == 400)
+ #define __X86_MODEL 486
+#elif (_M_IX86 == 300)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(_M_AMD64)
+ #define __amd64 1
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ char *
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __null_placeholder (0x0)
+
+
+/* __SIZEOF_POINTER__ */
+#if defined(__NT32)
+ #define __SIZEOF_POINTER__ 4
+#elif defined(__NT64)
+ #define __SIZEOF_POINTER__ 8
+#endif
+
+
+/* compiler attributes */
+#define __inline__ __inline
+#define __volatile__ volatile
+#define __attr_aligned__(x) __declspec(align(x))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__
+#define __attr_export__ __declspec(dllexport)
+#define __attr_import__ __declspec(dllimport)
+#define __attr_naked__ __declspec(naked)
+
+#ifdef __PE_VISIBILITY__
+#define __attr_hidden__ __attribute__((visibility("hidden")))
+#define __attr_public__ __attribute__((visibility("default")))
+#define __attr_protected__ __attribute__((visibility("protected")))
+#else
+#define __attr_hidden__
+#define __attr_public__
+#define __attr_protected__
+#endif
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [1-((sizeof(s) % a))]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [1 + sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#undef __stdcall
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define __stdcall _stdcall
+#define APIENTRY __stdcall
+#define CALLBACK __stdcall
+#define NTAPI __stdcall
+#define WINAPI __stdcall
+#define __tep __stdcall
+
+#endif /* _PSXTYPES_NT_COMPILER_CLANG_H_ */
diff --git a/include/psxtypes/compiler/__nt_compiler_gcc.h b/include/psxtypes/compiler/__nt_compiler_gcc.h
new file mode 100644
index 0000000..4c80398
--- /dev/null
+++ b/include/psxtypes/compiler/__nt_compiler_gcc.h
@@ -0,0 +1,129 @@
+#ifndef _PSXTYPES_NT_COMPILER_GCC_H_
+#define _PSXTYPES_NT_COMPILER_GCC_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __GCC__
+#define __COMPILER_DEPENDENT_SUFFIX__ __gcc
+
+
+/* NTVER: the bare minimum */
+#ifndef NTVER
+ #define NTVER 0x0500
+#elif (NTVER < 0x0500)
+ #error __^@^__: NTVER: minimum supported NT version is 0x0500.
+#endif
+
+
+/* x86 processor model */
+#if defined(__i986__)
+ #define __X86_MODEL 986
+#elif defined(__i886__)
+ #define __X86_MODEL 886
+#elif defined(__i786__)
+ #define __X86_MODEL 786
+#elif defined(__i686__)
+ #define __X86_MODEL 686
+#elif defined(__i586__)
+ #define __X86_MODEL 586
+#elif defined(__i486__)
+ #define __X86_MODEL 486
+#elif defined(__i386__)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(__amd64) && (__amd64)
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ __builtin_va_list
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __caller_allocated
+#define __caller_initialized
+#define __null_placeholder (0x0)
+
+
+/* compiler attributes */
+#define __attr_aligned__(x) __attribute__((__aligned__(x)))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__ __attribute__((__packed__))
+#define __attr_export__ __attribute__((dllexport))
+#define __attr_import__ __attribute__((dllimport))
+#define __attr_naked__
+
+#ifdef __PE_VISIBILITY__
+#define __attr_hidden__ __attribute__((visibility("hidden")))
+#define __attr_public__ __attribute__((visibility("default")))
+#define __attr_protected__ __attribute__((visibility("protected")))
+#else
+#define __attr_hidden__
+#define __attr_public__
+#define __attr_protected__
+#endif
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [-(sizeof(s) % a)]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#if defined(__X86_MODEL)
+#undef __cdecl
+#define __cdecl __attribute__((cdecl))
+
+#undef __fastcall
+#define __fastcall __attribute__((fastcall))
+
+#undef __stdcall
+#define __stdcall __attribute__((stdcall))
+
+#elif defined (__X86_64_MODEL)
+
+#undef __cdecl
+#define __cdecl
+
+#undef __fastcall
+#define __fastcall
+
+#undef __stdcall
+#define __stdcall
+#endif
+
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define APIENTRY __stdcall
+#define CALLBACK __stdcall
+#define NTAPI __stdcall
+#define WINAPI __stdcall
+
+
+
+/* architecture-specific calling conventions */
+#if defined(__X86_MODEL)
+ #undef __stdcall
+ #define __stdcall __attribute__((__stdcall__))
+#elif defined(__X86_64_MODEL)
+ #undef __stdcall
+ #define __stdcall
+#endif
+
+#endif /* _PSXTYPES_NT_COMPILER_GCC_H_ */
diff --git a/include/psxtypes/compiler/__nt_compiler_msvc.h b/include/psxtypes/compiler/__nt_compiler_msvc.h
new file mode 100644
index 0000000..2a0e8dc
--- /dev/null
+++ b/include/psxtypes/compiler/__nt_compiler_msvc.h
@@ -0,0 +1,109 @@
+#ifndef _PSXTYPES_NT_COMPILER_MSVC_H_
+#define _PSXTYPES_NT_COMPILER_MSVC_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __MSVC__
+#define __COMPILER_DEPENDENT_SUFFIX__ __msvc
+
+
+/* NTVER: the bare minimum */
+#ifndef NTVER
+ #define NTVER 0x0500
+#elif (NTVER < 0x0500)
+ #error __^@^__: NTVER: minimum supported NT version is 0x0500.
+#endif
+
+
+/* x86 processor model */
+#if (_M_IX86 == 900)
+ #define __X86_MODEL 986
+#elif (_M_IX86 == 800)
+ #define __X86_MODEL 886
+#elif (_M_IX86 == 700)
+ #define __X86_MODEL 786
+#elif (_M_IX86 == 600)
+ #define __X86_MODEL 686
+#elif (_M_IX86 == 500)
+ #define __X86_MODEL 586
+#elif (_M_IX86 == 400)
+ #define __X86_MODEL 486
+#elif (_M_IX86 == 300)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(_M_AMD64)
+ #define __amd64 1
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ char *
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __caller_allocated
+#define __caller_initialized
+#define __null_placeholder (0x0)
+
+
+/* __SIZEOF_POINTER__ */
+#if defined(__NT32)
+ #define __SIZEOF_POINTER__ 4
+#elif defined(__NT64)
+ #define __SIZEOF_POINTER__ 8
+#endif
+
+
+/* compiler attributes */
+#define __inline__ __inline
+#define __volatile__ volatile
+#define __attr_aligned__(x) __declspec(align(x))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__
+#define __attr_export__ __declspec(dllexport)
+#define __attr_import__ __declspec(dllimport)
+#define __attr_naked__ __declspec(naked)
+
+#ifdef __PE_VISIBILITY__
+#define __attr_hidden__ __attribute__((visibility("hidden")))
+#define __attr_public__ __attribute__((visibility("default")))
+#define __attr_protected__ __attribute__((visibility("protected")))
+#else
+#define __attr_hidden__
+#define __attr_public__
+#define __attr_protected__
+#endif
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [1-((sizeof(s) % a))]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [1 + sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#undef __stdcall
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define __stdcall _stdcall
+#define APIENTRY __stdcall
+#define CALLBACK __stdcall
+#define NTAPI __stdcall
+#define WINAPI __stdcall
+
+#endif /* _PSXTYPES_NT_COMPILER_MSVC_H_ */
diff --git a/include/psxtypes/compiler/__psx_compiler_gcc.h b/include/psxtypes/compiler/__psx_compiler_gcc.h
new file mode 100644
index 0000000..6797182
--- /dev/null
+++ b/include/psxtypes/compiler/__psx_compiler_gcc.h
@@ -0,0 +1,93 @@
+#ifndef _PSXTYPES_COMPILER_GCC_H_
+#define _PSXTYPES_COMPILER_GCC_H_
+
+
+/* compiler identification */
+#define __COMPILER__ __GCC__
+#define __COMPILER_DEPENDENT_SUFFIX__ __gcc
+
+
+/* x86 processor model */
+#if defined(__i986__)
+ #define __X86_MODEL 986
+#elif defined(__i886__)
+ #define __X86_MODEL 886
+#elif defined(__i786__)
+ #define __X86_MODEL 786
+#elif defined(__i686__)
+ #define __X86_MODEL 686
+#elif defined(__i586__)
+ #define __X86_MODEL 586
+#elif defined(__i486__)
+ #define __X86_MODEL 486
+#elif defined(__i386__)
+ #define __X86_MODEL 386
+#endif
+
+
+/* x86_64 processor model */
+#if defined(__amd64) && (__amd64)
+ #define __X86_64_MODEL __amd64
+#endif
+
+
+/* va_list */
+#define __CUSTOM_OR_BUILTIN_va_list__ __builtin_va_list
+
+
+/* compiler keywords */
+#define __in
+#define __out
+#define __in_opt
+#define __out_opt
+#define __in_out
+#define __in_out_opt
+#define __reserved
+#define __optional
+#define __simplified
+#define __caller_allocated
+#define __caller_initialized
+#define __null_placeholder (0x0)
+
+
+/* compiler attributes */
+#define __attr_aligned__(x) __attribute__((__aligned__(x)))
+#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__)
+#define __attr_packed__ __attribute__((__packed__))
+#define __attr_export__ __attribute__((dllexport))
+#define __attr_import__ __attribute__((dllimport))
+#define __attr_naked__
+#define __attr_hidden__ __attribute__ ((visibility("hidden")))
+#define __attr_public__ __attribute__ ((visibility("default")))
+#define __attr_protected__ __attribute__ ((visibility("protected")))
+
+
+/* compiler-dependent assertions */
+#define __assert_aligned_size(s,a) typedef char __assert##s [-(sizeof(s) % a)]
+#define __assert_struct_size(s1,s2) typedef char __assert##s1##s2 [sizeof(s2) -sizeof(s1)]
+
+
+/* calling conventions */
+#ifndef __cdecl
+#define __cdecl
+#endif
+
+#ifndef __fastcall
+#define __fastcall
+#endif
+
+#ifndef __stdcall
+#define __stdcall
+#endif
+
+#undef APIENTRY
+#undef CALLBACK
+#undef NTAPI
+#undef WINAPI
+
+#define APIENTRY
+#define CALLBACK
+#define NTAPI
+#define WINAPI
+
+#endif /* _PSXTYPES_COMPILER_GCC_H_ */