aboutsummaryrefslogtreecommitdiffstats
path: root/libsimple-arg.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-arg.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-arg.h')
-rw-r--r--libsimple-arg.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/libsimple-arg.h b/libsimple-arg.h
index 1d52b33..6aa3c2a 100644
--- a/libsimple-arg.h
+++ b/libsimple-arg.h
@@ -8,11 +8,11 @@
#ifdef LIBSIMPLY_CONFIG_MULTICALL_BINARY /* Define by the application */
-# define _LIBSIMPLY_IF_MULTICALL_BINARY(...) __VA_ARGS__
-# define _LIBSIMPLY_UNLESS_MULTICALL_BINARY(...)
+# define LIBSIMPLY_IF_MULTICALL_BINARY__(...) __VA_ARGS__
+# define LIBSIMPLY_UNLESS_MULTICALL_BINARY__(...)
#else
-# define _LIBSIMPLY_IF_MULTICALL_BINARY(...)
-# define _LIBSIMPLY_UNLESS_MULTICALL_BINARY(...) __VA_ARGS__
+# define LIBSIMPLY_IF_MULTICALL_BINARY__(...)
+# define LIBSIMPLY_UNLESS_MULTICALL_BINARY__(...) __VA_ARGS__
#endif
@@ -48,10 +48,19 @@ struct longopt {
*/
char short_flag;
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+#endif
+
/**
* Whether the option takes an argument
*/
int with_arg;
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
};
@@ -410,11 +419,11 @@ struct longopt {
/* Intended for internal use only */
#if __STDC_VERSION__ >= 201112L
-# define _LIBSIMPLE_NORETURN _Noreturn
+# define LIBSIMPLE_NORETURN__ _Noreturn
#elif defined(__GNUC__) || defined(__clang__)
-# define _LIBSIMPLE_NORETURN __attribute__((noreturn))
+# define LIBSIMPLE_NORETURN__ __attribute__((noreturn))
#else
-# define _LIBSIMPLE_NORETURN
+# define LIBSIMPLE_NORETURN__
#endif
@@ -433,15 +442,15 @@ struct longopt {
* @parma STATUS:int The exit value for the process
*/
#define NUSAGE(STATUS, SYNOPSIS)\
- static _LIBSIMPLE_NORETURN void\
+ static LIBSIMPLE_NORETURN__ void\
usage(void)\
{\
const char *syn = (const char *)SYNOPSIS ? SYNOPSIS : "";\
fprintf(stderr, "usage: %s%s%s\n", argv0, *syn ? " " : "", syn);\
exit(STATUS);\
}\
- _LIBSIMPLY_UNLESS_MULTICALL_BINARY(char *argv0 = NULL)\
- _LIBSIMPLY_IF_MULTICALL_BINARY(int main(int, char *[]))
+ LIBSIMPLY_UNLESS_MULTICALL_BINARY__(char *argv0 = NULL)\
+ LIBSIMPLY_IF_MULTICALL_BINARY__(int main(int, char *[]))
#endif