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// Test that _LIBCPP_FREESTANDING is not defined when -ffreestanding is not passed
10// to the compiler but defined when -ffreestanding is passed to the compiler.
11
12// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only %s
13// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only -ffreestanding -DFREESTANDING %s
14
15#include <__config>
16
17#if defined(FREESTANDING) != defined(_LIBCPP_FREESTANDING)
18#error _LIBCPP_FREESTANDING should be defined in freestanding mode and not \
19 defined in non-freestanding mode
20#endif
21

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