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
11 changes: 10 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ build --cxxopt=-fexceptions --host_cxxopt=-fexceptions
build --copt "-Wall" --host_copt "-Wall"
build --copt "-Wextra" --host_copt "-Wextra"

# Treat specific warnings as errors
build --copt "-Werror=array-bounds" --host_copt "-Werror=array-bounds"
build --copt "-Werror=dangling" --host_copt "-Werror=dangling"
build --copt "-Werror=dangling-assignment" --host_copt "-Werror=dangling-assignment"
build --copt "-Werror=dangling-assignment-gsl" --host_copt "-Werror=dangling-assignment-gsl"
build --copt "-Werror=dangling-field" --host_copt "-Werror=dangling-field"
build --copt "-Werror=dangling-gsl" --host_copt "-Werror=dangling-gsl"
build --copt "-Werror=fortify-source" --host_copt "-Werror=fortify-source"
build --copt "-Werror=return-stack-address" --host_copt "-Werror=return-stack-address"
Comment on lines +54 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding Clang-specific warning options like -Werror=dangling, -Werror=dangling-assignment, -Werror=dangling-gsl, and -Werror=fortify-source unconditionally to the global build options will break builds using the GCC compiler. GCC does not recognize these warning options and will fail the build with a hard error (e.g., error: -Werror=dangling: no option -Wdangling). To maintain compatibility with GCC, consider moving these Clang-specific flags to a compiler-specific configuration block or using Bazel's platform/toolchain-based select mechanism.


# ... and disable the warnings we're not interested in.
build --copt "-Wno-sign-compare" --host_copt "-Wno-sign-compare"
build --copt "-Wno-unused-parameter" --host_copt "-Wno-unused-parameter"
Expand All @@ -73,7 +83,6 @@ build --copt "-Wno-cast-function-type-mismatch" --host_copt "-Wno-cast-function
build --copt "-Wno-unused-but-set-variable" --host_copt "-Wno-unused-but-set-variable"
build --cxxopt "-Wno-deprecated-copy" --host_cxxopt "-Wno-deprecated-copy"
build --cxxopt "-Wno-deprecated-copy-with-user-provided-copy" --host_cxxopt "-Wno-deprecated-copy-with-user-provided-copy"
build --cxxopt "-Wno-dangling" --host_cxxopt "-Wno-dangling"

# For 3rd party code: Disable warnings entirely.
# They are not actionable and just create noise.
Expand Down
2 changes: 1 addition & 1 deletion src/dbSta/src/dbSta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ void dbSta::dumpModInstGraphConnections(const char* mod_inst_name,

bool is_external = false;
if (from_pin) {
std::string_view pin_name = network()->name(from_pin);
std::string pin_name = network()->name(from_pin);
std::string mod_prefix = db_mod_inst->getName();
mod_prefix += "/"; // e.g., "_202_/"
if (!pin_name.starts_with(mod_prefix)) {
Expand Down
Loading