From 700735f21ffaa18693b0bac4ac662a9dffbdd81d Mon Sep 17 00:00:00 2001 From: gulugulubing <413153391@qq.com> Date: Mon, 17 Mar 2025 00:31:17 -0600 Subject: [PATCH 1/2] Add -arch x86_64 to CXXFLAGS to fix architecture conflict on macOS when make test --- compiler/test/compilable/issue15574.sh | 6 +++++- compiler/test/runnable_cxx/abi_tags.d | 3 ++- compiler/test/runnable_cxx/cabi1.d | 1 + compiler/test/runnable_cxx/cpp11.d | 1 + compiler/test/runnable_cxx/cpp_abi_tests.d | 1 + compiler/test/runnable_cxx/cpp_stdlib.d | 1 + compiler/test/runnable_cxx/cppa.d | 1 + compiler/test/runnable_cxx/externmangle.d | 1 + compiler/test/runnable_cxx/externmangle2.d | 1 + compiler/test/runnable_cxx/nonpod_byval.d | 1 + compiler/test/runnable_cxx/stdint.d | 1 + compiler/test/runnable_cxx/test14203.d | 1 + compiler/test/runnable_cxx/test19179.d | 1 + compiler/test/runnable_cxx/test20652.d | 1 + compiler/test/runnable_cxx/test21515.d | 1 + compiler/test/runnable_cxx/test22287.d | 1 + compiler/test/runnable_cxx/test22351.d | 1 + compiler/test/runnable_cxx/test22898.d | 1 + compiler/test/runnable_cxx/test23135.d | 1 + compiler/test/runnable_cxx/test24292.d | 1 + compiler/test/runnable_cxx/test6716.d | 1 + compiler/test/runnable_cxx/test7925.d | 1 + compiler/test/runnable_cxx/testbitfields.d | 1 + 23 files changed, 28 insertions(+), 2 deletions(-) diff --git a/compiler/test/compilable/issue15574.sh b/compiler/test/compilable/issue15574.sh index 3bf015d1a888..e40666a1abe8 100644 --- a/compiler/test/compilable/issue15574.sh +++ b/compiler/test/compilable/issue15574.sh @@ -48,7 +48,11 @@ int main() { } EOF -${CC} -m${MODEL} -c -o ${C_FILE}${OBJ} $C_FILE +if [[ $OS == *"osx"* ]]; then + ${CC} -m${MODEL} -arch x86_64 -c -o ${C_FILE}${OBJ} $C_FILE +else + ${CC} -m${MODEL} -c -o ${C_FILE}${OBJ} $C_FILE +fi ar rcs ${C_LIB} ${C_FILE}${OBJ} ${DMD} -m${MODEL} -lib -of${D_LIB} ${D_FILE} diff --git a/compiler/test/runnable_cxx/abi_tags.d b/compiler/test/runnable_cxx/abi_tags.d index 80eead2dbe8c..9774830cc4f1 100644 --- a/compiler/test/runnable_cxx/abi_tags.d +++ b/compiler/test/runnable_cxx/abi_tags.d @@ -7,7 +7,8 @@ * DISABLED: win32 win64 * REQUIRED_ARGS: -extern-std=c++11 * EXTRA_CPP_SOURCES: abi_tags.cpp - * CXXFLAGS: -std=c++11 + * CXXFLAGS: -std=c++11 + * CXXFLAGS(osx): -arch x86_64 */ #line 100 diff --git a/compiler/test/runnable_cxx/cabi1.d b/compiler/test/runnable_cxx/cabi1.d index 3a914cd0e57d..629e88afe8ce 100644 --- a/compiler/test/runnable_cxx/cabi1.d +++ b/compiler/test/runnable_cxx/cabi1.d @@ -1,5 +1,6 @@ // EXTRA_CPP_SOURCES: cabi2.cpp +// CXXFLAGS(osx): -arch x86_64 import core.stdc.stdio; import core.stdc.config; diff --git a/compiler/test/runnable_cxx/cpp11.d b/compiler/test/runnable_cxx/cpp11.d index 6951dec8f70c..468d86c74320 100644 --- a/compiler/test/runnable_cxx/cpp11.d +++ b/compiler/test/runnable_cxx/cpp11.d @@ -2,6 +2,7 @@ // REQUIRED_ARGS: -extern-std=c++11 // EXTRA_CPP_SOURCES: cpp11.cpp // CXXFLAGS(osx linux freebsd openbsd netbsd dragonflybsd solaris): -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 // Disabled on win32 because the compiler is too old diff --git a/compiler/test/runnable_cxx/cpp_abi_tests.d b/compiler/test/runnable_cxx/cpp_abi_tests.d index 4e241749fbc9..f4adde72ae60 100644 --- a/compiler/test/runnable_cxx/cpp_abi_tests.d +++ b/compiler/test/runnable_cxx/cpp_abi_tests.d @@ -1,5 +1,6 @@ // EXTRA_CPP_SOURCES: cpp_abi_tests.cpp // CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd): -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 // N.B MSVC doesn't have a C++11 switch, but it defaults to the latest fully-supported standard // N.B MSVC 2013 doesn't support char16_t/char32_t diff --git a/compiler/test/runnable_cxx/cpp_stdlib.d b/compiler/test/runnable_cxx/cpp_stdlib.d index 5b7d00a38194..686135c2c52d 100644 --- a/compiler/test/runnable_cxx/cpp_stdlib.d +++ b/compiler/test/runnable_cxx/cpp_stdlib.d @@ -1,6 +1,7 @@ // DISABLED: win32 win64 // EXTRA_CPP_SOURCES: cpp_stdlib.cpp // CXXFLAGS(osx linux freebsd openbsd netbsd dragonflybsd solaris): -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 import core.stdc.stdio; // Disabled on windows because it needs bindings diff --git a/compiler/test/runnable_cxx/cppa.d b/compiler/test/runnable_cxx/cppa.d index c62bc6face18..08a6cc1c4ce3 100644 --- a/compiler/test/runnable_cxx/cppa.d +++ b/compiler/test/runnable_cxx/cppa.d @@ -1,6 +1,7 @@ // REQUIRED_ARGS: -preview=in // PERMUTE_ARGS: -g // EXTRA_CPP_SOURCES: cppb.cpp +// CXXFLAGS(osx): -arch x86_64 // EXTRA_FILES: extra-files/cppb.h // CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd): -std=c++11 // druntime isn't linked, this prevents missing symbols '_d_arraybounds_slicep': diff --git a/compiler/test/runnable_cxx/externmangle.d b/compiler/test/runnable_cxx/externmangle.d index 266cad9f6c12..64ac7db8875e 100644 --- a/compiler/test/runnable_cxx/externmangle.d +++ b/compiler/test/runnable_cxx/externmangle.d @@ -1,5 +1,6 @@ // EXTRA_CPP_SOURCES: externmangle.cpp // REQUIRED_ARGS: -extern-std=c++11 +// CXXFLAGS(osx): -arch x86_64 import core.stdc.config; import core.stdc.stdint; diff --git a/compiler/test/runnable_cxx/externmangle2.d b/compiler/test/runnable_cxx/externmangle2.d index e003c959f4e2..8050a58344fb 100644 --- a/compiler/test/runnable_cxx/externmangle2.d +++ b/compiler/test/runnable_cxx/externmangle2.d @@ -1,5 +1,6 @@ // EXTRA_CPP_SOURCES: externmangle2.cpp // DISABLED: win +// CXXFLAGS(osx): -arch x86_64 extern(C++): diff --git a/compiler/test/runnable_cxx/nonpod_byval.d b/compiler/test/runnable_cxx/nonpod_byval.d index c7fac46a040a..f145b680eedc 100644 --- a/compiler/test/runnable_cxx/nonpod_byval.d +++ b/compiler/test/runnable_cxx/nonpod_byval.d @@ -1,5 +1,6 @@ // EXTRA_CPP_SOURCES: cpp_nonpod_byval.cpp // CXXFLAGS(linux osx freebsd dragonflybsd): -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 extern (C) int printf(const(char)*, ...); diff --git a/compiler/test/runnable_cxx/stdint.d b/compiler/test/runnable_cxx/stdint.d index e599425d20c9..2ffa7209888e 100644 --- a/compiler/test/runnable_cxx/stdint.d +++ b/compiler/test/runnable_cxx/stdint.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: stdint.cpp +// CXXFLAGS(osx): -arch x86_64 module stdint_test; diff --git a/compiler/test/runnable_cxx/test14203.d b/compiler/test/runnable_cxx/test14203.d index 3b29c6620391..38585e8a431f 100644 --- a/compiler/test/runnable_cxx/test14203.d +++ b/compiler/test/runnable_cxx/test14203.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: c14203.cpp +// CXXFLAGS(osx): -arch x86_64 /************************************************/ diff --git a/compiler/test/runnable_cxx/test19179.d b/compiler/test/runnable_cxx/test19179.d index 6bdccfd18aa3..1d2534b474f9 100644 --- a/compiler/test/runnable_cxx/test19179.d +++ b/compiler/test/runnable_cxx/test19179.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: cpp19179.cpp +// CXXFLAGS(osx): -arch x86_64 // https://issues.dlang.org/show_bug.cgi?id=19179 diff --git a/compiler/test/runnable_cxx/test20652.d b/compiler/test/runnable_cxx/test20652.d index a4962f664e7c..c7c945edcd3e 100644 --- a/compiler/test/runnable_cxx/test20652.d +++ b/compiler/test/runnable_cxx/test20652.d @@ -1,5 +1,6 @@ // https://issues.dlang.org/show_bug.cgi?id=20652 // EXTRA_CPP_SOURCES: test20652.cpp +// CXXFLAGS(osx): -arch x86_64 import core.simd; diff --git a/compiler/test/runnable_cxx/test21515.d b/compiler/test/runnable_cxx/test21515.d index e5484561945d..a05249deade3 100644 --- a/compiler/test/runnable_cxx/test21515.d +++ b/compiler/test/runnable_cxx/test21515.d @@ -1,6 +1,7 @@ // https://issues.dlang.org/show_bug.cgi?id=21515 // EXTRA_CPP_SOURCES: test21515.cpp // CXXFLAGS: -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 // DISABLED: win32 win64 // ABI layout of native complex diff --git a/compiler/test/runnable_cxx/test22287.d b/compiler/test/runnable_cxx/test22287.d index a0c74752ff12..5162e8a71b22 100644 --- a/compiler/test/runnable_cxx/test22287.d +++ b/compiler/test/runnable_cxx/test22287.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: cpp22287.cpp +// CXXFLAGS(osx): -arch x86_64 extern(C++): diff --git a/compiler/test/runnable_cxx/test22351.d b/compiler/test/runnable_cxx/test22351.d index a733271edb13..a4c692ff0e57 100644 --- a/compiler/test/runnable_cxx/test22351.d +++ b/compiler/test/runnable_cxx/test22351.d @@ -2,6 +2,7 @@ // EXTRA_CPP_SOURCES: test22351.cpp // REQUIRED_ARGS: -de -extern-std=c++11 // CXXFLAGS: -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 // DISABLED: win32 extern(C++) class A22351 diff --git a/compiler/test/runnable_cxx/test22898.d b/compiler/test/runnable_cxx/test22898.d index f6890e0cbd41..3eba6aa9e81f 100644 --- a/compiler/test/runnable_cxx/test22898.d +++ b/compiler/test/runnable_cxx/test22898.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: test22898.cpp +// CXXFLAGS(osx): -arch x86_64 import core.stdc.config; diff --git a/compiler/test/runnable_cxx/test23135.d b/compiler/test/runnable_cxx/test23135.d index 4a184bb79240..1ca2d9cb29cf 100644 --- a/compiler/test/runnable_cxx/test23135.d +++ b/compiler/test/runnable_cxx/test23135.d @@ -2,6 +2,7 @@ // EXTRA_CPP_SOURCES: test23135.cpp // REQUIRED_ARGS: -extern-std=c++11 // CXXFLAGS: -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 // DISABLED: win32 void main() diff --git a/compiler/test/runnable_cxx/test24292.d b/compiler/test/runnable_cxx/test24292.d index b71f925639c6..af5f94d1440e 100644 --- a/compiler/test/runnable_cxx/test24292.d +++ b/compiler/test/runnable_cxx/test24292.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: test24292.cpp +// CXXFLAGS(osx): -arch x86_64 extern(C++) struct List(T) { diff --git a/compiler/test/runnable_cxx/test6716.d b/compiler/test/runnable_cxx/test6716.d index 6aeb25d6dcca..4013a4f21b76 100644 --- a/compiler/test/runnable_cxx/test6716.d +++ b/compiler/test/runnable_cxx/test6716.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: test6716.cpp +// CXXFLAGS(osx): -arch x86_64 version(Windows) { diff --git a/compiler/test/runnable_cxx/test7925.d b/compiler/test/runnable_cxx/test7925.d index 2d0b023fe55c..33d7d17b2ae2 100644 --- a/compiler/test/runnable_cxx/test7925.d +++ b/compiler/test/runnable_cxx/test7925.d @@ -1,4 +1,5 @@ // EXTRA_CPP_SOURCES: cpp7925.cpp +// CXXFLAGS(osx): -arch x86_64 import core.vararg; diff --git a/compiler/test/runnable_cxx/testbitfields.d b/compiler/test/runnable_cxx/testbitfields.d index 2dd3a297c31d..e1eccd549cf2 100644 --- a/compiler/test/runnable_cxx/testbitfields.d +++ b/compiler/test/runnable_cxx/testbitfields.d @@ -1,6 +1,7 @@ // EXTRA_CPP_SOURCES: testbitfields_cpp.cpp // EXTRA_SOURCES: extra-files/testbitfields_importc.c // CXXFLAGS(linux osx freebsd dragonflybsd): -std=c++11 +// CXXFLAGS(osx): -std=c++11 -arch x86_64 import core.stdc.stdio; import core.stdc.stdlib; From a746b88d064e1ea2dcd0a7521d4c9d2c27c08fbb Mon Sep 17 00:00:00 2001 From: gulugulubing <413153391@qq.com> Date: Mon, 17 Mar 2025 09:03:36 -0600 Subject: [PATCH 2/2] Fix: Remove trailing whitespace in abi_tags.d --- compiler/test/runnable_cxx/abi_tags.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/test/runnable_cxx/abi_tags.d b/compiler/test/runnable_cxx/abi_tags.d index 9774830cc4f1..411346cdee75 100644 --- a/compiler/test/runnable_cxx/abi_tags.d +++ b/compiler/test/runnable_cxx/abi_tags.d @@ -7,7 +7,7 @@ * DISABLED: win32 win64 * REQUIRED_ARGS: -extern-std=c++11 * EXTRA_CPP_SOURCES: abi_tags.cpp - * CXXFLAGS: -std=c++11 + * CXXFLAGS: -std=c++11 * CXXFLAGS(osx): -arch x86_64 */