aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-03-15 13:04:56 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-03-15 13:04:56 +0100
commitcd9686e6bef2c69f0852d5ff84453b18111ef407 (patch)
treed2b83285a74f12154b8599421cd84643eef5fd9c /include
parenta4339206ac663b1655c7517d2fc186d5e2b3e7b2 (diff)
Prefer surrounding attribute names with ‘__’
Diffstat (limited to 'include')
-rw-r--r--include/alloc.h2
-rw-r--r--include/errors.h17
-rw-r--r--include/mbstring.h29
-rw-r--r--include/optparse.h5
4 files changed, 32 insertions, 21 deletions
diff --git a/include/alloc.h b/include/alloc.h
index f96c28f..6eb2a30 100644
--- a/include/alloc.h
+++ b/include/alloc.h
@@ -3,7 +3,7 @@
#include <stddef.h>
-[[gnu::returns_nonnull]] void *bufalloc(void *, size_t, size_t);
+[[gnu::__returns_nonnull__]] void *bufalloc(void *, size_t, size_t);
void *bufalloc_noterm(void *, size_t, size_t);
#endif /* !MLIB_ALLOC_H */
diff --git a/include/errors.h b/include/errors.h
index 6721afa..8484010 100644
--- a/include/errors.h
+++ b/include/errors.h
@@ -3,22 +3,23 @@
#include <stdarg.h>
-[[gnu::format(printf, 1, 2)]] void warn(const char *, ...);
-[[gnu::format(printf, 1, 2)]] void warnx(const char *, ...);
+[[gnu::__format__(printf, 1, 2)]] void warn(const char *, ...);
+[[gnu::__format__(printf, 1, 2)]] void warnx(const char *, ...);
void vwarn(const char *, va_list);
void vwarnx(const char *, va_list);
-[[noreturn, gnu::format(printf, 1, 2)]] void err(const char *, ...);
-[[noreturn, gnu::format(printf, 1, 2)]] void errx(const char *, ...);
-[[noreturn, gnu::format(printf, 2, 3)]] void cerr(int, const char *, ...);
-[[noreturn, gnu::format(printf, 2, 3)]] void cerrx(int, const char *, ...);
+[[__noreturn__, gnu::__format__(printf, 1, 2)]] void err(const char *, ...);
+[[__noreturn__, gnu::__format__(printf, 1, 2)]] void errx(const char *, ...);
+[[__noreturn__, gnu::__format__(printf, 2, 3)]] void cerr(int, const char *,
+ ...);
+[[__noreturn__, gnu::__format__(printf, 2, 3)]] void cerrx(int, const char *,
+ ...);
extern const char *__mlib_errors_progname;
void mlib_setprogname(const char *);
-[[gnu::always_inline]]
-static inline const char *
+[[gnu::__always_inline__]] static inline const char *
mlib_progname(void)
{
return __mlib_errors_progname;
diff --git a/include/mbstring.h b/include/mbstring.h
index 98c8137..74a3767 100644
--- a/include/mbstring.h
+++ b/include/mbstring.h
@@ -29,19 +29,28 @@
#define PRIsU8 ".*s"
#define U8_PRI_ARGS(sv) ((int)(sv).len), ((sv).p)
-bool u8haspfx(const char8_t *, size_t, const char8_t *, size_t);
-bool u8hassfx(const char8_t *, size_t, const char8_t *, size_t);
-char8_t *u8chk(const char8_t *, size_t);
-char8_t *u8chr(const char8_t *, size_t, rune);
-char8_t *u8rchr(const char8_t *, size_t, rune);
+[[__nodiscard__]] bool u8haspfx(const char8_t *, size_t, const char8_t *,
+ size_t);
+[[__nodiscard__]] bool u8hassfx(const char8_t *, size_t, const char8_t *,
+ size_t);
+
+[[__nodiscard__]] char8_t *u8chk(const char8_t *, size_t);
+
+[[__nodiscard__]] char8_t *u8chr(const char8_t *, size_t, rune);
+[[__nodiscard__]] char8_t *u8rchr(const char8_t *, size_t, rune);
+
int rtou8(char8_t *, size_t, rune);
-int u8cmp(const char8_t *, size_t, const char8_t *, size_t);
+int u8tor(rune *, const char8_t *);
+
+[[__nodiscard__]] int u8cmp(const char8_t *, size_t, const char8_t *, size_t);
+
int u8next(rune *, const char8_t **, size_t *);
int u8prev(rune *, const char8_t **, const char8_t *);
-int u8tor(rune *, const char8_t *);
-size_t u8cspn(const char8_t *, size_t, const rune *, size_t);
-size_t u8len(const char8_t *, size_t);
-size_t u8spn(const char8_t *, size_t, const rune *, size_t);
+
+[[__nodiscard__]] size_t u8spn(const char8_t *, size_t, const rune *, size_t);
+[[__nodiscard__]] size_t u8cspn(const char8_t *, size_t, const rune *, size_t);
+
+[[__nodiscard__]] size_t u8len(const char8_t *, size_t);
#if !__MLIB_NO_MACRO_WRAPPER
# define u8chk(s, n) __MLIB_Q_PTR(char8_t, u8chk, (s), (s), (n))
diff --git a/include/optparse.h b/include/optparse.h
index 6863980..62358df 100644
--- a/include/optparse.h
+++ b/include/optparse.h
@@ -29,9 +29,10 @@ struct op_option {
enum op_argkind argtype;
};
-rune optparse(struct optparse *, const struct op_option *, size_t);
+[[__nodiscard__]] rune optparse(struct optparse *, const struct op_option *,
+ size_t);
-[[gnu::always_inline]]
+[[gnu::__always_inline__]]
static inline struct optparse
mkoptparser(char **argv)
{