From eb91cf0f5584538d512c136367d433f95299e4ea Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 14 Jun 2024 21:32:09 +0200 Subject: Add missing common.h includes and formatting fixes --- src/arena.c | 7 +++++-- src/errors.h | 3 ++- src/lexer.c | 1 + src/lexer.h | 4 +++- src/main.c | 4 +++- src/unicode.h | 9 ++++++--- 6 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/arena.c b/src/arena.c index c9b20aa..0a12c52 100644 --- a/src/arena.c +++ b/src/arena.c @@ -7,6 +7,7 @@ #include #include "alloc.h" +#include "common.h" #include "errors.h" /* TODO: Support implementations without MAP_ANON? */ @@ -29,8 +30,10 @@ struct _arena { struct _arena *next; }; -static struct _arena *mkblk(size_t) __attribute__((returns_nonnull)); -static inline size_t pad(size_t, size_t) __attribute__((const, always_inline)); +static struct _arena *mkblk(size_t) + __attribute__((returns_nonnull)); +static inline size_t pad(size_t, size_t) + __attribute__((const, always_inline)); void * arena_alloc(struct _arena **a, size_t nmemb, size_t size, size_t align) diff --git a/src/errors.h b/src/errors.h index 669e4e5..1163175 100644 --- a/src/errors.h +++ b/src/errors.h @@ -5,6 +5,7 @@ #include "common.h" -noreturn void err(const char *, ...) __attribute__((format(printf, 1, 2))); +noreturn void err(const char *, ...) + __attribute__((format(printf, 1, 2))); #endif /* !ORYX_ERRORS_H */ diff --git a/src/lexer.c b/src/lexer.c index 790d7bf..25e41c7 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -9,6 +9,7 @@ #include #include "alloc.h" +#include "common.h" #include "errors.h" #include "lexer.h" #include "unicode.h" diff --git a/src/lexer.h b/src/lexer.h index bb780ee..67adc93 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -5,6 +5,7 @@ #include #include +#include "common.h" #include "types.h" enum { @@ -54,6 +55,7 @@ struct lexemes { #define lexemes_free(x) free((x).kinds) -struct lexemes lexstring(const uchar *, size_t); +struct lexemes lexstring(const uchar *, size_t) + __attribute__((nonnull)); #endif /* !ORYX_LEXER_H */ diff --git a/src/main.c b/src/main.c index ca1d2f3..f478b6d 100644 --- a/src/main.c +++ b/src/main.c @@ -7,11 +7,13 @@ #include "alloc.h" #include "codegen.h" +#include "common.h" #include "errors.h" #include "lexer.h" #include "parser.h" -static char *readfile(const char *, size_t *); +static char *readfile(const char *, size_t *) + __attribute__((returns_nonnull, nonnull)); int main(int argc, char **argv) diff --git a/src/unicode.h b/src/unicode.h index 8c38409..42dae1d 100644 --- a/src/unicode.h +++ b/src/unicode.h @@ -8,14 +8,17 @@ #include "types.h" /* Assert that CH has the Unicode Pattern_White_Space property */ -bool rune_is_pat_ws(rune ch) __attribute__((const)); +bool rune_is_pat_ws(rune ch) + __attribute__((const)); /* Assert that CH has the Unicode XID_Start or XID_Continue property. The rune_is_xids() function extends XID_Start to include U+005F LOW LINE, and the rune_is_xidc() function extends XID_Continue to include U+2032 PRIME, U+2033 DOUBLE PRIME, U+2034 TRIPLE PRIME, and U+2057 QUADRUPLE PRIME. */ -bool rune_is_xids(rune ch) __attribute__((const)); -bool rune_is_xidc(rune ch) __attribute__((const)); +bool rune_is_xids(rune ch) + __attribute__((const)); +bool rune_is_xidc(rune ch) + __attribute__((const)); /* Decode the first UTF-8 rune in S, and point S to the next rune in the stream. This function assumes that S points to a buffer that’s padded to a length of -- cgit v1.2.3