Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 6 additions & 1 deletion tests/test_pattern_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def test_template_split_std_vector(global_ns):
"""

config = autoconfig.cxx_parsers_cfg.config.clone()
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_FILES, config)

for decl in declarations.make_flatten(decls):
Expand Down
Loading