X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Fcompiler.h;h=72c100a286fd9315cccebe5c76921c1faa815f6d;hp=4bd92d78dee0bffcade4ff5b8247ef7f63094737;hb=873a86a1a5097f2a161494341d8d962453a30465;hpb=af795d1f88e9d8f1fad0613eac93c6775b4f6735 diff --git a/include/wimlib/compiler.h b/include/wimlib/compiler.h index 4bd92d78..72c100a2 100644 --- a/include/wimlib/compiler.h +++ b/include/wimlib/compiler.h @@ -58,6 +58,11 @@ # define noinline #endif +/* Same as 'noinline', but 'noinline_for_stack' documents that 'noinline' is + * being used to prevent the annotated function from being inlined into a + * recursive function and increasing its stack usage. */ +#define noinline_for_stack noinline + #ifndef CPU_IS_BIG_ENDIAN # error "missing required endianness definition" #endif @@ -88,8 +93,11 @@ # define _force_attr #endif -#ifndef BUILD_BUG_ON -# define BUILD_BUG_ON(expr) ((void)sizeof(char[1 - 2*!!(expr)])) +/* STATIC_ASSERT() - verify the truth of an expression at compilation time. */ +#if __STDC_VERSION__ >= 201112L +# define STATIC_ASSERT(expr) _Static_assert((expr), "") +#else +# define STATIC_ASSERT(expr) ((void)sizeof(char[1 - 2 * !(expr)])) #endif #endif /* _WIMLIB_COMPILER_H */