Skip to content

[libc] remove errno.h includes #110934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libc/include/llvm-libc-macros/linux/error-number-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@
#define EHWPOISON 133
#endif // EHWPOISON

#ifndef EOPNOTSUPP
#define EOPNOTSUPP 95
#endif

#ifndef ENOTSUP
#define ENOTSUP EOPNOTSUPP
#endif

#endif // LLVM_LIBC_MACROS_LINUX_ERROR_NUMBER_MACROS_H
6 changes: 3 additions & 3 deletions libc/src/__support/StringUtil/tables/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_header_library(
HDRS
stdc_errors.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.__support.StringUtil.message_mapper
)

Expand All @@ -12,7 +12,7 @@ add_header_library(
HDRS
posix_errors.h
DEPENDS
libc.include.errno
libc.src.errno.errno
libc.src.__support.StringUtil.message_mapper
)

Expand All @@ -21,8 +21,8 @@ add_header_library(
HDRS
linux_extension_errors.h
DEPENDS
libc.include.errno
libc.src.__support.StringUtil.message_mapper
libc.src.errno.errno
)

add_header_library(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

#include "src/__support/StringUtil/message_mapper.h"
#include "src/__support/macros/config.h"

#include <errno.h> // For error macros
#include "src/errno/libc_errno.h"

namespace LIBC_NAMESPACE_DECL {

Expand Down
3 changes: 1 addition & 2 deletions libc/src/__support/StringUtil/tables/posix_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H
#define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H

#include "hdr/errno_macros.h"
#include "src/__support/StringUtil/message_mapper.h"
#include "src/__support/macros/config.h"

#include <errno.h> // For error macros
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other error table files also need to include libc_errno.h. Also it seems like we don't have a complete list of errno macros in our include files so those will need to be updated before we can remove the public errno includes from these files.


namespace LIBC_NAMESPACE_DECL {

LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/__support/StringUtil/tables/stdc_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "src/__support/StringUtil/message_mapper.h"
#include "src/__support/macros/config.h"

#include <errno.h> // For error macros

namespace LIBC_NAMESPACE_DECL {

LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = {
Expand Down
10 changes: 0 additions & 10 deletions libc/src/math/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,6 @@ add_entrypoint_object(
DEPENDS
.common_constants
.explogxf
libc.include.errno
libc.src.__support.CPP.bit
libc.src.__support.CPP.optional
libc.src.__support.FPUtil.dyadic_float
Expand Down Expand Up @@ -1406,7 +1405,6 @@ add_entrypoint_object(
libc.src.__support.FPUtil.polyeval
libc.src.__support.FPUtil.rounding_mode
libc.src.__support.macros.optimization
libc.include.errno
libc.src.errno.errno
COMPILE_OPTIONS
-O3
Expand Down Expand Up @@ -1445,7 +1443,6 @@ add_entrypoint_object(
DEPENDS
.common_constants
.explogxf
libc.include.errno
libc.src.__support.CPP.bit
libc.src.__support.CPP.optional
libc.src.__support.FPUtil.dyadic_float
Expand Down Expand Up @@ -1478,7 +1475,6 @@ add_header_library(
libc.src.__support.FPUtil.rounding_mode
libc.src.__support.macros.optimization
libc.src.__support.common
libc.include.errno
libc.src.errno.errno
)

Expand Down Expand Up @@ -1548,7 +1544,6 @@ add_entrypoint_object(
DEPENDS
.common_constants
.explogxf
libc.include.errno
libc.src.__support.CPP.bit
libc.src.__support.CPP.optional
libc.src.__support.FPUtil.dyadic_float
Expand Down Expand Up @@ -1580,7 +1575,6 @@ add_header_library(
libc.src.__support.FPUtil.rounding_mode
libc.src.__support.macros.optimization
libc.src.__support.common
libc.include.errno
libc.src.errno.errno
COMPILE_OPTIONS
-O3
Expand Down Expand Up @@ -1632,7 +1626,6 @@ add_entrypoint_object(
DEPENDS
.common_constants
.explogxf
libc.include.errno
libc.src.__support.CPP.bit
libc.src.__support.CPP.optional
libc.src.__support.FPUtil.dyadic_float
Expand Down Expand Up @@ -1666,7 +1659,6 @@ add_entrypoint_object(
libc.src.__support.FPUtil.polyeval
libc.src.__support.FPUtil.rounding_mode
libc.src.__support.macros.optimization
libc.include.errno
libc.src.errno.errno
COMPILE_OPTIONS
-O3
Expand Down Expand Up @@ -1705,7 +1697,6 @@ add_entrypoint_object(
.exp10f_impl
.exp2f_impl
.explogxf
libc.include.errno
libc.src.__support.CPP.bit
libc.src.__support.CPP.optional
libc.src.__support.FPUtil.fenv_impl
Expand Down Expand Up @@ -4144,7 +4135,6 @@ add_object_library(
libc.src.__support.FPUtil.nearest_integer
libc.src.__support.FPUtil.polyeval
libc.src.__support.common
libc.include.errno
libc.src.errno.errno
COMPILE_OPTIONS
-O3
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/acosf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <errno.h>

#include "inv_trigf_utils.h"

namespace LIBC_NAMESPACE_DECL {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/asinf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#include <errno.h>

#include "inv_trigf_utils.h"

namespace LIBC_NAMESPACE_DECL {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/cosf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

// Exceptional cases for cosf.
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

using fputil::DoubleDouble;
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/exp10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

using fputil::DoubleDouble;
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/exp10f_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {
namespace generic {

Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/exp2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

using fputil::DoubleDouble;
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/exp2f_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h"

#include <errno.h>

#include "explogxf.h"

namespace LIBC_NAMESPACE_DECL {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/expf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(float, expf, (float x)) {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/explogxf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/cpu_features.h"

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

struct ExpBase {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/expm1f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(float, expm1f, (float x)) {
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/powf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "exp10f_impl.h" // Speedup for powf(10, y) = exp10f(y)
#include "exp2f_impl.h" // Speedup for powf(2, y) = exp2f(y)

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

using fputil::DoubleDouble;
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/sincosf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

// Exceptional values
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/sinf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#include <errno.h>

#if defined(LIBC_TARGET_CPU_HAS_FMA)
#include "range_reduction_fma.h"
#else
Expand Down
2 changes: 0 additions & 2 deletions libc/src/math/generic/tanf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA

#include <errno.h>

namespace LIBC_NAMESPACE_DECL {

// Exceptional cases for tanf.
Expand Down
Loading
Loading