Skip to content

Revert "[libc] Remove direct math.h includes from src" #85314

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 1 commit into from
Mar 14, 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
3 changes: 2 additions & 1 deletion libc/src/__support/FPUtil/FEnvImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H

#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
#include "src/__support/macros/properties/architectures.h"
#include "src/errno/libc_errno.h"

#include <fenv.h>
#include <math.h>

#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
#if defined(__APPLE__)
Expand Down
3 changes: 2 additions & 1 deletion libc/src/__support/FPUtil/ManipulationFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
#include "dyadic_float.h"
#include "rounding_mode.h"

#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY

#include <math.h>

namespace LIBC_NAMESPACE {
namespace fputil {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/__support/FPUtil/NearestIntegerOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
#include "FPBits.h"
#include "rounding_mode.h"

#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"

#include <math.h>

namespace LIBC_NAMESPACE {
namespace fputil {

Expand Down
3 changes: 2 additions & 1 deletion libc/src/math/generic/math_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#ifndef LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H
#define LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H

#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/errno/libc_errno.h"

#include <math.h>

#include <stdint.h>

// TODO: evaluate which functions from this file are actually used.
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/ILogbTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H

#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "test/UnitTest/Test.h"
#include <math.h>

class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {
public:
Expand Down
16 changes: 1 addition & 15 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,7 @@ config_setting(
flag_values = {":mpfr": "system"},
)

################################# Include Files ################################

libc_support_library(
name = "internal_includes",
hdrs = glob([
"include/llvm-libc-macros/*.h",
"include/llvm-libc/types/*",
]),
)

############################### Support libraries ##############################
############################## Support libraries #############################

libc_support_library(
name = "__support_macros_properties_architectures",
Expand Down Expand Up @@ -680,7 +670,6 @@ libc_support_library(
":__support_macros_properties_architectures",
":__support_macros_sanitizer",
":errno",
":internal_includes",
],
)

Expand Down Expand Up @@ -750,7 +739,6 @@ libc_support_library(
":__support_fputil_normal_float",
":__support_macros_optimization",
":__support_uint128",
":internal_includes",
],
)

Expand All @@ -764,7 +752,6 @@ libc_support_library(
":__support_fputil_fp_bits",
":__support_fputil_rounding_mode",
":__support_macros_attributes",
":internal_includes",
],
)

Expand Down Expand Up @@ -1186,7 +1173,6 @@ libc_support_library(
"__support_cpp_type_traits",
":__support_common",
":errno",
":internal_includes",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ libc_test(
name = "integer_to_string_test",
srcs = ["integer_to_string_test.cpp"],
deps = [
"//libc:__support_cpp_limits",
"//libc:__support_cpp_span",
"//libc:__support_cpp_limits",
"//libc:__support_cpp_string_view",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ libc_support_library(
"//libc:__support_cpp_limits",
"//libc:__support_fputil_fp_bits",
"//libc:__support_fputil_manipulation_functions",
"//libc:internal_includes",
"//libc/test/UnitTest:LibcUnitTest",
],
)
Expand Down