brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · ec0d981 Raw
56 lines · python
1# ===----------------------------------------------------------------------===##2#3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4# See https://llvm.org/LICENSE.txt for license information.5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6#7# ===----------------------------------------------------------------------===##8 9# Make sure that libc++ headers work when defining _XOPEN_SOURCE=500.10# We may not want to guarantee this forever, but since this works today and11# it's something that users rely on, it makes sense to put a test on it.12#13# https://llvm.org/PR11763014 15# Some parts of the code like <fstream> use non-standard functions in their implementation,16# and these functions are not provided when _XOPEN_SOURCE is set to older values. This17# breaks when building with modules even when we don't use the offending headers directly.18# UNSUPPORTED: clang-modules-build19 20# The AIX localization support uses some functions as part of their headers that require a21# recent value of _XOPEN_SOURCE.22# UNSUPPORTED: LIBCXX-AIX-FIXME23 24# This test fails on FreeBSD for an unknown reason.25# UNSUPPORTED: LIBCXX-FREEBSD-FIXME26 27# RUN: %{python} %s %{libcxx-dir}/utils28# END.29 30import sys31 32sys.path.append(sys.argv[1])33from libcxx.header_information import (34    lit_header_restrictions,35    lit_header_undeprecations,36    public_headers,37)38 39for header in public_headers:40    for version in (500, 600, 700):41        # TODO: <fstream> currently uses ::fseeko unguarded, which fails with _XOPEN_SOURCE=500.42        if header == "fstream" and version == 500:43            continue44 45        print(46            f"""\47//--- {header}.xopen_source_{version}.compile.pass.cpp48{lit_header_restrictions.get(header, '')}49{lit_header_undeprecations.get(header, '')}50 51// ADDITIONAL_COMPILE_FLAGS: -D_XOPEN_SOURCE={version}52 53#include <{header}>54"""55        )56