[libcxx-commits] [libcxx] [libc++][NFC] Remove _LIBCPP_FREESTANDING (PR #176907)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 21 00:58:10 PST 2026


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/176907

>From 70b54e4ddc4e809537ba916053b35f8fe7bd4db4 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Tue, 20 Jan 2026 13:00:11 +0100
Subject: [PATCH] [libc++][NFC] Remove _LIBCPP_FREESTANDING

---
 libcxx/include/__config                       |  4 ----
 libcxx/include/__cxx03/__config               |  4 ----
 .../test/libcxx-03/libcpp_freestanding.sh.cpp | 20 -------------------
 libcxx/test/libcxx/libcpp_freestanding.sh.cpp | 20 -------------------
 4 files changed, 48 deletions(-)
 delete mode 100644 libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
 delete mode 100644 libcxx/test/libcxx/libcpp_freestanding.sh.cpp

diff --git a/libcxx/include/__config b/libcxx/include/__config
index 2a4abfd469d9e..10805eec580d5 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -36,10 +36,6 @@
 #  define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
 #  define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z))
 
-#  if __STDC_HOSTED__ == 0
-#    define _LIBCPP_FREESTANDING
-#  endif
-
 #  define _LIBCPP_TOSTRING2(x) #x
 #  define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
 
diff --git a/libcxx/include/__cxx03/__config b/libcxx/include/__cxx03/__config
index d574eab8a12b1..d955429cc4ddc 100644
--- a/libcxx/include/__cxx03/__config
+++ b/libcxx/include/__cxx03/__config
@@ -32,10 +32,6 @@
 #  define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
 #  define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
 
-#  if __STDC_HOSTED__ == 0
-#    define _LIBCPP_FREESTANDING
-#  endif
-
 // HARDENING {
 
 // This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes)
diff --git a/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp b/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
deleted file mode 100644
index 8dd7a8ac85211..0000000000000
--- a/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Test that _LIBCPP_FREESTANDING is not defined when -ffreestanding is not passed
-// to the compiler but defined when -ffreestanding is passed to the compiler.
-
-// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only %s
-// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only -ffreestanding -DFREESTANDING %s
-
-#include <__config>
-
-#if defined(FREESTANDING) != defined(_LIBCPP_FREESTANDING)
-#error _LIBCPP_FREESTANDING should be defined in freestanding mode and not \
-       defined in non-freestanding mode
-#endif
diff --git a/libcxx/test/libcxx/libcpp_freestanding.sh.cpp b/libcxx/test/libcxx/libcpp_freestanding.sh.cpp
deleted file mode 100644
index 8dd7a8ac85211..0000000000000
--- a/libcxx/test/libcxx/libcpp_freestanding.sh.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// Test that _LIBCPP_FREESTANDING is not defined when -ffreestanding is not passed
-// to the compiler but defined when -ffreestanding is passed to the compiler.
-
-// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only %s
-// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only -ffreestanding -DFREESTANDING %s
-
-#include <__config>
-
-#if defined(FREESTANDING) != defined(_LIBCPP_FREESTANDING)
-#error _LIBCPP_FREESTANDING should be defined in freestanding mode and not \
-       defined in non-freestanding mode
-#endif



More information about the libcxx-commits mailing list