boostorg / boostorg/graph

State of warnings in CI `develop`

Open
#496 3 comments 0 reactions 1 assignee Claimed by @Becheler View on GitHub
priority: high warning
Dominant language
C++
Stars
392
Forks
239
Avg merge
1d 11m
Merged PRs (30d)
20

Description

# Compiler warnings (global, full CI matrix)

Source: CI run 26759013540 on `develop` (push, sha `6efc6b60`, 2026-06-01). All 24 jobs succeeded; the counts below are warnings, not errors.

## Per-job warning counts

| Job | Warnings |
|-----|----------|
| windows_msvc_14_3 (msvc-14.3) | 1226 |
| macos (clang, 14) | 88 |
| macos (clang, 17) | 83 |
| macos (clang, 20) | 83 |
| ubuntu (clang-19, 14/17/20/23) | 76 each |
| ubuntu (gcc-14, 14/17/20/23) | 52 each |
| all `*-cmake-install` / `*-cmake-subdir` jobs | 0 |

The cmake jobs build only the library, so they surface nothing. All warnings come from the b2 toolset jobs that also build tests and examples. Counts are stable across language-standard variants (14/17/20/23), so the standard level does not change the warning set.

## Correctness-relevant (fix or investigate, do not just silence)

| File:line | Warning | Compilers |
|-----------|---------|-----------|
| detail/adjacency_list.hpp:2276 | variable `p` used uninitialized / passed as uninitialized const reference | clang (`-Wuninitialized-const-reference`) **and** gcc (`-Wmaybe-uninitialized`) |
| test/r_c_shortest_paths_test.cpp:160, :264 | possibly dangling reference to a temporary | gcc (`-Wdangling-reference`) |
| example/r_c_shortest_paths_example.cpp:158 | possibly dangling reference to a temporary | gcc (`-Wdangling-reference`) |
| pending/detail/disjoint_sets.hpp:58, :59 | signed/unsigned comparison | gcc (`-Wsign-compare`) |

`adjacency_list.hpp:2276` is the strongest signal: two independent compilers agree `p` may be read before initialization.

## Cosmetic clang/gcc warnings (dead code / deprecation)

Library headers:

| File:line | Warning | Flag |
|-----------|---------|------|
| howard_cycle_ratio.hpp:360 | lambda capture `this` not used | `-Wunused-lambda-capture` |
| r_c_shortest_paths.hpp:200 | unused typedef `LTraits` | `-Wunused-local-typedef(s)` |
| louvain_clustering.hpp:58, :226, :529 | unused type aliases | `-Wunused-local-typedef(s)` |
| louvain_clustering.hpp:243, :403, :558 | `pass_number` / `iteration` set but not used | `-Wunused-but-set-variable` |

Tests:

| File:line | Warning | Flag |
|-----------|---------|------|
| test/graph.cpp:159, test/property_iter.cpp:63, test/csr_graph_test.cpp:328 | variable set but not used | `-Wunused-but-set-variable` |
| test/isomorphism.cpp:89, :308, test/vf2_sub_graph_iso_test.cpp:80 | `std::random_shuffle` deprecated, use `std::shuffle` | `-Wdeprecated-declarations` |
| test/min_degree_empty.cpp:40 | signed/unsigned comparison | `-Wsign-compare` |

Examples:

| File:line | Warning | Flag |
|-----------|---------|------|
| example/graph-assoc-types.cpp:16-20, example/quick-tour.cpp:34 | unused type aliases | `-Wunused-local-typedef(s)` |
| example/minimum_degree_ordering.cpp:45, example/two_graphs_common_spanning_trees.cpp:57 | unused variable | `-Wunused-variable` |
| example/fibonacci_heap.cpp:44 | signed/unsigned comparison | `-Wsign-compare` |
| example/fibonacci_heap.cpp:47 | `std::random_shuffle` deprecated | `-Wdeprecated-declarations` |

### clang/gcc flag totals (raw occurrences across all unix jobs)

| Flag | Count |
|------|-------|
| `-Wunused-but-set-variable` | 259 |
| `-Wunused-local-typedef(s)` | 126 + 108 |
| `-Wunused-lambda-capture` | 77 |
| `-Wdeprecated-declarations` | 45 |
| `-Wsign-compare` | 24 |
| `-Wunused-variable` | 22 |
| `-Wmaybe-uninitialized` | 20 |
| `-Wuninitialized-const-reference` | 14 |
| `-Wdangling-reference` | 12 |

## MSVC (msvc-14.3): 1226 warnings, 162 distinct sites

Dominated by numeric conversion warnings that the gcc/clang matrix mostly does not emit:

| Code | Meaning | Count |
|------|---------|-------|
| C4267 | conversion from `size_t`, possible loss of data | 836 |
| C4305 | truncation (e.g. `double` to `float`) | 198 |
| C4244 | conversion, possible loss of data | 162 |
| C4101 | unreferenced local variable | 15 |
| C4996 | `sscanf` etc. deemed unsafe (CRT) | 9 |
| C4146 | unary minus on unsigned type | 6 |

Top files by MSVC warning count:

| File | Count |
|------|-------|
| property_map.hpp | 150 |
| random.hpp | 132 |
| minimum_degree_ordering.hpp | 120 |
| king_ordering.hpp | 72 |
| isomorphism.hpp | 45 |
| bandwidth.hpp | 36 |
| disjoint_sets.hpp | 30 |
| (plus astar/quick_tour/bellman-ford examples via C4305) | many |

These are long-standing `size_t` to `int` / float-truncation issues in core headers. They are mostly benign on LP64 but real on MSVC's data model, and are the bulk of the project's total warning volume.

## Takeaways

- Almost all of the gcc/clang noise is dead-code lint, cheap to clear.
- Three correctness-class items deserve real review: the uninitialized `p` in `adjacency_list.hpp`, the dangling references in `r_c_shortest_paths`, and the signed/unsigned comparisons in `disjoint_sets.hpp`.
- MSVC conversion warnings are by far the largest group and a separate, larger cleanup effort focused on `property_map.hpp`, `random.hpp`, and the ordering headers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.