summaryrefslogtreecommitdiffstats
path: root/src/config.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-11-09 14:34:21 -0500
committerTavian Barnes <tavianator@tavianator.com>2023-11-09 15:35:40 -0500
commitc745df94a182b8a569cb833ecfbe8da33bf01f98 (patch)
treed64642a509a2dd641bb851ec7c338e0558263ee7 /src/config.h
parent0a5091a9005b485fccad689a4cbf081802860a5a (diff)
downloadbfs-c745df94a182b8a569cb833ecfbe8da33bf01f98.tar.xz
config: New attr_noinline and attr_cold macros
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/config.h b/src/config.h
index 3100cec..b95abaa 100644
--- a/src/config.h
+++ b/src/config.h
@@ -185,6 +185,24 @@
#endif
/**
+ * Hint to avoid inlining a function.
+ */
+#if __has_attribute(noinline)
+# define attr_noinline __attribute__((noinline))
+#else
+# define attr_noinline
+#endif
+
+/**
+ * Hint that a function is unlikely to be called.
+ */
+#if __has_attribute(cold)
+# define attr_cold attr_noinline __attribute__((cold))
+#else
+# define attr_cold attr_noinline
+#endif
+
+/**
* Adds compiler warnings for bad printf()-style function calls, if supported.
*/
#if __has_attribute(format)