Skip to content

Commit

Permalink
tests: fix more tests on macOS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iMichka committed Jan 12, 2025
1 parent 7cd1e3d commit 548ea1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
19 changes: 13 additions & 6 deletions tests/test_cpp_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,34 @@ def test_cpp_standards():

config = autoconfig.cxx_parsers_cfg.config.clone()

cflags_common = ""

if platform.system() == "Darwin":
cflags_common = " -Dat_quick_exit=atexit -Dquick_exit=exit"
# https://fr.mathworks.com/matlabcentral/answers/2013982-clibgen-generatelibrarydefinition-error-the-global-scope-has-no-quick_exit-on-mac-m2#answer_1439856
# https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01

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

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

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

config.cflags = "-std=c++11"
config.cflags = "-std=c++11" + cflags_common

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

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

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

# Pass down a flag that does not exist.
# This should raise an exception.
config.cflags = "-std=c++00"
config.cflags = "-std=c++00" + cflags_common
with pytest.raises(RuntimeError):
parser.parse(["cpp_standards.hpp"], config)
8 changes: 7 additions & 1 deletion tests/test_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# See http://www.boost.org/LICENSE_1_0.txt

import pytest
import platform

from . import autoconfig

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

0 comments on commit 548ea1c

Please sign in to comment.