[libcxx-commits] [libcxx] [libc++] __need_infinity_nan doesn't work in non-gnu c++ standards (PR #175849)

Ian Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 14 09:39:59 PST 2026


https://github.com/ian-twilightcoder updated https://github.com/llvm/llvm-project/pull/175849

>From 0f57a912b118a6f34a2cff4d133f090498d57cd9 Mon Sep 17 00:00:00 2001
From: Ian Anderson <iana at apple.com>
Date: Tue, 16 Dec 2025 11:30:31 -0800
Subject: [PATCH 1/3] [libc++] __need_infinity_nan doesn't work in non-gnu c++
 standards
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://github.com/llvm/llvm-project/pull/164348 adds a __need_infinity_nan macro to clang’s float.h. libc++’s float.h then needs to be a textual header to support it. That means it can't have any declarations, but the ones it has are unnecessary because clang's float.h already defines FLT_EVAL_METHOD and DECIMAL_DIG.
---
 libcxx/include/CMakeLists.txt                 |  1 +
 libcxx/include/__cxx03/cfloat                 |  4 +-
 libcxx/include/__cxx03/float.h                | 95 +++++++++++++++++++
 libcxx/include/cfloat                         |  8 --
 libcxx/include/float.h                        | 28 ++----
 libcxx/include/module.modulemap.in            |  3 +-
 .../extensions/clang/need_macros.verify.cpp   | 49 ++++++++++
 libcxx/test/std/header_inclusions.gen.py      |  4 +-
 8 files changed, 156 insertions(+), 36 deletions(-)
 create mode 100644 libcxx/include/__cxx03/float.h
 create mode 100644 libcxx/test/extensions/clang/need_macros.verify.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index f9ae22accd687..7a0853e1758df 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1622,6 +1622,7 @@ set(files
   __cxx03/ext/__hash
   __cxx03/ext/hash_map
   __cxx03/ext/hash_set
+  __cxx03/float.h
   __cxx03/forward_list
   __cxx03/fstream
   __cxx03/functional
diff --git a/libcxx/include/__cxx03/cfloat b/libcxx/include/__cxx03/cfloat
index a48a213f1669f..5d10db6a454a6 100644
--- a/libcxx/include/__cxx03/cfloat
+++ b/libcxx/include/__cxx03/cfloat
@@ -71,9 +71,9 @@ Macros:
 
 #include <__cxx03/__config>
 
-#include <float.h>
+#include <__cxx03/float.h>
 
-#ifndef _LIBCPP_FLOAT_H
+#ifndef _LIBCPP___CXX03_FLOAT_H
 #   error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/float.h b/libcxx/include/__cxx03/float.h
new file mode 100644
index 0000000000000..38f199067f411
--- /dev/null
+++ b/libcxx/include/__cxx03/float.h
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CXX03_FLOAT_H
+#define _LIBCPP___CXX03_FLOAT_H
+
+/*
+    float.h synopsis
+
+Macros:
+
+    FLT_ROUNDS
+    FLT_EVAL_METHOD     // C99
+    FLT_RADIX
+
+    FLT_MANT_DIG
+    DBL_MANT_DIG
+    LDBL_MANT_DIG
+
+    FLT_HAS_SUBNORM     // C11
+    DBL_HAS_SUBNORM     // C11
+    LDBL_HAS_SUBNORM    // C11
+
+    DECIMAL_DIG         // C99
+    FLT_DECIMAL_DIG     // C11
+    DBL_DECIMAL_DIG     // C11
+    LDBL_DECIMAL_DIG    // C11
+
+    FLT_DIG
+    DBL_DIG
+    LDBL_DIG
+
+    FLT_MIN_EXP
+    DBL_MIN_EXP
+    LDBL_MIN_EXP
+
+    FLT_MIN_10_EXP
+    DBL_MIN_10_EXP
+    LDBL_MIN_10_EXP
+
+    FLT_MAX_EXP
+    DBL_MAX_EXP
+    LDBL_MAX_EXP
+
+    FLT_MAX_10_EXP
+    DBL_MAX_10_EXP
+    LDBL_MAX_10_EXP
+
+    FLT_MAX
+    DBL_MAX
+    LDBL_MAX
+
+    FLT_EPSILON
+    DBL_EPSILON
+    LDBL_EPSILON
+
+    FLT_MIN
+    DBL_MIN
+    LDBL_MIN
+
+    FLT_TRUE_MIN        // C11
+    DBL_TRUE_MIN        // C11
+    LDBL_TRUE_MIN       // C11
+
+*/
+
+#include <__cxx03/__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if __has_include_next(<float.h>)
+#  include_next <float.h>
+#endif
+
+#ifdef __cplusplus
+
+#  ifndef FLT_EVAL_METHOD
+#    define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#  endif
+
+#  ifndef DECIMAL_DIG
+#    define DECIMAL_DIG __DECIMAL_DIG__
+#  endif
+
+#endif // __cplusplus
+
+#endif // _LIBCPP___CXX03_FLOAT_H
diff --git a/libcxx/include/cfloat b/libcxx/include/cfloat
index 18b4afd28ee87..2b82dd5caba97 100644
--- a/libcxx/include/cfloat
+++ b/libcxx/include/cfloat
@@ -76,14 +76,6 @@ Macros:
 
 #  include <float.h>
 
-#  ifndef _LIBCPP_FLOAT_H
-#   error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \
-          This usually means that your header search paths are not configured properly. \
-          The header search paths should contain the C++ Standard Library headers before \
-          any C Standard Library, and you are probably using compiler flags that make that \
-          not be the case.
-#  endif
-
 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #    pragma GCC system_header
 #  endif
diff --git a/libcxx/include/float.h b/libcxx/include/float.h
index 9de29ec7392f3..5a43a48f9d8ef 100644
--- a/libcxx/include/float.h
+++ b/libcxx/include/float.h
@@ -7,9 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP_FLOAT_H
-#define _LIBCPP_FLOAT_H
-
 /*
     float.h synopsis
 
@@ -71,29 +68,16 @@
 */
 
 #if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-#  include <__cxx03/__config>
+#  include <__cxx03/float.h>
 #else
 #  include <__config>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#if __has_include_next(<float.h>)
-#  include_next <float.h>
-#endif
 
-#ifdef __cplusplus
-
-#  ifndef FLT_EVAL_METHOD
-#    define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#    pragma GCC system_header
 #  endif
 
-#  ifndef DECIMAL_DIG
-#    define DECIMAL_DIG __DECIMAL_DIG__
+#  if __has_include_next(<float.h>)
+#    include_next <float.h>
 #  endif
 
-#endif // __cplusplus
-
-#endif // _LIBCPP_FLOAT_H
+#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 27178aa1f4378..6300c2d33589c 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -2429,8 +2429,7 @@ module std_fenv_h [system] {
   export *
 }
 module std_float_h [system] {
-  header "float.h"
-  export *
+  textual header "float.h"
 }
 module std_inttypes_h [system] {
   header "inttypes.h"
diff --git a/libcxx/test/extensions/clang/need_macros.verify.cpp b/libcxx/test/extensions/clang/need_macros.verify.cpp
new file mode 100644
index 0000000000000..227de5a6a0547
--- /dev/null
+++ b/libcxx/test/extensions/clang/need_macros.verify.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// gcc supports "partial inclusion" of some builtin headers via __need macros.
+// These are implemented in modules via textual headers, which are tricky to
+// support because libc++ needs to know about them and make its corresponding
+// headers textual too so that the macros are passed along.
+//
+// Another wrinkle is that __need macros can be used to force a type to be
+// when it wouldn't normally be. e.g. Apple platforms will use __need_rsize_t
+// to force the declaration of rsize_t to be visible even when
+// __STDC_WANT_LIB_EXT1__ isn't set.
+
+// gcc doesn't support all of the __need macros
+// UNSUPPORTED: gcc
+
+// The frozen C++03 headers don't support the __need macros tested here.
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// Some of the __need macros are new in clang 22.x and Apple clang 21.x (there
+// isn't an Apple clang 18-20)
+// UNSUPPORTED: clang-20, clang-21, apple-clang-17
+
+// float.h doesn't always define INFINITY and NAN.
+#define __need_infinity_nan
+#include <float.h>
+constexpr float infinity = INFINITY;
+constexpr float nan      = NAN;
+
+// Make sure that only the __need'ed interfaces are availbale. Note that the
+// C++ headers like <cstdarg> do -not- support partial inclusion, only the
+// "compatibility" headers.
+#define __need_va_list
+#include <stdarg.h>
+static void func(int param, ...) {
+  va_list args;
+  va_start(args, param); // expected-error {{use of undeclared identifier 'va_start'}}
+}
+
+// stddef.h doesn't always define max_align_t.
+#define __need_max_align_t
+#define __need_size_t
+#include <stddef.h>
+static_assert(alignof(max_align_t) >= alignof(long double), "");
diff --git a/libcxx/test/std/header_inclusions.gen.py b/libcxx/test/std/header_inclusions.gen.py
index cebff94fdd1ab..af2b20bb0fd18 100644
--- a/libcxx/test/std/header_inclusions.gen.py
+++ b/libcxx/test/std/header_inclusions.gen.py
@@ -32,8 +32,8 @@
         lambda h: f"_LIBCPP_{str(h).upper().replace('.', '_').replace('/', '_')}"
     )
 
-    # <cassert> has no header guards
-    if header == "cassert":
+    # <cassert> and <float.h> have no header guards
+    if (header == "cassert") or (header == "float.h"):
         checks = ""
     else:
         checks = f"""

>From 89a3159b774eb4ba99684307a36b69641a7124e3 Mon Sep 17 00:00:00 2001
From: Ian Anderson <iana at apple.com>
Date: Tue, 16 Dec 2025 17:18:08 -0800
Subject: [PATCH 2/3] Disable clang-22 on the new test

Probably the clang-22 on the builders isn't new enough that is has the new version of float.h
---
 libcxx/test/extensions/clang/need_macros.verify.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/extensions/clang/need_macros.verify.cpp b/libcxx/test/extensions/clang/need_macros.verify.cpp
index 227de5a6a0547..d9e7f7899aa4b 100644
--- a/libcxx/test/extensions/clang/need_macros.verify.cpp
+++ b/libcxx/test/extensions/clang/need_macros.verify.cpp
@@ -24,7 +24,7 @@
 
 // Some of the __need macros are new in clang 22.x and Apple clang 21.x (there
 // isn't an Apple clang 18-20)
-// UNSUPPORTED: clang-20, clang-21, apple-clang-17
+// UNSUPPORTED: clang-20, clang-21, clang-22, apple-clang-17
 
 // float.h doesn't always define INFINITY and NAN.
 #define __need_infinity_nan

>From d6e590550ff489f3de35e37b2178f5acbe4d6a31 Mon Sep 17 00:00:00 2001
From: Ian Anderson <iana at apple.com>
Date: Wed, 14 Jan 2026 09:39:09 -0800
Subject: [PATCH 3/3] Try not restoring float.h in C++03 mode

---
 libcxx/include/CMakeLists.txt                 |  2 -
 libcxx/include/__cxx03/cfloat                 | 10 +-
 libcxx/include/__cxx03/float.h                | 95 -------------------
 libcxx/include/__cxx03/module.modulemap       |  4 -
 libcxx/include/float.h                        | 83 ----------------
 libcxx/include/module.modulemap.in            |  3 -
 .../extensions/clang/need_macros.verify.cpp   | 49 ----------
 libcxx/test/std/header_inclusions.gen.py      |  4 +-
 8 files changed, 3 insertions(+), 247 deletions(-)
 delete mode 100644 libcxx/include/__cxx03/float.h
 delete mode 100644 libcxx/include/float.h
 delete mode 100644 libcxx/test/extensions/clang/need_macros.verify.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 7a0853e1758df..29a2e62066324 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1027,7 +1027,6 @@ set(files
   filesystem
   flat_map
   flat_set
-  float.h
   format
   forward_list
   fstream
@@ -1622,7 +1621,6 @@ set(files
   __cxx03/ext/__hash
   __cxx03/ext/hash_map
   __cxx03/ext/hash_set
-  __cxx03/float.h
   __cxx03/forward_list
   __cxx03/fstream
   __cxx03/functional
diff --git a/libcxx/include/__cxx03/cfloat b/libcxx/include/__cxx03/cfloat
index 5d10db6a454a6..2140d5898363a 100644
--- a/libcxx/include/__cxx03/cfloat
+++ b/libcxx/include/__cxx03/cfloat
@@ -71,15 +71,7 @@ Macros:
 
 #include <__cxx03/__config>
 
-#include <__cxx03/float.h>
-
-#ifndef _LIBCPP___CXX03_FLOAT_H
-#   error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \
-          This usually means that your header search paths are not configured properly. \
-          The header search paths should contain the C++ Standard Library headers before \
-          any C Standard Library, and you are probably using compiler flags that make that \
-          not be the case.
-#endif
+#include <float.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__cxx03/float.h b/libcxx/include/__cxx03/float.h
deleted file mode 100644
index 38f199067f411..0000000000000
--- a/libcxx/include/__cxx03/float.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03_FLOAT_H
-#define _LIBCPP___CXX03_FLOAT_H
-
-/*
-    float.h synopsis
-
-Macros:
-
-    FLT_ROUNDS
-    FLT_EVAL_METHOD     // C99
-    FLT_RADIX
-
-    FLT_MANT_DIG
-    DBL_MANT_DIG
-    LDBL_MANT_DIG
-
-    FLT_HAS_SUBNORM     // C11
-    DBL_HAS_SUBNORM     // C11
-    LDBL_HAS_SUBNORM    // C11
-
-    DECIMAL_DIG         // C99
-    FLT_DECIMAL_DIG     // C11
-    DBL_DECIMAL_DIG     // C11
-    LDBL_DECIMAL_DIG    // C11
-
-    FLT_DIG
-    DBL_DIG
-    LDBL_DIG
-
-    FLT_MIN_EXP
-    DBL_MIN_EXP
-    LDBL_MIN_EXP
-
-    FLT_MIN_10_EXP
-    DBL_MIN_10_EXP
-    LDBL_MIN_10_EXP
-
-    FLT_MAX_EXP
-    DBL_MAX_EXP
-    LDBL_MAX_EXP
-
-    FLT_MAX_10_EXP
-    DBL_MAX_10_EXP
-    LDBL_MAX_10_EXP
-
-    FLT_MAX
-    DBL_MAX
-    LDBL_MAX
-
-    FLT_EPSILON
-    DBL_EPSILON
-    LDBL_EPSILON
-
-    FLT_MIN
-    DBL_MIN
-    LDBL_MIN
-
-    FLT_TRUE_MIN        // C11
-    DBL_TRUE_MIN        // C11
-    LDBL_TRUE_MIN       // C11
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#if __has_include_next(<float.h>)
-#  include_next <float.h>
-#endif
-
-#ifdef __cplusplus
-
-#  ifndef FLT_EVAL_METHOD
-#    define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#  endif
-
-#  ifndef DECIMAL_DIG
-#    define DECIMAL_DIG __DECIMAL_DIG__
-#  endif
-
-#endif // __cplusplus
-
-#endif // _LIBCPP___CXX03_FLOAT_H
diff --git a/libcxx/include/__cxx03/module.modulemap b/libcxx/include/__cxx03/module.modulemap
index 34a2d0f25fc45..717926a46a55d 100644
--- a/libcxx/include/__cxx03/module.modulemap
+++ b/libcxx/include/__cxx03/module.modulemap
@@ -443,10 +443,6 @@ module cxx03_std_fenv_h [system] {
   header "fenv.h"
   export *
 }
-module cxx03_std_float_h [system] {
-  header "float.h"
-  export *
-}
 module cxx03_std_inttypes_h [system] {
   header "inttypes.h"
   export *
diff --git a/libcxx/include/float.h b/libcxx/include/float.h
deleted file mode 100644
index 5a43a48f9d8ef..0000000000000
--- a/libcxx/include/float.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-/*
-    float.h synopsis
-
-Macros:
-
-    FLT_ROUNDS
-    FLT_EVAL_METHOD     // C99
-    FLT_RADIX
-
-    FLT_MANT_DIG
-    DBL_MANT_DIG
-    LDBL_MANT_DIG
-
-    FLT_HAS_SUBNORM     // C11
-    DBL_HAS_SUBNORM     // C11
-    LDBL_HAS_SUBNORM    // C11
-
-    DECIMAL_DIG         // C99
-    FLT_DECIMAL_DIG     // C11
-    DBL_DECIMAL_DIG     // C11
-    LDBL_DECIMAL_DIG    // C11
-
-    FLT_DIG
-    DBL_DIG
-    LDBL_DIG
-
-    FLT_MIN_EXP
-    DBL_MIN_EXP
-    LDBL_MIN_EXP
-
-    FLT_MIN_10_EXP
-    DBL_MIN_10_EXP
-    LDBL_MIN_10_EXP
-
-    FLT_MAX_EXP
-    DBL_MAX_EXP
-    LDBL_MAX_EXP
-
-    FLT_MAX_10_EXP
-    DBL_MAX_10_EXP
-    LDBL_MAX_10_EXP
-
-    FLT_MAX
-    DBL_MAX
-    LDBL_MAX
-
-    FLT_EPSILON
-    DBL_EPSILON
-    LDBL_EPSILON
-
-    FLT_MIN
-    DBL_MIN
-    LDBL_MIN
-
-    FLT_TRUE_MIN        // C11
-    DBL_TRUE_MIN        // C11
-    LDBL_TRUE_MIN       // C11
-
-*/
-
-#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-#  include <__cxx03/float.h>
-#else
-#  include <__config>
-
-#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#    pragma GCC system_header
-#  endif
-
-#  if __has_include_next(<float.h>)
-#    include_next <float.h>
-#  endif
-
-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 6300c2d33589c..58b04811e242d 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -2428,9 +2428,6 @@ module std_fenv_h [system] {
   header "fenv.h"
   export *
 }
-module std_float_h [system] {
-  textual header "float.h"
-}
 module std_inttypes_h [system] {
   header "inttypes.h"
   export *
diff --git a/libcxx/test/extensions/clang/need_macros.verify.cpp b/libcxx/test/extensions/clang/need_macros.verify.cpp
deleted file mode 100644
index d9e7f7899aa4b..0000000000000
--- a/libcxx/test/extensions/clang/need_macros.verify.cpp
+++ /dev/null
@@ -1,49 +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
-//
-//===----------------------------------------------------------------------===//
-
-// gcc supports "partial inclusion" of some builtin headers via __need macros.
-// These are implemented in modules via textual headers, which are tricky to
-// support because libc++ needs to know about them and make its corresponding
-// headers textual too so that the macros are passed along.
-//
-// Another wrinkle is that __need macros can be used to force a type to be
-// when it wouldn't normally be. e.g. Apple platforms will use __need_rsize_t
-// to force the declaration of rsize_t to be visible even when
-// __STDC_WANT_LIB_EXT1__ isn't set.
-
-// gcc doesn't support all of the __need macros
-// UNSUPPORTED: gcc
-
-// The frozen C++03 headers don't support the __need macros tested here.
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
-// Some of the __need macros are new in clang 22.x and Apple clang 21.x (there
-// isn't an Apple clang 18-20)
-// UNSUPPORTED: clang-20, clang-21, clang-22, apple-clang-17
-
-// float.h doesn't always define INFINITY and NAN.
-#define __need_infinity_nan
-#include <float.h>
-constexpr float infinity = INFINITY;
-constexpr float nan      = NAN;
-
-// Make sure that only the __need'ed interfaces are availbale. Note that the
-// C++ headers like <cstdarg> do -not- support partial inclusion, only the
-// "compatibility" headers.
-#define __need_va_list
-#include <stdarg.h>
-static void func(int param, ...) {
-  va_list args;
-  va_start(args, param); // expected-error {{use of undeclared identifier 'va_start'}}
-}
-
-// stddef.h doesn't always define max_align_t.
-#define __need_max_align_t
-#define __need_size_t
-#include <stddef.h>
-static_assert(alignof(max_align_t) >= alignof(long double), "");
diff --git a/libcxx/test/std/header_inclusions.gen.py b/libcxx/test/std/header_inclusions.gen.py
index af2b20bb0fd18..cebff94fdd1ab 100644
--- a/libcxx/test/std/header_inclusions.gen.py
+++ b/libcxx/test/std/header_inclusions.gen.py
@@ -32,8 +32,8 @@
         lambda h: f"_LIBCPP_{str(h).upper().replace('.', '_').replace('/', '_')}"
     )
 
-    # <cassert> and <float.h> have no header guards
-    if (header == "cassert") or (header == "float.h"):
+    # <cassert> has no header guards
+    if header == "cassert":
         checks = ""
     else:
         checks = f"""



More information about the libcxx-commits mailing list