summaryrefslogtreecommitdiffstats
path: root/src/bfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bfs.h')
-rw-r--r--src/bfs.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/bfs.h b/src/bfs.h
index 91c6540..70a7282 100644
--- a/src/bfs.h
+++ b/src/bfs.h
@@ -33,10 +33,15 @@
#ifndef BFS_COMMAND
# define BFS_COMMAND "bfs"
#endif
+
#ifndef BFS_HOMEPAGE
# define BFS_HOMEPAGE "https://tavianator.com/projects/bfs.html"
#endif
+#ifndef BFS_LINT
+# define BFS_LINT false
+#endif
+
// This is a symbol instead of a literal so we don't have to rebuild everything
// when the version number changes
extern const char bfs_version[];
@@ -197,8 +202,13 @@ extern const char bfs_ldlibs[];
* Disabled on TSan due to https://github.com/google/sanitizers/issues/342.
*/
#ifndef BFS_USE_TARGET_CLONES
-# if __has_attribute(target_clones) && (__GLIBC__ || __FreeBSD__) && !__SANITIZE_THREAD__
+# if __has_attribute(target_clones) \
+ && (__GLIBC__ || __FreeBSD__) \
+ && !__SANITIZE_THREAD__ \
+ && !__SANITIZE_TYPE__
# define BFS_USE_TARGET_CLONES true
+# else
+# define BFS_USE_TARGET_CLONES false
# endif
#endif
@@ -211,4 +221,24 @@ extern const char bfs_ldlibs[];
# define _target_clones(...)
#endif
+/**
+ * Mark the size of a flexible array member.
+ */
+#if __has_attribute(counted_by)
+# define _counted_by(...) __attribute__((counted_by(__VA_ARGS__)))
+#else
+# define _counted_by(...)
+#endif
+
+/**
+ * Optimization hint to not unroll a loop.
+ */
+#if BFS_HAS_PRAGMA_NOUNROLL
+# define _nounroll _Pragma("nounroll")
+#elif __GNUC__ && !__clang__
+# define _nounroll _Pragma("GCC unroll 0")
+#else
+# define _nounroll
+#endif
+
#endif // BFS_H