X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=internals%2F_PDCLIB_aux.h;h=16e7ed86ce0353b1055da508ed65702eb0125900;hb=276f7e69f80ac53bfb5da5cc24072dd393485106;hp=c3e38d08e38e995aa5ebc316e2fb9a9c263d98da;hpb=29b313cbde86c57313b6547ca3b45baccc69be45;p=pdclib diff --git a/internals/_PDCLIB_aux.h b/internals/_PDCLIB_aux.h index c3e38d0..16e7ed8 100644 --- a/internals/_PDCLIB_aux.h +++ b/internals/_PDCLIB_aux.h @@ -1,5 +1,5 @@ -#ifndef _PDCLIB_AUX_H -#define _PDCLIB_AUX_H +#ifndef __PDCLIB_AUX_H +#define __PDCLIB_AUX_H __PDCLIB_AUX_H /* Auxiliary PDCLib code <_PDCLIB_aux.h> @@ -96,7 +96,7 @@ #endif #ifdef __has_attribute - #define _PDCLIB_HAS_ATTRIBUTE(x) __has_builtin(x) + #define _PDCLIB_HAS_ATTRIBUTE(x) __has_attribute(x) #else #define _PDCLIB_HAS_ATTRIBUTE(x) (0) #endif @@ -249,11 +249,18 @@ /* Helper macros: */ /* _PDCLIB_cc( x, y ) concatenates two preprocessor tokens without extending */ /* _PDCLIB_concat( x, y ) concatenates two preprocessor tokens with extending */ +/* _PDCLIB_concat3( x, y, z ) is the same for three tokens */ +/* _PDCLIB_static_assert( x ) provides a compile-time check mechanism */ /* -------------------------------------------------------------------------- */ #define _PDCLIB_cc( x, y ) x ## y #define _PDCLIB_concat( x, y ) _PDCLIB_cc( x, y ) #define _PDCLIB_concat3( x, y, z ) _PDCLIB_concat( _PDCLIB_concat( x, y ), z ) +#if _PDCLIB_C_VERSION >= 2011 +#define _PDCLIB_static_assert _Static_assert +#else +#define _PDCLIB_static_assert( e, m ) ;enum { _PDCLIB_concat( _PDCLIB_assert_, __LINE__ ) = 1 / ( !!( e ) ) } +#endif #define _PDCLIB_symbol2value( x ) #x #define _PDCLIB_symbol2string( x ) _PDCLIB_symbol2value( x )