summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-05-10 15:42:09 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-05-10 15:42:09 -0400
commitf3ecfc1ee49e1c3ddd3d19ca6166424d72a08a5c (patch)
tree6dd78519aad198a018160a13740034a4ea4b20b6 /src
parent3f1822caed3dca731997c8739c19ee32e5caadc1 (diff)
downloadbfs-f3ecfc1ee49e1c3ddd3d19ca6166424d72a08a5c.tar.xz
config: Group attribute wrappers together
Diffstat (limited to 'src')
-rw-r--r--src/config.h44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/config.h b/src/config.h
index ed3f6ab..e17f90b 100644
--- a/src/config.h
+++ b/src/config.h
@@ -129,18 +129,7 @@
# define __GLIBC_PREREQ(maj, min) false
#endif
-// Wrappers for fundamental language features/extensions
-
-/**
- * Silence compiler warnings about switch/case fall-throughs.
- */
-#if __has_c_attribute(fallthrough)
-# define BFS_FALLTHROUGH [[fallthrough]]
-#elif __has_attribute(fallthrough)
-# define BFS_FALLTHROUGH __attribute__((fallthrough))
-#else
-# define BFS_FALLTHROUGH ((void)0)
-#endif
+// Fundamental utilities
/**
* Get the length of an array.
@@ -170,6 +159,28 @@
: BFS_FLEX_MAX(sizeof(type), BFS_FLEX_LB(type, member, length)))
/**
+ * Initialize a variable, unless sanitizers would detect uninitialized uses.
+ */
+#if __has_feature(memory_sanitizer)
+# define BFS_UNINIT(var, value) var
+#else
+# define BFS_UNINIT(var, value) value
+#endif
+
+// Wrappers for attributes
+
+/**
+ * Silence compiler warnings about switch/case fall-throughs.
+ */
+#if __has_c_attribute(fallthrough)
+# define BFS_FALLTHROUGH [[fallthrough]]
+#elif __has_attribute(fallthrough)
+# define BFS_FALLTHROUGH __attribute__((fallthrough))
+#else
+# define BFS_FALLTHROUGH ((void)0)
+#endif
+
+/**
* Adds compiler warnings for bad printf()-style function calls, if supported.
*/
#if __has_attribute(format)
@@ -200,13 +211,4 @@
# define BFS_UNSUPPRESS()
#endif
-/**
- * Initialize a variable, unless sanitizers would detect uninitialized uses.
- */
-#if __has_feature(memory_sanitizer)
-# define BFS_UNINIT(var, value) var
-#else
-# define BFS_UNINIT(var, value) value
-#endif
-
#endif // BFS_CONFIG_H