diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-14 21:32:09 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-14 21:32:09 +0200 |
commit | eb91cf0f5584538d512c136367d433f95299e4ea (patch) | |
tree | 07a914c0b27619fc0902350968254784cb0df1f8 | |
parent | 4c3c0831a5d14c91f7b81b6f7392dffe1757bc8d (diff) |
Add missing common.h includes and formatting fixes
-rw-r--r-- | src/arena.c | 7 | ||||
-rw-r--r-- | src/errors.h | 3 | ||||
-rw-r--r-- | src/lexer.c | 1 | ||||
-rw-r--r-- | src/lexer.h | 4 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/unicode.h | 9 |
6 files changed, 20 insertions, 8 deletions
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 <stdlib.h> #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 <string.h> #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 <stddef.h> #include <stdint.h> +#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 */ @@ -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 |