Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Remove macOS-internal headers inserted by clang-tidy (breaks Linux/GCC)

Martin Vogelef512c3508e2
diff --git a/src/foundation/compat_fs.c b/src/foundation/compat_fs.c
index b7bc4f26e..5258ddcbb 100644
--- a/src/foundation/compat_fs.c
+++ b/src/foundation/compat_fs.c
@@ -7,12 +7,8 @@
#include "foundation/compat_fs.h"
#include <stdio.h>
-#include <_stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/dirent.h>
-#include <sys/_types/_mode_t.h>
-#include <sys/errno.h>
#ifdef _WIN32
diff --git a/src/foundation/compat_regex.c b/src/foundation/compat_regex.c
index 8155d1c46..b9d4f6872 100644
--- a/src/foundation/compat_regex.c
+++ b/src/foundation/compat_regex.c
@@ -6,7 +6,6 @@
*/
#include "foundation/compat_regex.h"
-#include <_regex.h>
#include <string.h>
#ifdef _WIN32
diff --git a/src/foundation/compat_thread.c b/src/foundation/compat_thread.c
index b7c96511a..bd89d7eab 100644
--- a/src/foundation/compat_thread.c
+++ b/src/foundation/compat_thread.c
@@ -7,10 +7,8 @@
#include "foundation/compat_thread.h"
#include <pthread.h>
-#include <malloc/_malloc.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/_pthread/_pthread_attr_t.h>
/* ── Thread ───────────────────────────────────────────────────── */
diff --git a/src/foundation/log.c b/src/foundation/log.c
index 04e745472..12abace70 100644
--- a/src/foundation/log.c
+++ b/src/foundation/log.c
@@ -2,8 +2,7 @@
* log.c — Structured key-value logging to stderr.
*/
#include "log.h"
-#include <_stdio.h>
-#include <inttypes.h> // PRId64
+#include <inttypes.h>
#include <stdint.h> // int64_t
#include <stdio.h>
#include <stdarg.h>
diff --git a/src/foundation/mem.c b/src/foundation/mem.c
index 6f292df19..fc32a89e3 100644
--- a/src/foundation/mem.c
+++ b/src/foundation/mem.c
@@ -10,11 +10,6 @@
#include "platform.h"
#include "log.h"
-#include <mach/task_info.h>
-#include <mach/message.h>
-#include <mach/task.h>
-#include <mach/mach_init.h>
-#include <mach/kern_return.h>
#include <mimalloc.h>
#include <stdatomic.h>
#include <stdio.h>
@@ -26,6 +21,7 @@
#include <windows.h>
#include <psapi.h>
#elif defined(__APPLE__)
+#include <mach/mach.h>
#else
#include <unistd.h>
#endif
diff --git a/tests/test_arena.c b/tests/test_arena.c
index 4a9fe06de..53d3194e8 100644
--- a/tests/test_arena.c
+++ b/tests/test_arena.c
@@ -3,6 +3,7 @@
*/
#include "test_framework.h"
#include "../src/foundation/arena.h"
+#include <stdint.h>
TEST(arena_init_default) {
CBMArena a;
diff --git a/tests/test_mem.c b/tests/test_mem.c
index 985ab2043..e06666877 100644
--- a/tests/test_mem.c
+++ b/tests/test_mem.c
@@ -17,7 +17,10 @@
/* ASan detection — mimalloc MI_OVERRIDE=0 under ASan, mi_process_info
* may return 0 for RSS. Tests that depend on accurate RSS must skip. */
-#if defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer))
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
#define CBM_ASAN_ACTIVE 1
#else
#define CBM_ASAN_ACTIVE 0