summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Harley2023-02-01 19:52:58 +0000
committerTom Harley2023-02-01 20:56:29 +0000
commit98154521de3a832a4297f05f2bb8d1c01b7641fb (patch)
tree5e54c7fc4cccd86ad471fc8178ff870be7666bae
parentUpgrade to LLVM 14 (diff)
downloadsinter-98154521de3a832a4297f05f2bb8d1c01b7641fb.tar.gz
sinter-98154521de3a832a4297f05f2bb8d1c01b7641fb.zip

Add warn macro

Makes it possible to print to stderr in non-debug mode, for example to warn the user of a possible error.

-rw-r--r--error.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/error.h b/error.h
index 4df5d07..104905d 100644
--- a/error.h
+++ b/error.h
@@ -20,4 +20,12 @@ enum errcode {
exit(v); \
} while (0)
+#define _warn(fmt, ...) do { \
+ fprintf(stderr, fmt "\n", __VA_ARGS__); \
+} while (0)
+
+#define warn(...) do { \
+ _warn(__VA_ARGS__); \
+} while (0)
+
#endif /* ERROR_H */