Skip to content

Commit a5f9ec1

Browse files
committed
check for span in libstdc++ rather than libc++ on linux
1 parent c844d48 commit a5f9ec1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/Interop/lit.local.cfg

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,23 @@ else:
4444
config.substitutions.insert(0, ('%target-abi', 'SYSV'))
4545
config.substitutions.insert(0, ('%target-swift-flags', ''))
4646

47-
# target_sdk_libcxx_path is empty when targeting non-Darwin platforms
48-
config.target_libcxx_path = config.target_sdk_libcxx_path
49-
5047
if get_target_os() in ['linux-gnu']:
51-
for p in ['/usr/include/c++/v1', '/usr/local/include/c++/v1']:
52-
if os.path.exists(p) or os.path.exists(p):
53-
config.available_features.add('system_wide_libcxx')
54-
config.target_libcxx_path = p
48+
if os.path.exists('/usr/include/c++/v1') or os.path.exists('/usr/local/include/c++/v1'):
49+
config.available_features.add('system_wide_libcxx')
5550

56-
if config.target_libcxx_path != '':
51+
if config.target_sdk_libcxx_path != '':
5752
if os.path.exists(os.path.join(config.target_sdk_libcxx_path, "span")):
5853
config.available_features.add('std_span')
54+
elif get_target_os() in ['linux-gnu']:
55+
for p in ['/usr/include/c++/', '/usr/local/include/c++/']:
56+
if not os.path.isdir(p):
57+
continue
58+
for subdir in os.listdir(p):
59+
if not subdir.isdigit():
60+
# skip paths libc++ paths like /usr/include/c++/v1, we want libstdc++ paths only (like /usr/include/c++/13)
61+
continue
62+
if os.path.exists(os.path.join(p, subdir, "span")):
63+
config.available_features.add('std_span')
5964
elif get_target_os() in ['windows-msvc']:
6065
# We don't test on any versions of MSVC without std::span support.
6166
# FIXME: figure out where to do lookup for C++ stdlib headers on Windows - we'll probably need it eventually

0 commit comments

Comments
 (0)