Skip to content

fix: remove dead test variables#511

Open
Becheler wants to merge 1 commit into
boostorg:developfrom
Becheler:fix/unused-but-set-variable
Open

fix: remove dead test variables#511
Becheler wants to merge 1 commit into
boostorg:developfrom
Becheler:fix/unused-but-set-variable

Conversation

@Becheler

@Becheler Becheler commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Refs #496

Before submitting

  • This PR targets the develop branch.
  • I searched for an existing PR or issue covering the same change.
  • My contribution is licensed under the Boost Software License 1.0.

Type of change

  • Bug fix
  • New feature or API addition
  • Refactor (no behavior change)
  • Documentation
  • Build, CI, or tooling
  • Other (specify below)

Does this PR introduce a breaking change?

  • Yes (describe migration impact below)
  • No

What this PR does

Remove dead -Wunused-but-set-variable test variables

Clears ~19 clang -Wunused-but-set-variable warnings per CI job. All changes are
test-only with no behavioral effect: each removed variable was written but never read.

  • test/graph.cpp (E): An edge counter (++E on add, --E on remove) introduced with the original graph test file (Jeremy Siek, 2000) that was never read in the entire history of the file. The actual edge-count invariant is already verified via count_edges(g), so E was redundant scaffolding from day one. Removed the declaration and its three writes.

  • test/property_iter.cpp (E): The same write-only edge-counter idiom, never read. This test exercises property iterators, so the counter was never relevant. Removed the declaration and its single increment.

  • test/csr_graph_test.cpp (edge_count block): Originally (Douglas Gregor, 2005) this counted a vertex's out-edges to verify the CSR edge() and edge_range() functions. Those functions were deliberately removed in 2009 (Jeremiah Willcock) as unsupportable under the CSR model, along with the assertions that used the count, but the counting loop was left behind. Removed the whole orphaned block (also clearing a latent unused oei2_end and avoiding cascading -Wunused-variable/-Wempty-body warnings that deleting only the variable would cause).

These can't be repurposed into assertions: the E counters have no readable invariant (the real edge-count check already lives in count_edges(g), and num_edges == E would be wrong for multigraph configs), and edge_count only ever backed assertions that were deliberately removed in 2009 with the edge()/edge_range() functions.

Motivation

See #496

Testing

Checklist

  • Existing tests pass (b2 in the test/ directory).
  • New behavior is covered by a test, or this is a docs / build / refactor change.
  • Documentation was updated if user-facing behavior changed.
  • No new compiler warnings on the platforms I built against.

@Becheler Becheler self-assigned this Jun 22, 2026
@Becheler Becheler requested a review from jeremy-murphy as a code owner June 22, 2026 11:05
@github-actions

Copy link
Copy Markdown

Compiler-warning counts vs develop (auto-generated).
PR run 27948199982 vs develop run 27866501982 (505d1ca260).

Job Baseline After Delta
macos (clang, 14) 46 27 -19
macos (clang, 17) 41 22 -19
macos (clang, 20) 41 22 -19
ubuntu (clang-19, 14) 46 27 -19
ubuntu (clang-19, 17) 46 27 -19
ubuntu (clang-19, 20) 46 27 -19
ubuntu (clang-19, 23) 46 27 -19
ubuntu (gcc-14, 14) 28 28 0
ubuntu (gcc-14, 17) 28 28 0
ubuntu (gcc-14, 20) 28 28 0
ubuntu (gcc-14, 23) 28 28 0
windows_msvc_14_3 (msvc-14.3) 974 974 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant