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-exception
6//
7//===----------------------------------------------------------------------===//
8
9// We're building as C, so this test doesn't work when building with modules.
10// UNSUPPORTED: clang-modules-build
11
12// GCC complains about unrecognized arguments because we're compiling the
13// file as C, but we're passing C++ flags on the command-line.
14// UNSUPPORTED: gcc
15
16// Test that the C wrapper headers can be included when compiling them as C.
17
18// NOTE: It's not common or recommended to have libc++ in the header search
19// path when compiling C files, but it does happen often enough.
20
21// RUN: %{cxx} -c -xc %s -fsyntax-only %{flags} %{compile_flags} -std=c99
22
23#include <__config>
24
25#include <complex.h>
26#include <ctype.h>
27#include <errno.h>
28#include <fenv.h>
29#include <float.h>
30#include <inttypes.h>
31#include <limits.h>
32#ifndef _LIBCPP_HAS_NO_LOCALIZATION
33# include <locale.h>
34#endif
35#include <math.h>
36#include <setjmp.h>
37#include <stdatomic.h>
38#include <stdbool.h>
39#include <stddef.h>
40#include <stdint.h>
41#include <stdio.h>
42#include <stdlib.h>
43#include <string.h>
44// The clang-shipped tgmath.h header doesn't work with MSVC/UCRT's complex
45// headers in C mode, see PR46207.
46#ifndef _MSC_VER
47# include <tgmath.h>
48#endif
49#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
50# include <wchar.h>
51# include <wctype.h>
52#endif
53
54int main(int argc, char **argv) {
55 (void)argc;
56 (void)argv;
57 return 0;
58}
59

source code of libcxx/test/libcxx/include_as_c.sh.cpp