[libcxx-commits] [libcxx] [libc++] Remove libc++'s own fenv.h (PR #194629)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 1 23:21:09 PDT 2026
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/194629
>From 77377da6dd2b5a8582b6bf30a1645a409ab04dc0 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Tue, 28 Apr 2026 15:34:58 +0200
Subject: [PATCH] [libc++] Remove libc++'s own fenv.h
---
libcxx/include/CMakeLists.txt | 1 -
libcxx/include/__cxx03/cfenv | 13 ++--
libcxx/include/cfenv | 13 ++--
libcxx/include/fenv.h | 118 -----------------------------
libcxx/include/module.modulemap.in | 4 -
5 files changed, 10 insertions(+), 139 deletions(-)
delete mode 100644 libcxx/include/fenv.h
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 497aadfd799bf..b42afd52be143 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1036,7 +1036,6 @@ set(files
ext/__hash
ext/hash_map
ext/hash_set
- fenv.h
filesystem
flat_map
flat_set
diff --git a/libcxx/include/__cxx03/cfenv b/libcxx/include/__cxx03/cfenv
index d3a5839221a82..1413388113293 100644
--- a/libcxx/include/__cxx03/cfenv
+++ b/libcxx/include/__cxx03/cfenv
@@ -54,14 +54,11 @@ int feupdateenv(const fenv_t* envp);
#include <__cxx03/__config>
-#include <fenv.h>
-
-#ifndef _LIBCPP_FENV_H
-# error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.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.
+#if __has_include(<fenv.h>)
+# include <fenv.h>
+# ifdef _LIBCPP_FENV_H
+# error "If libc++ starts defining <fenv.h>, the __has_include check should move to libc++'s <fenv.h>"
+# endif
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/cfenv b/libcxx/include/cfenv
index d7ea770297530..af73ce777c445 100644
--- a/libcxx/include/cfenv
+++ b/libcxx/include/cfenv
@@ -57,14 +57,11 @@ int feupdateenv(const fenv_t* envp);
#else
# include <__config>
-# include <fenv.h>
-
-# ifndef _LIBCPP_FENV_H
-# error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.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.
+# if __has_include(<fenv.h>)
+# include <fenv.h>
+# ifdef _LIBCPP_FENV_H
+# error "If libc++ starts defining <fenv.h>, the __has_include check should move to libc++'s <fenv.h>"
+# endif
# endif
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/fenv.h b/libcxx/include/fenv.h
deleted file mode 100644
index a767269b5c989..0000000000000
--- a/libcxx/include/fenv.h
+++ /dev/null
@@ -1,118 +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_FENV_H
-#define _LIBCPP_FENV_H
-
-/*
- fenv.h synopsis
-
-This entire header is C99 / C++0X
-
-Macros:
-
- FE_DIVBYZERO
- FE_INEXACT
- FE_INVALID
- FE_OVERFLOW
- FE_UNDERFLOW
- FE_ALL_EXCEPT
- FE_DOWNWARD
- FE_TONEAREST
- FE_TOWARDZERO
- FE_UPWARD
- FE_DFL_ENV
-
-Types:
-
- fenv_t
- fexcept_t
-
-int feclearexcept(int excepts);
-int fegetexceptflag(fexcept_t* flagp, int excepts);
-int feraiseexcept(int excepts);
-int fesetexceptflag(const fexcept_t* flagp, int excepts);
-int fetestexcept(int excepts);
-int fegetround();
-int fesetround(int round);
-int fegetenv(fenv_t* envp);
-int feholdexcept(fenv_t* envp);
-int fesetenv(const fenv_t* envp);
-int feupdateenv(const fenv_t* envp);
-
-
-*/
-
-#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/__config>
-#else
-# include <__config>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if __has_include_next(<fenv.h>)
-# include_next <fenv.h>
-#endif
-
-#ifdef __cplusplus
-
-extern "C++" {
-
-# ifdef feclearexcept
-# undef feclearexcept
-# endif
-
-# ifdef fegetexceptflag
-# undef fegetexceptflag
-# endif
-
-# ifdef feraiseexcept
-# undef feraiseexcept
-# endif
-
-# ifdef fesetexceptflag
-# undef fesetexceptflag
-# endif
-
-# ifdef fetestexcept
-# undef fetestexcept
-# endif
-
-# ifdef fegetround
-# undef fegetround
-# endif
-
-# ifdef fesetround
-# undef fesetround
-# endif
-
-# ifdef fegetenv
-# undef fegetenv
-# endif
-
-# ifdef feholdexcept
-# undef feholdexcept
-# endif
-
-# ifdef fesetenv
-# undef fesetenv
-# endif
-
-# ifdef feupdateenv
-# undef feupdateenv
-# endif
-
-} // extern "C++"
-
-#endif // defined(__cplusplus)
-
-#endif // _LIBCPP_FENV_H
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index a6f9c5f9f2d09..e14e4e93418e4 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -2453,10 +2453,6 @@ module std_errno_h [system] {
header "errno.h"
export *
}
-module std_fenv_h [system] {
- header "fenv.h"
- export *
-}
module std_math_h [system] {
header "math.h"
export *
More information about the libcxx-commits
mailing list