diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-03-10 12:24:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-10 12:24:51 -0500 |
| commit | e39893e8eb1a9411fca4e5f885456a27a770d3a2 (patch) | |
| tree | bcd2f6aa99b5e6425c17d31f5e4a89b98c854f34 /slang.h | |
| parent | e06cfb37eb099e45302dd015b0396bf26c913778 (diff) | |
Add struct version to DownstreamCompiler::CompileOptions interface (#2692)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Add versioning to CompileOptions for DownstreamCompiler so we can add new options without breaking binary interface.
* Use builtin offset of directly.
Diffstat (limited to 'slang.h')
| -rw-r--r-- | slang.h | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -238,11 +238,14 @@ convention for interface methods. # define SLANG_BREAKPOINT(id) __builtin_trap(); # define SLANG_ALIGN_OF(T) __alignof__(T) -// Use this macro instead of offsetof, because gcc produces warning if offsetof is used on a -// non POD type, even though it produces the correct result -# define SLANG_OFFSET_OF(T, ELEMENT) (size_t(&((T*)1)->ELEMENT) - 1) +// Use the builtin directly so we don't need to have an include of stddef.h +# define SLANG_OFFSET_OF(T, ELEMENT) __builtin_offsetof(T, ELEMENT) #endif // SLANG_GCC_FAMILY +#ifndef SLANG_OFFSET_OF +# define SLANG_OFFSET_OF(T, ELEMENT) (size_t(&((T*)1)->ELEMENT) - 1) +#endif + // Microsoft VC specific #if SLANG_MICROSOFT_FAMILY # define SLANG_NO_INLINE __declspec(noinline) |
