Skip to content

Commit dc58a08

Browse files
authored
[libc][bazel] Enable parse_headers feature for llvm-libc. (#150538)
See https://bazel.build/docs/bazel-and-cpp#toolchain-features for why this feature is recommended for C++ projects. 215dbcb added the necessary default Bazel flag to make this feature functional. It can be enabled on a per-project basis. Do this now for llvm-libc. After enabling this feature, Blaze tries to parse headers from all header-only libraries, even if the headers are not explicitly used in tests, which allows to detect the issues early on. Fix a couple of -Wunused-function warnings by marking the static functions as constexpr or inline.
1 parent 0c6784c commit dc58a08

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

libc/src/__support/math/exp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static double set_exceptional(double x) {
234234

235235
namespace math {
236236

237-
static double exp(double x) {
237+
static constexpr double exp(double x) {
238238
using FPBits = typename fputil::FPBits<double>;
239239
FPBits xbits(x);
240240

libc/src/math/generic/range_reduction_double_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ struct LargeRangeReduction {
278278
};
279279

280280
#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
281-
static Float128 range_reduction_small_f128(double x) {
281+
LIBC_INLINE static Float128 range_reduction_small_f128(double x) {
282282
constexpr Float128 PI_OVER_128_F128 = {
283283
Sign::POS, -133, 0xc90f'daa2'2168'c234'c4c6'628b'80dc'1cd1_u128};
284284
constexpr double ONE_TWENTY_EIGHT_OVER_PI_D = 0x1.45f306dc9c883p5;

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ load(":platforms.bzl", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_X86_64")
1919
package(
2020
default_visibility = ["//visibility:public"],
2121
features = [
22+
"parse_headers",
2223
"-use_header_modules",
2324
"-layering_check",
2425
],

0 commit comments

Comments
 (0)