Fix -Wundef compilation

This allows downstream consumers of protobuf to enable
Wundef in their code which consumes protobuf APIs.

This change also enables warnings in the ci bazelrc to ensure that
no new warning failures are introduced.
pull/17845/head
Taylor Cramer 6 months ago
parent 9dc5aaa1e9
commit 8750f8c5f8
  1. 11
      ci/common.bazelrc
  2. 1
      toolchain/cc_toolchain_config.bzl

@ -33,6 +33,17 @@ build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr
# Abseil passes nullptr to memcmp with 0 size
build:ubsan --copt=-fno-sanitize=nonnull-attribute
# Check for common warnings to allow for strict downstream warning checks.
build --copt=-Wundef
build --copt=-Wpointer-arith
# Build currently fails under:
# build --copt=-Wshadow
# build --copt=-Wredundant-decls
# build --copt=-Wall
# build --copt=-Wextra
# build --copt=-Wimplicit-fallthrough
# build --copt=-Wcast-qual
# Workaround Bazel 7 remote cache issues.
# See https://github.com/bazelbuild/bazel/issues/20161
build --experimental_remote_cache_eviction_retries=5

@ -146,6 +146,7 @@ def _impl(ctx):
flags = [
bit_flag,
"-Wall",
"-Wundef",
"-no-canonical-prefixes",
"--target=" + ctx.attr.target_full_name,
"-fvisibility=hidden",

Loading…
Cancel
Save