aboutsummaryrefslogtreecommitdiff
path: root/builtins/functions.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-08 17:17:15 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-08 17:17:15 -0400
commitaeed1992e94c5ab6a5104a06a921101fbe8f40ed (patch)
tree8ba6dc531acefa0eedd330224f16f750496e8dbe /builtins/functions.h
parentcf9d5b1619b9e5e886d2754f167046ff77d36abf (diff)
Fix nearly every GCC warning and add __attribute__((pure/const)) where
appropriate
Diffstat (limited to 'builtins/functions.h')
-rw-r--r--builtins/functions.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/builtins/functions.h b/builtins/functions.h
index cc1f5a81..f258a20d 100644
--- a/builtins/functions.h
+++ b/builtins/functions.h
@@ -8,10 +8,13 @@
#include "datatypes.h"
#include "types.h"
+#include "util.h"
void tomo_init(void);
-void fail(const char *fmt, ...);
-void fail_source(const char *filename, int64_t start, int64_t end, const char *fmt, ...);
+__attribute__((format(printf, 1, 2)))
+_Noreturn void fail(const char *fmt, ...);
+__attribute__((format(printf, 4, 5)))
+_Noreturn void fail_source(const char *filename, int64_t start, int64_t end, const char *fmt, ...);
Text_t builtin_last_err();
void start_test(const char *filename, int64_t start, int64_t end);
void end_test(const void *expr, const TypeInfo *type, const char *expected, const char *filename, int64_t start, int64_t end);
@@ -22,9 +25,9 @@ void say(Text_t text, bool newline);
Text_t ask(Text_t prompt, bool bold, bool force_tty);
_Noreturn void tomo_exit(Text_t text, int32_t status);
-uint64_t generic_hash(const void *obj, const TypeInfo *type);
-int32_t generic_compare(const void *x, const void *y, const TypeInfo *type);
-bool generic_equal(const void *x, const void *y, const TypeInfo *type);
+PUREFUNC uint64_t generic_hash(const void *obj, const TypeInfo *type);
+PUREFUNC int32_t generic_compare(const void *x, const void *y, const TypeInfo *type);
+PUREFUNC bool generic_equal(const void *x, const void *y, const TypeInfo *type);
Text_t generic_as_text(const void *obj, bool colorize, const TypeInfo *type);
int generic_print(const void *obj, bool colorize, const TypeInfo *type);
closure_t spawn(closure_t fn);