diff --git a/.gitignore b/.gitignore index 4c0397994d..54ccae9e8c 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,6 @@ cmake/macro-conf/*.cmakedef # AI tooling items to ignore: CLAUDE.md + +# macOS specific items to ignore: +*.DS_Store diff --git a/bases/cmake-native/macos-arm/clang/lib/predefined_macros.txt b/bases/cmake-native/macos-arm/clang/lib/predefined_macros.txt index 069b4a09c1..142d5612e8 100644 --- a/bases/cmake-native/macos-arm/clang/lib/predefined_macros.txt +++ b/bases/cmake-native/macos-arm/clang/lib/predefined_macros.txt @@ -111,7 +111,6 @@ clang no __ATOMIC_RELEASE 3 clang no __ATOMIC_SEQ_CST 5 clang no __BIGGEST_ALIGNMENT__ 8 clang no __BITINT_MAXWIDTH__ 128 -clang no __BLOCKS__ 1 clang no __BOOL_WIDTH__ 8 clang no __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ clang no __CHAR_BIT__ 8 @@ -439,7 +438,6 @@ clang no __aarch64__ 1 clang no __apple_build_version__ 15000309 clang no __arm64 1 clang no __arm64__ 1 -clang no __block __attribute__((__blocks__(byref))) clang no __clang_literal_encoding__ "UTF-8" clang no __clang_wide_literal_encoding__ "UTF-32" clang no __llvm__ 1 diff --git a/bases/cmake-native/macos-arm/clang/lib_macos_arm64/predefined_macros.txt b/bases/cmake-native/macos-arm/clang/lib_macos_arm64/predefined_macros.txt index 069b4a09c1..142d5612e8 100644 --- a/bases/cmake-native/macos-arm/clang/lib_macos_arm64/predefined_macros.txt +++ b/bases/cmake-native/macos-arm/clang/lib_macos_arm64/predefined_macros.txt @@ -111,7 +111,6 @@ clang no __ATOMIC_RELEASE 3 clang no __ATOMIC_SEQ_CST 5 clang no __BIGGEST_ALIGNMENT__ 8 clang no __BITINT_MAXWIDTH__ 128 -clang no __BLOCKS__ 1 clang no __BOOL_WIDTH__ 8 clang no __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ clang no __CHAR_BIT__ 8 @@ -439,7 +438,6 @@ clang no __aarch64__ 1 clang no __apple_build_version__ 15000309 clang no __arm64 1 clang no __arm64__ 1 -clang no __block __attribute__((__blocks__(byref))) clang no __clang_literal_encoding__ "UTF-8" clang no __clang_wide_literal_encoding__ "UTF-32" clang no __llvm__ 1 diff --git a/bases/cmake-native/macos-x86_64/clang/lib/predefined_macros.txt b/bases/cmake-native/macos-x86_64/clang/lib/predefined_macros.txt index 5398b421f9..bbdb1e76a2 100644 --- a/bases/cmake-native/macos-x86_64/clang/lib/predefined_macros.txt +++ b/bases/cmake-native/macos-x86_64/clang/lib/predefined_macros.txt @@ -62,7 +62,6 @@ clang no __ATOMIC_RELAXED 0 clang no __ATOMIC_RELEASE 3 clang no __ATOMIC_SEQ_CST 5 clang no __BIGGEST_ALIGNMENT__ 16 -clang no __BLOCKS__ 1 clang no __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ clang no __CHAR_BIT__ 8 clang no __CLANG_ATOMIC_BOOL_LOCK_FREE 2 @@ -387,7 +386,6 @@ clang no __WINT_WIDTH__ 32 clang no __amd64 1 clang no __amd64__ 1 clang no __apple_build_version__ 12050022 -clang no __block __attribute__((__blocks__(byref))) clang no __code_model_small__ 1 clang no __core2 1 clang no __core2__ 1 diff --git a/bases/cmake-native/macos-x86_64/clang/lib_macos_x86_64/predefined_macros.txt b/bases/cmake-native/macos-x86_64/clang/lib_macos_x86_64/predefined_macros.txt index 5398b421f9..bbdb1e76a2 100644 --- a/bases/cmake-native/macos-x86_64/clang/lib_macos_x86_64/predefined_macros.txt +++ b/bases/cmake-native/macos-x86_64/clang/lib_macos_x86_64/predefined_macros.txt @@ -62,7 +62,6 @@ clang no __ATOMIC_RELAXED 0 clang no __ATOMIC_RELEASE 3 clang no __ATOMIC_SEQ_CST 5 clang no __BIGGEST_ALIGNMENT__ 16 -clang no __BLOCKS__ 1 clang no __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ clang no __CHAR_BIT__ 8 clang no __CLANG_ATOMIC_BOOL_LOCK_FREE 2 @@ -387,7 +386,6 @@ clang no __WINT_WIDTH__ 32 clang no __amd64 1 clang no __amd64__ 1 clang no __apple_build_version__ 12050022 -clang no __block __attribute__((__blocks__(byref))) clang no __code_model_small__ 1 clang no __core2 1 clang no __core2__ 1 diff --git a/tests/tests/changes/.GH307.rto/default.1.1.txt b/tests/tests/changes/.GH307.rto/default.1.1.txt new file mode 100644 index 0000000000..33bda4bcb8 --- /dev/null +++ b/tests/tests/changes/.GH307.rto/default.1.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=1 --clang Test_name.c diff --git a/tests/tests/changes/GH307.sft.cpp b/tests/tests/changes/GH307.sft.cpp new file mode 100644 index 0000000000..83ea1b2da2 --- /dev/null +++ b/tests/tests/changes/GH307.sft.cpp @@ -0,0 +1,28 @@ +//type:fp +//options:--clang +//remark:[GH #307] The macOS clang bases no longer predefine __BLOCKS__ and __block +// +// The front end does not support Apple's blocks extension (there is no block +// pointer type, and "^" cannot start a declarator), so __BLOCKS__ must not be +// predefined: the macOS SDK headers declare their block-taking functions +// (atexit_b, bsearch_b, qsort_b, ...) under "#ifdef __BLOCKS__", and every +// translation unit that included got errors. + +// The declaration that failed to parse. +#if __BLOCKS__ +int atexit_b(void (^)(void)); +#endif + +#ifdef __BLOCKS__ +#error "__BLOCKS__ is defined" +#endif + +#ifdef __block +#error "__block is defined" +#endif + +#if __has_feature(blocks) || __has_extension(blocks) +#error "the front end does not support blocks" +#endif + +int main() { return 0; } diff --git a/util/Changes b/util/Changes index a61673b293..2b5d271878 100644 --- a/util/Changes +++ b/util/Changes @@ -1,3 +1,19 @@ +Version 7.1 + +10/15/26 [GH #307] +Suppress the blocks macros in make_predef_macro_table output + +The __BLOCKS__ and __block macros are now suppressed when running +make_predef_macro_table with --clang (so these don't end up in a +predefined_macros.txt file). Clang defines them together when the blocks +extension is enabled (the default for Apple clang), but the front end does not +support that extension, and the system headers that test __BLOCKS__ (the macOS +SDK declares atexit_b, qsort_b and others under it) would then use block +pointer types. They have also been removed from the predefined_macros.txt +files of the macOS clang bases. + + +------------------------------------------------------------------------------- Version 7.0, September 28, 2026 9/27/26 [EDGcpfe/29061] diff --git a/util/make_predef_macro_table b/util/make_predef_macro_table index 2242f41103..63bf663002 100755 --- a/util/make_predef_macro_table +++ b/util/make_predef_macro_table @@ -119,6 +119,8 @@ delete_unneeded_entries() unneeded="$unneeded __clang_minor__" unneeded="$unneeded __clang_patchlevel__" unneeded="$unneeded __clang_version__" + unneeded="$unneeded __BLOCKS__" + unneeded="$unneeded __block" else unneeded="$unneeded __GNUC__" unneeded="$unneeded __GNUC_MINOR__"