From 214019510b7cad2246df670db3638520c80095b9 Mon Sep 17 00:00:00 2001 From: Tim Trippel Date: Mon, 14 Oct 2024 22:22:24 -0700 Subject: [PATCH 1/3] [bazel] update platforms dep to latest version Update platforms dep from 0.0.5 to 0.0.10. Signed-off-by: Tim Trippel --- third_party/bazel/repos.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/bazel/repos.bzl b/third_party/bazel/repos.bzl index 217f57f..aea3a65 100644 --- a/third_party/bazel/repos.bzl +++ b/third_party/bazel/repos.bzl @@ -10,10 +10,10 @@ def bazel_repos(): http_archive, name = "platforms", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz", - "https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", + "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", ], - sha256 = "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407", + sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", ) maybe( From 450767acfbee56f415ddcef47c9e687497d7f9d1 Mon Sep 17 00:00:00 2001 From: Tim Trippel Date: Wed, 16 Oct 2024 11:50:15 -0700 Subject: [PATCH 2/3] [pkg_win] fix cc_toolchain resolution across bazel versions This enables CC toolchain resolution across older and newer versions of Bazel which are used across lowRISC repos. Signed-off-by: Tim Trippel --- rules/pkg_win.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/pkg_win.bzl b/rules/pkg_win.bzl index 5f40be0..dd97e4e 100644 --- a/rules/pkg_win.bzl +++ b/rules/pkg_win.bzl @@ -20,7 +20,8 @@ def _pkg_win_impl(ctx): else: fail("Unknown platform:", ctx.attr.platform) - cc_toolchain = find_cc_toolchain(ctx) + toolchain = find_cc_toolchain(ctx) + cc_toolchain = getattr(toolchain, "cc", toolchain) mxe = _get_toolchain_dir(cc_toolchain) args = [ From 845f62b7716722ebf2592d94243b085ea4fa3df4 Mon Sep 17 00:00:00 2001 From: Tim Trippel Date: Wed, 16 Oct 2024 12:29:28 -0700 Subject: [PATCH 3/3] [features] distinguish between C-only features The `-Wstrict-prototypes` warning is only applicable to C code, not C++ code. See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstrict-prototypes Signed-off-by: Tim Trippel --- config/features.bzl | 8 ++++---- features/common/BUILD.bazel | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/features.bzl b/config/features.bzl index b1c7cc6..2a42679 100644 --- a/config/features.bzl +++ b/config/features.bzl @@ -79,7 +79,7 @@ def reify_with_features_set( fail("the argument to with_features must be an array of values created by with_feature_set") return with_feature_set( features, - not_features + not_features, ) def reify_flag_set( @@ -89,7 +89,7 @@ def reify_flag_set( type_name = None): return __flag_set( actions, - with_features =[reify_with_features_set(**v) for v in with_features], + with_features = [reify_with_features_set(**v) for v in with_features], flag_groups = [reify_flag_group(**v) for v in flag_groups], ) @@ -183,14 +183,14 @@ feature = rule( provides = [FeatureInfo], ) -def feature_single_flag_c_cpp(name, flag, enabled = True): +def feature_single_flag_c_cpp(name, flag, c_only = False, enabled = True): """This macro produces a C/C++ feature() that enables a single flag.""" feature( name = name, enabled = enabled, flag_sets = [ flag_set( - actions = CPP_ALL_COMPILE_ACTIONS + C_ALL_COMPILE_ACTIONS, + actions = C_ALL_COMPILE_ACTIONS + ([] if c_only else CPP_ALL_COMPILE_ACTIONS), flag_groups = [ flag_group( flags = [flag], diff --git a/features/common/BUILD.bazel b/features/common/BUILD.bazel index e93785d..9bcf663 100644 --- a/features/common/BUILD.bazel +++ b/features/common/BUILD.bazel @@ -84,6 +84,7 @@ feature_single_flag_c_cpp( feature_single_flag_c_cpp( name = "strict_prototypes_warnings", + c_only = True, flag = "-Wstrict-prototypes", ) @@ -174,7 +175,7 @@ feature( flag_groups = [ flag_group( flags = [ - "-flto" + "-flto", ], ), ],