Skip to content

[core] Turn off -wshadow for tests#56030

Merged
dayshah merged 1 commit intoray-project:masterfrom
dayshah:no-wshadow-tests
Aug 28, 2025
Merged

[core] Turn off -wshadow for tests#56030
dayshah merged 1 commit intoray-project:masterfrom
dayshah:no-wshadow-tests

Conversation

@dayshah
Copy link
Copy Markdown
Contributor

@dayshah dayshah commented Aug 28, 2025

There's like 13 cpp tests failing to build right now with errors all over because of the -Wshadow we recently added.

Fixing some shadowing and then turning off -Wshadow for the tests.

@dayshah dayshah requested a review from a team as a code owner August 28, 2025 01:05
@dayshah dayshah added the go add ONLY when ready to merge, run all tests label Aug 28, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to disable the -Wshadow compiler warning for tests. It correctly modifies the Bazel build configuration to create a separate set of compiler options for tests (COPTS_TESTS) without this flag. Additionally, it includes a number of valuable fixes for existing shadowing warnings in various test files, which improves code quality.

However, there's a small oversight in the Bazel configuration: the ray_cc_test function is not updated to use the new COPTS_TESTS variable, so tests will still be compiled with -Wshadow. My review includes a comment with a suggestion to fix this. Once that's addressed, this PR will be in great shape.

Comment on lines +28 to +30
COPTS = COPTS_TESTS + select({
"//conditions:default": ["-Wshadow"],
})
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.

high

While it's correct to add -Wshadow back to COPTS for regular library and binary builds, the ray_cc_test function (defined on line 146) also uses COPTS. This means tests will still be compiled with -Wshadow, which contradicts the goal of this PR.

Please consider changing ray_cc_test to use COPTS_TESTS to disable the warning for tests.

@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Aug 28, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
@dayshah dayshah enabled auto-merge (squash) August 28, 2025 04:09
@dayshah dayshah merged commit bfa342f into ray-project:master Aug 28, 2025
6 checks passed
@dayshah dayshah deleted the no-wshadow-tests branch August 28, 2025 06:05
tohtana pushed a commit to tohtana/ray that referenced this pull request Aug 29, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
tohtana pushed a commit to tohtana/ray that referenced this pull request Aug 29, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>
gangsf pushed a commit to gangsf/ray that referenced this pull request Sep 2, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Gang Zhao <gang@gang-JQ62HD2C37.local>
sampan-s-nayak pushed a commit to sampan-s-nayak/ray that referenced this pull request Sep 8, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: sampan <sampan@anyscale.com>
jugalshah291 pushed a commit to jugalshah291/ray_fork that referenced this pull request Sep 11, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: jugalshah291 <shah.jugal291@gmail.com>
wyhong3103 pushed a commit to wyhong3103/ray that referenced this pull request Sep 12, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: yenhong.wong <yenhong.wong@grabtaxi.com>
dstrodtman pushed a commit that referenced this pull request Oct 6, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants