aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-14 21:32:09 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-14 21:32:09 +0200
commiteb91cf0f5584538d512c136367d433f95299e4ea (patch)
tree07a914c0b27619fc0902350968254784cb0df1f8 /src
parent4c3c0831a5d14c91f7b81b6f7392dffe1757bc8d (diff)
Add missing common.h includes and formatting fixes
Diffstat (limited to 'src')
-rw-r--r--src/arena.c7
-rw-r--r--src/errors.h3
-rw-r--r--src/lexer.c1
-rw-r--r--src/lexer.h4
-rw-r--r--src/main.c4
-rw-r--r--src/unicode.h9
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 */
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