diff options
author | midipix <writeonce@midipix.org> | 2016-12-11 20:25:21 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-11 22:26:57 -0500 |
commit | 7d77e3cba633f2a6489bfcd4ab307ed9da1ab91d (patch) | |
tree | 62dbc501437824f425e9bfec366a2dc85fc796fc | |
parent | 1359b392d5ded223043b32a2d2dbf084d084344e (diff) | |
download | ntapi-7d77e3cba633f2a6489bfcd4ab307ed9da1ab91d.tar.bz2 ntapi-7d77e3cba633f2a6489bfcd4ab307ed9da1ab91d.tar.xz |
api headers: added nt_compiler.h, supporting visual studio and hosted envs.
-rw-r--r-- | include/ntapi/nt_compiler.h | 55 | ||||
-rw-r--r-- | project/headers.mk | 1 |
2 files changed, 56 insertions, 0 deletions
diff --git a/include/ntapi/nt_compiler.h b/include/ntapi/nt_compiler.h new file mode 100644 index 0000000..bb4b31d --- /dev/null +++ b/include/ntapi/nt_compiler.h @@ -0,0 +1,55 @@ +#ifndef _NT_COMPILER_H_ +#define _NT_COMPILER_H_ + +#include "nt_abi.h" + +#ifndef _MIDIPIX_FREESTANDING + +#ifdef _MSC_VER + +/* visual studio: begin */ +#ifdef _M_IX86 +#ifndef __SIZEOF_POINTER__ +#define __SIZEOF_POINTER__ 4 +#endif +#endif + +#ifdef _M_X64 +#ifndef __SIZEOF_POINTER__ +#define __SIZEOF_POINTER__ 8 +#endif +#endif + +#ifndef __attr_aligned__ +#define __attr_aligned__(x) __declspec(align(x)) +#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__) +#define __assert_aligned_size(s,a) typedef char __assert##s [1-((sizeof(s) % a))] +#endif + +#ifndef __attr_export__ +#define __attr_export__ __declspec(dllexport) +#define __attr_import__ __declspec(dllimport) +#endif + +/* visual studio: end */ + +#else + +/* all other compilers: begin */ +#ifndef __attr_aligned__ +#define __attr_aligned__(x) __attribute__((aligned(x))) +#define __attr_ptr_size_aligned__ __attr_aligned__(__SIZEOF_POINTER__) +#define __assert_aligned_size(s,a) typedef char __assert##s [-(sizeof(s) % a)] +#endif + +#ifndef __attr_export__ +#define __attr_export__ __attribute__((__dllexport__)) +#define __attr_import__ __attribute__((__dllimport__)) +#endif +/* all other compilers: end */ + +#endif + +#endif + +#endif diff --git a/project/headers.mk b/project/headers.mk index bcd7d27..b29341b 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -5,6 +5,7 @@ API_HEADERS = \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_atomic.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_auxv.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_blitter.h \ + $(SOURCE_DIR)/include/$(PACKAGE)/./nt_compiler.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_crc32.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_daemon.h \ $(SOURCE_DIR)/include/$(PACKAGE)/./nt_debug.h \ |