diff options
author | midipix <writeonce@midipix.org> | 2018-03-16 19:16:42 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-03-20 23:25:30 -0400 |
commit | d43821367bf2015b3969f75ea817c495a07a809d (patch) | |
tree | 7fe85a0f7e5e3d777610258fecf6dc46dad78d12 /include | |
parent | 13ce7b78804fc09b28ac0775c9e9d744f8c79788 (diff) | |
download | psxtypes-d43821367bf2015b3969f75ea817c495a07a809d.tar.bz2 psxtypes-d43821367bf2015b3969f75ea817c495a07a809d.tar.xz |
compiler-specific headers: added __offsetof definitions.
Diffstat (limited to 'include')
-rw-r--r-- | include/psxtypes/compiler/__nt_compiler_gcc.h | 4 | ||||
-rw-r--r-- | include/psxtypes/compiler/__nt_compiler_msvc.h | 4 | ||||
-rw-r--r-- | include/psxtypes/compiler/__psx_compiler_gcc.h | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/include/psxtypes/compiler/__nt_compiler_gcc.h b/include/psxtypes/compiler/__nt_compiler_gcc.h index df81c64..b6cb064 100644 --- a/include/psxtypes/compiler/__nt_compiler_gcc.h +++ b/include/psxtypes/compiler/__nt_compiler_gcc.h @@ -73,6 +73,10 @@ #endif +/* offsetof */ +#define __offsetof(st,member) __builtin_offsetof(st,member) + + /* named section support */ #define __attr_section__(s) __attribute__((section(s))) #define __attr_section_decl__(s) diff --git a/include/psxtypes/compiler/__nt_compiler_msvc.h b/include/psxtypes/compiler/__nt_compiler_msvc.h index c865706..57a348e 100644 --- a/include/psxtypes/compiler/__nt_compiler_msvc.h +++ b/include/psxtypes/compiler/__nt_compiler_msvc.h @@ -98,6 +98,10 @@ #endif +/* offsetof */ +#define __offsetof(st,member) ((size_t)((char *)&(((st *)0)->member) - (char *)0)) + + /* named section support */ #define __attr_section__(s) #define __attr_section_decl__(s) __declspec(allocate(s)) diff --git a/include/psxtypes/compiler/__psx_compiler_gcc.h b/include/psxtypes/compiler/__psx_compiler_gcc.h index ee205f3..b5c08b7 100644 --- a/include/psxtypes/compiler/__psx_compiler_gcc.h +++ b/include/psxtypes/compiler/__psx_compiler_gcc.h @@ -58,6 +58,10 @@ #define __attr_protected__ __attribute__ ((visibility("protected"))) +/* offsetof */ +#define __offsetof(st,member) __builtin_offsetof(st,member) + + /* named section support */ #define __attr_section__(s) __attribute__((section(s))) #define __attr_section_decl__(s) |