Skip to content
Draft
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
19 changes: 12 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ build --enable_platform_specific_config
# Gather build version information
build --workspace_status_command="bash bazel/build-version.sh"

# Systems with gcc or clang
common:linux --cxxopt=-xc++ --host_cxxopt=-xc++ --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17
common:freebsd --cxxopt=-xc++ --host_cxxopt=-xc++ --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17 --linkopt=-lm --host_linkopt=-lm
common:openbsd --cxxopt=-xc++ --host_cxxopt=-xc++ --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17 --linkopt=-lm --host_linkopt=-lm
common:macos --cxxopt=-xc++ --host_cxxopt=-xc++ --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
build --cxxopt=-xc++ --host_cxxopt=-xc++
build --cxxopt=-Wall --host_cxxopt=-Wall
build --cxxopt=-Wextra --host_cxxopt=-Wextra

common:freebsd --linkopt=-lm --host_linkopt=-lm
common:openbsd --linkopt=-lm --host_linkopt=-lm

# https://github.com/abseil/abseil-cpp/issues/848
# https://github.com/bazelbuild/bazel/issues/4341#issuecomment-758361769
Expand All @@ -25,13 +27,16 @@ common:macos --features=-supports_dynamic_linker --linkopt=-framework --linkopt=
# Since we use designated initializers (C99 ... but >= c++20), compiler really wants the c++20 mode
common:windows --compiler=clang-cl --cxxopt=/std:c++20 --host_cxxopt=/std:c++20 --client_env=BAZEL_CXXOPTS=/std:c++20

# Disable some benign warnings.
build --cxxopt="-Wno-unknown-warning-option" --host_cxxopt="-Wno-unknown-warning-option"
build --cxxopt="-Wno-unused-parameter" --host_cxxopt="-Wno-unused-parameter"
build --cxxopt="-Wno-missing-field-initializers" --host_cxxopt="-Wno-missing-field-initializers"

# TODO: this looks like benign where it happens but to be explored further
build --cxxopt="-Wno-dangling-reference" --host_cxxopt="-Wno-dangling-reference"

# Newer bisons create an unused label.
build --cxxopt="-Wno-unused-label" --host_cxxopt="-Wno-unused-label"
# c++20 warning on protobuf 28.1
build --cxxopt="-Wno-missing-requires" --host_cxxopt="-Wno-missing-requires"

# For 3rd party code: Disable warnings entirely.
# They are not actionable and just create noise.
Expand Down
48 changes: 3 additions & 45 deletions .github/bin/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,53 +40,15 @@ fi
# as possible to compile without exceptions.
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-fno-exceptions"

# Avoid expensive language feature. Maybe should consider to put into .bazelrc
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-fno-rtti"

# Turn warnings to 11. And fail compliation if we encounter one.
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Werror" # Always want bail on warning
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-W --cxxopt=-Wall --cxxopt=-Wextra"

# The following warning only reports with clang++; it is ignored by gcc
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wunreachable-code"

# -- now disable some of the warnings that happen, so that the compile finishes.

# Status-quo of warnings happening in our code-base. These are benign.
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-unused-parameter"
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-missing-field-initializers"

# Warnings in our code-base, that we might consider removing.
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-redundant-move"

# Newer bisons produce an unused label in generated code
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-unused-label"

# Compiler evaluates sizeof...(args) and complains about zero
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-type-limits"

# Warnings that come from other external parts that we compile.
# Ideally, we would separate them out to ignore only there, while we keep
# tight warnings on for 'our' code-base.
# TODO(hzeller): Remove after
# https://github.com/chipsalliance/verible/issues/747 is figured out
if [[ "${CXX}" == clang* ]]; then
# -- only recognized by clang
# Don't rely on implicit template type deduction
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wctad-maybe-unsupported"

# Also warn about string conversion issues.
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wstring-conversion"

BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-unused-function" # utf8_range dependencyo

BAZEL_TEST_OPTS="--copt -D_LIBCPP_ENABLE_DEBUG_MODE"
else # gcc
# disabled for now https://github.com/chipsalliance/verible/issues/1056
#BAZEL_TEST_OPTS="--copt -D_GLIBCXX_DEBUG"
PLACEHOLDER_ASSIGNMENT_SO_THAT_ELSE_BRANCH_DOES_NOT_CREATE_SYNTAX_ERROR=1
fi

# Protobuf triggers a maybe-uninitialized warning.
BAZEL_OPTS="${BAZEL_OPTS} --cxxopt=-Wno-uninitialized"

# If parameter given and the MODE allows choosing, we build the target
# as provided, otherwise all. This allows manual invocation of interesting
# targets.
Expand All @@ -97,10 +59,6 @@ case "$MODE" in
bazel test --keep_going --cache_test_results=no --test_output=errors ${BAZEL_OPTS} ${BAZEL_TEST_OPTS} ${CHOSEN_TARGETS}
;;

test-nortti)
bazel test --keep_going --cache_test_results=no --test_output=errors ${BAZEL_OPTS} --cxxopt=-fno-rtti ${CHOSEN_TARGETS}
;;

asan|asan-clang)
if [[ "${MODE}" == "asan" ]]; then
# Some gcc 12 issue with regexp it seems.
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/verible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ jobs:
mode:
- test
- test-clang
- test-nortti
- test-c++20
- test-c++23
- smoke-test
Expand All @@ -139,8 +138,6 @@ jobs:
- x86_64
- arm64
exclude:
- mode: test-nortti
arch: arm64
- mode: test-c++20
arch: arm64
- mode: test-c++23
Expand Down