},
]], key=lambda tc: tc["name"])
+# Map from each header to the Lit annotations that should be used for
+# tests that include that header.
+#
+# For example, when threads are not supported, any feature-test-macro test
+# that includes <thread> should be marked as UNSUPPORTED, because including
+# <thread> is a hard error in that case.
+lit_markup = {
+ "atomic": ["UNSUPPORTED: libcpp-has-no-threads"],
+ "shared_mutex": ["UNSUPPORTED: libcpp-has-no-threads"],
+ "thread": ["UNSUPPORTED: libcpp-has-no-threads"],
+}
+
def get_std_dialects():
std_dialects = ['c++14', 'c++17', 'c++2a']
return list(std_dialects)
result += "*/"
return result
-def is_threading_header_unsafe_to_include(h):
- # NOTE: "<mutex>" does not blow up when included without threads.
- return h in ['atomic', 'shared_mutex']
-
def produce_tests():
headers = set([h for tc in feature_test_macros for h in tc["headers"]])
for h in headers:
for tc in test_list:
assert 'unimplemented' in tc.keys()
continue
- test_tags = ""
- if is_threading_header_unsafe_to_include(h):
- test_tags += '\n// UNSUPPORTED: libcpp-has-no-threads\n'
+ markup = '\n'.join('// ' + tag for tag in lit_markup.get(h, []))
test_body = \
"""//===----------------------------------------------------------------------===//
//
//
// WARNING: This test was generated by {script_name}
// and should not be edited manually.
-{test_tags}
+{markup}
// <{header}>
// Test the feature test macros defined by <{header}>
int main(int, char**) {{ return 0; }}
""".format(script_name=script_name,
header=h,
- test_tags=test_tags,
+ markup=('\n{}\n'.format(markup) if markup else ''),
synopsis=generate_synopsis(test_list),
cxx11_tests=generate_std_test(test_list, 'c++11').strip(),
cxx14_tests=generate_std_test(test_list, 'c++14').strip(),