diff options
author | Dimenus <ryan.saunderson88@gmail.com> | 2021-08-30 17:20:10 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-31 00:47:18 +0200 |
commit | de0861581e99230ff695364e40eb7739632193ed (patch) | |
tree | b4bfb436e437c41163792b5f12032642dfc8983f /Userland/Libraries/LibC/setjmp.h | |
parent | 1700b6d1131c21f57eae535e9fff5346ed913831 (diff) | |
download | serenity-de0861581e99230ff695364e40eb7739632193ed.zip |
Userland: Guard set_jmp.h static_assert check to cpp impls only
Diffstat (limited to 'Userland/Libraries/LibC/setjmp.h')
-rw-r--r-- | Userland/Libraries/LibC/setjmp.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Userland/Libraries/LibC/setjmp.h b/Userland/Libraries/LibC/setjmp.h index 754acf87a6..2c59fc45e1 100644 --- a/Userland/Libraries/LibC/setjmp.h +++ b/Userland/Libraries/LibC/setjmp.h @@ -48,14 +48,21 @@ struct __jmp_buf { typedef struct __jmp_buf jmp_buf[1]; typedef struct __jmp_buf sigjmp_buf[1]; -#ifdef __i386__ -static_assert(sizeof(struct __jmp_buf) == 32, "struct __jmp_buf unsynchronized with i386/setjmp.S"); -#elif __x86_64__ -static_assert(sizeof(struct __jmp_buf) == 72, "struct __jmp_buf unsynchronized with x86_64/setjmp.S"); -#elif __aarch64__ -static_assert(sizeof(struct __jmp_buf) == 184, "struct __jmp_buf unsynchronized with aarch64/setjmp.S"); -#else -# error + +/** + * Since setjmp.h may be included in ports / c-projects, we need to guard this + * + */ +#ifdef __cplusplus + #ifdef __i386__ + static_assert(sizeof(struct __jmp_buf) == 32, "struct __jmp_buf unsynchronized with i386/setjmp.S"); + #elif __x86_64__ + static_assert(sizeof(struct __jmp_buf) == 72, "struct __jmp_buf unsynchronized with x86_64/setjmp.S"); + #elif __aarch64__ + static_assert(sizeof(struct __jmp_buf) == 184, "struct __jmp_buf unsynchronized with aarch64/setjmp.S"); + #else + #error + #endif #endif /** |