From 9b483673c0c8a52d81127a23788fa4c976f2b10f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 12 Jun 2022 18:48:26 +0200 Subject: Replace to last static inline's with line + extern inline, and fix warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libsimple.h | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'libsimple.h') diff --git a/libsimple.h b/libsimple.h index 8af98e8..b9e263c 100644 --- a/libsimple.h +++ b/libsimple.h @@ -3,6 +3,14 @@ #define LIBSIMPLE_H +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdocumentation" +# pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +# pragma clang diagnostic ignored "-Wreserved-identifier" +# pragma clang diagnostic ignored "-Wdisabled-macro-expansion" +#endif + #include #include #include @@ -49,6 +57,13 @@ +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Winline" +#endif + + + #if defined(__GNUC__) && !defined(__clang__) # define LIBSIMPLE_GCC_ONLY__(x) x # define LIBSIMPLE_NON_GCC_ONLY__(x) @@ -57,6 +72,12 @@ # define LIBSIMPLE_NON_GCC_ONLY__(x) x #endif +#if defined(__GNUC__) +# define LIBSIMPLE_EXTENSION__ __extension__ +#else +# define LIBSIMPLE_EXTENSION__ +#endif + #if __STDC_VERSION__ >= 199409L # define LIBSIMPLE_C95_ONLY__(x) x # define LIBSIMPLE_PRE_C95_ONLY__(x) @@ -218,13 +239,11 @@ libsimple_unlist(void *list__, size_t i__, size_t *np__, size_t width__) #define LIBSIMPLE_ASSUME_ALIGNED__(PTR, ALIGNMENT, ...)\ - LIBSIMPLE_GCC_ONLY__(__builtin_assume_aligned(PTR, ALIGNMENT)) -#if defined(__GNUC__) && !defined(__clang__) -# define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man */\ - LIBSIMPLE_GCC_ONLY__(__builtin_assume_aligned(PTR, ##__VA_ARGS__,\ - LIBSIMPLE_C11_ONLY__(_Alignof(PTR))\ - _LIBSIMPLE_PREC11_ONLY(__alignof(PTR)))) -#endif + LIBSIMPLE_GCC_ONLY__(__builtin_assume_aligned(PTR, ALIGNMENT))\ + LIBSIMPLE_NON_GCC_ONLY__(PTR) +#define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man */\ + LIBSIMPLE_ASSUME_ALIGNED__(PTR, ##__VA_ARGS__, LIBSIMPLE_C11_ONLY__(_Alignof(*PTR)) /* no , */\ + LIBSIMPLE_PRE_C11_ONLY__(__alignof(*PTR))) #ifndef ASSUME_ALIGNED # define ASSUME_ALIGNED(...) LIBSIMPLE_ASSUME_ALIGNED(__VA_ARGS__) #endif @@ -250,4 +269,13 @@ libsimple_unlist(void *list__, size_t i__, size_t *np__, size_t width__) +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic pop +#endif + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + #endif -- cgit v1.2.3-70-g09d2