From 8de802e221b37df3900f560a5cef53684dc9bb6a Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Thu, 9 Feb 2023 21:36:59 +0000 Subject: [PATCH] [bazel] Add layering-check In the same vein as https://reviews.llvm.org/D141553 Enable the feature globally to ensure layering and catch circular dependencies (https://llvm.org/docs/CodingStandards.html#library-layering). Differential Revision: https://reviews.llvm.org/D143678 --- utils/bazel/.bazelrc | 3 +++ .../llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc index b2b472b..b0f137f 100644 --- a/utils/bazel/.bazelrc +++ b/utils/bazel/.bazelrc @@ -22,6 +22,9 @@ build --dynamic_mode=off # based on compilation_mode. build --strip=never +# Add layering check to all projects. +build --features=layering_check + ############################################################################### # Options to select different strategies for linking potential dependent # libraries. The default leaves it disabled. diff --git a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel index 3cd50bf..09d9144 100644 --- a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel @@ -27,6 +27,13 @@ cc_library( name = "mpfr_wrapper", srcs = ["MPFRUtils.cpp"], hdrs = ["MPFRUtils.h"], + # Disable layering check when using mpfr_system. + features = select( + { + "//conditions:default": [], + "//libc:mpfr_system": ["-layering_check"], + }, + ), deps = [ "//libc:__support_common", "//libc:__support_cpp_bit", @@ -36,9 +43,9 @@ cc_library( "//libc:__support_fputil_fp_bits", "//libc:__support_fputil_platform_defs", "//libc:libc_root", - "//libc/utils/MPFRWrapper:mpfr_impl", "//libc/test/UnitTest:LibcUnitTest", "//libc/test/UnitTest:fp_test_helpers", + "//libc/utils/MPFRWrapper:mpfr_impl", "//libc/utils/testutils:libc_test_utils", ], ) -- 2.7.4