Skip to content

Commit a9c2c62

Browse files
committed
tests: fix more tests on macOS
Fixes: /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:144:9: error: no member named 'at_quick_exit' in the global namespace using ::at_quick_exit _LIBCPP_USING_IF_EXISTS; ~~^ /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:145:9: error: no member named 'quick_exit' in the global namespace using ::quick_exit _LIBCPP_USING_IF_EXISTS; ~~^ 2 errors generated.
1 parent 7cd1e3d commit a9c2c62

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

Diff for: tests/test_cpp_standards.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,34 @@ def test_cpp_standards():
2020

2121
config = autoconfig.cxx_parsers_cfg.config.clone()
2222

23+
cflags_common = ""
24+
25+
if platform.system() == "Darwin":
26+
cflags_common = " -Dat_quick_exit=atexit -Dquick_exit=exit"
27+
# https://fr.mathworks.com/matlabcentral/answers/2013982-clibgen-generatelibrarydefinition-error-the-global-scope-has-no-quick_exit-on-mac-m2#answer_1439856
28+
# https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01
29+
2330
parser.parse(["cpp_standards.hpp"], config)
2431

2532
if platform.system() != 'Windows':
26-
config.cflags = "-std=c++98"
33+
config.cflags = "-std=c++98" + cflags_common
2734
parser.parse(["cpp_standards.hpp"], config)
2835

29-
config.cflags = "-std=c++03"
36+
config.cflags = "-std=c++03" + cflags_common
3037
parser.parse(["cpp_standards.hpp"], config)
3138

32-
config.cflags = "-std=c++11"
39+
config.cflags = "-std=c++11" + cflags_common
3340

3441
parser.parse(["cpp_standards.hpp"], config)
3542

36-
config.cflags = "-std=c++14"
43+
config.cflags = "-std=c++14" + cflags_common
3744
parser.parse(["cpp_standards.hpp"], config)
3845

39-
config.cflags = "-std=c++1z"
46+
config.cflags = "-std=c++1z" + cflags_common
4047
parser.parse(["cpp_standards.hpp"], config)
4148

4249
# Pass down a flag that does not exist.
4350
# This should raise an exception.
44-
config.cflags = "-std=c++00"
51+
config.cflags = "-std=c++00" + cflags_common
4552
with pytest.raises(RuntimeError):
4653
parser.parse(["cpp_standards.hpp"], config)

Diff for: tests/test_overrides.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# See http://www.boost.org/LICENSE_1_0.txt
55

66
import pytest
7+
import platform
78

89
from . import autoconfig
910

@@ -15,7 +16,12 @@
1516
def global_ns_fixture():
1617
config = autoconfig.cxx_parsers_cfg.config.clone()
1718
config.castxml_epic_version = 1
18-
config.cflags = "-std=c++11"
19+
if platform.system() == "Darwin":
20+
config.cflags = "-std=c++11 -Dat_quick_exit=atexit -Dquick_exit=exit"
21+
# https://fr.mathworks.com/matlabcentral/answers/2013982-clibgen-generatelibrarydefinition-error-the-global-scope-has-no-quick_exit-on-mac-m2#answer_1439856
22+
# https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01
23+
else:
24+
config.cflags = "-std=c++11"
1925
decls = parser.parse(["test_overrides.hpp"], config)
2026
global_ns = declarations.get_global_namespace(decls)
2127
return global_ns

Diff for: tests/test_pattern_parser.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def test_template_split_std_vector(global_ns):
4040
"""
4141

4242
config = autoconfig.cxx_parsers_cfg.config.clone()
43-
config.cflags = "-std=c++11"
43+
if platform.system() == "Darwin":
44+
config.cflags = "-std=c++11 -Dat_quick_exit=atexit -Dquick_exit=exit"
45+
# https://fr.mathworks.com/matlabcentral/answers/2013982-clibgen-generatelibrarydefinition-error-the-global-scope-has-no-quick_exit-on-mac-m2#answer_1439856
46+
# https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01
47+
else:
48+
config.cflags = "-std=c++11"
4449
decls = parser.parse(TEST_FILES, config)
4550

4651
for decl in declarations.make_flatten(decls):

0 commit comments

Comments
 (0)