aboutsummaryrefslogtreecommitdiff
path: root/stdlib/util.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-30 13:59:15 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-30 13:59:15 -0400
commitbdca4fc6e1d3a9ce1306313528067f012a60341b (patch)
treeb49af20b040d1fe893b81c70c8b0ba19cecb6ca3 /stdlib/util.h
parenta0178a1e0ccfd706f6d69b5b4a876f1ee70cdc28 (diff)
Fix header inline functions to use `extern inline` and some GCC magic
Diffstat (limited to 'stdlib/util.h')
-rw-r--r--stdlib/util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/stdlib/util.h b/stdlib/util.h
index 9e83c2bc..fb708476 100644
--- a/stdlib/util.h
+++ b/stdlib/util.h
@@ -37,6 +37,12 @@
#define INLINE inline __attribute__ ((always_inline))
#endif
+// GCC lets you define macro-like functions which are always inlined and never
+// compiled using this combination of flags. See: https://gcc.gnu.org/onlinedocs/gcc/Inline.html
+#ifndef MACROLIKE
+#define MACROLIKE extern inline __attribute__((gnu_inline, always_inline))
+#endif
+
__attribute__((format(printf, 1, 2)))
char *heap_strf(const char *fmt, ...);