From 6df25014f8efefbd02408d2fe54f78b6dd0a6b62 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 29 Jul 2026 20:06:55 +0000 Subject: [PATCH 4/5] Suppress unprefixed AssertMacros names on old macOS SDKs On macOS 10.7-and-earlier SDKs, AssertMacros.h (included via CoreServices) defaults __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES to 1, defining unprefixed macros like check_string(), verify(), and require(). check_string(assertion, message) collides with the check_string member functions in folly/lang/cstring_view.h, breaking every TU that includes watchman_string.h (which includes watchman_system.h -> CoreServices before folly/FBString.h). Define the guard to 0 before including CoreServices, both in watchman_system.h and in the one test that includes CoreServices directly. Modern SDKs already default to 0, so this is a no-op there. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01K6JXw8CwYRiXvqHMBGZRgP --- watchman/test/WatcherSelectionDarwinTest.cpp | 5 +++++ watchman/watchman_system.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/watchman/test/WatcherSelectionDarwinTest.cpp b/watchman/test/WatcherSelectionDarwinTest.cpp index cbb25cb..56cb277 100644 --- a/watchman/test/WatcherSelectionDarwinTest.cpp +++ b/watchman/test/WatcherSelectionDarwinTest.cpp @@ -11,6 +11,11 @@ #include +// See the comment in watchman_system.h: old-SDK AssertMacros.h otherwise +// defines unprefixed macros (check_string, verify, ...) that break folly. +#ifndef __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES +#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif #include // @manual #include #include "watchman/CommandRegistry.h" diff --git a/watchman/watchman_system.h b/watchman/watchman_system.h index b05355b..9121f04 100644 --- a/watchman/watchman_system.h +++ b/watchman/watchman_system.h @@ -148,6 +148,14 @@ char* realpath(const char* filename, char* target); #endif #ifdef HAVE_CORESERVICES_CORESERVICES_H +// On macOS 10.7 and earlier SDKs, AssertMacros.h (pulled in via CoreServices) +// defaults to defining unprefixed macro names like check_string(), verify(), +// and require(), which collide with ordinary identifiers in folly (e.g. the +// check_string member of folly/lang/cstring_view.h). Ask for only the +// __-prefixed versions; on modern SDKs 0 is already the default. +#ifndef __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES +#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif #include // @manual // The FSEvents stream API is available from 10.5. Later additions // (file-level events on 10.7, exclusion paths on 10.9) are handled with