From 1cec6a56685b2e846acc6304b3ada0367e0076e8 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Thu, 6 Jun 2024 17:08:12 -0700 Subject: [PATCH] Allow unused parameters in the stdlib build Previously, the stdlib would fail to build if the C toolchain enabled -Werror/-Wextra/-Wunused-parameter since it has unused parameters. This change removes those flags when building the stdlib. --- go/platform/apple.bzl | 2 ++ go/private/context.bzl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/go/platform/apple.bzl b/go/platform/apple.bzl index fe4427622..dd7daae2e 100644 --- a/go/platform/apple.bzl +++ b/go/platform/apple.bzl @@ -44,5 +44,7 @@ def apple_ensure_options(ctx, env, compiler_option_lists, linker_option_lists, t min_version = _apple_version_min(ctx, platform, platform_type) for compiler_options in compiler_option_lists: compiler_options.append(min_version) + # Allow unused parameters since they are present in the stdlib src. + compiler_options.append("-Wno-unused-parameter") for linker_options in linker_option_lists: linker_options.append(min_version) diff --git a/go/private/context.bzl b/go/private/context.bzl index 68a4faa65..e4b92bcb4 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -100,6 +100,8 @@ _COMPILER_OPTIONS_DENYLIST = dict({ # fmax-errors limits that and causes build failures. "-fmax-errors=": None, "-Wall": None, + "-Wunused-parameter": None, + "-Wextra": None, # Symbols are needed by Go, so keep them "-g0": None,