aboutsummaryrefslogtreecommitdiffstats
path: root/libsimple.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-06-12 18:48:26 +0200
committerMattias Andrée <maandree@kth.se>2022-06-12 18:48:26 +0200
commit9b483673c0c8a52d81127a23788fa4c976f2b10f (patch)
treef25ded5960dd73ccfe819fc3331f7a2b8c0561a1 /libsimple.h
parentRemove `static` from some `static inline` (diff)
downloadlibsimple-9b483673c0c8a52d81127a23788fa4c976f2b10f.tar.gz
libsimple-9b483673c0c8a52d81127a23788fa4c976f2b10f.tar.bz2
libsimple-9b483673c0c8a52d81127a23788fa4c976f2b10f.tar.xz
Replace to last static inline's with line + extern inline, and fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libsimple.h')
-rw-r--r--libsimple.h42
1 files changed, 35 insertions, 7 deletions
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 <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -50,6 +58,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)
#else
@@ -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