Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[contrib] Disable GCC warnings and broken features #37131

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ test --experimental_ui_max_stdouterr_bytes=11712829 #default 1048576
# Allow tags to influence execution requirements
common --experimental_allow_tags_propagation

build:linux --copt=-fdebug-types-section
# Enable position independent code (this is the default on macOS and Windows)
# (Workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/421)
build:linux --copt=-fdebug-types-section
build:linux --copt=-fPIC
build:linux --copt=-Wno-deprecated-declarations
build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
Expand Down Expand Up @@ -95,6 +95,21 @@ build:gcc --linkopt=-fuse-ld=gold --host_linkopt=-fuse-ld=gold
build:gcc --test_env=HEAPCHECK=
build:gcc --action_env=BAZEL_COMPILER=gcc
build:gcc --action_env=CC=gcc --action_env=CXX=g++
# This is to work around a bug in GCC that makes debug-types-section
# option not play well with fission:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110885
build:gcc --copt=-fno-debug-types-section
# These trigger errors in multiple places both in Envoy dependecies
# and in Envoy code itself when using GCC.
# And in all cases the reports appear to be clear false positives.
build:gcc --copt=-Wno-error=restrict
build:gcc --copt=-Wno-error=uninitialized
build:gcc --cxxopt=-Wno-missing-requires
# We need this because -Wno-missing-requires options is rather new
# in GCC, so flags -Wno-missing-requires exists in GCC 12, but does
# not in GCC 11 and GCC 11 is what is used in docker-gcc
# configuration currently
build:gcc --cxxopt=-Wno-unknown-warning

# Clang-tidy
# TODO(phlax): enable this, its throwing some errors as well as finding more issues
Expand Down Expand Up @@ -374,6 +389,7 @@ build:docker-clang-libc++ --config=docker-sandbox
build:docker-clang-libc++ --config=rbe-toolchain-clang-libc++

build:docker-gcc --config=docker-sandbox
build:docker-gcc --config=gcc
build:docker-gcc --config=rbe-toolchain-gcc

build:docker-asan --config=docker-sandbox
Expand Down
16 changes: 15 additions & 1 deletion bazel/envoy_internal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,21 @@ def envoy_copts(repository, test = False):
"-Wc++2a-extensions",
"-Wrange-loop-analysis",
],
repository + "//bazel:gcc_build": ["-Wno-maybe-uninitialized"],
repository + "//bazel:gcc_build": [
"-Wno-maybe-uninitialized",
# GCC implementation of this warning is too noisy.
#
# It generates warnings even in cases where there is no ambiguity
# between the overloaded version of a method and the hidden version
# from the base class. E.g., when the two have different number of
# arguments or incompatible types and therefore a wrong function
# cannot be called by mistake without triggering a compiler error.
#
# As a safeguard, this warning is only disabled for GCC builds, so
# if Clang catches a problem in the code we would get a warning
# anyways.
"-Wno-error=overloaded-virtual",
],
# Allow 'nodiscard' function results values to be discarded for test code only
# TODO(envoyproxy/windows-dev): Replace /Zc:preprocessor with /experimental:preprocessor
# for msvc versions between 15.8 through 16.4.x. see
Expand Down