Skip to content

Commit b12f915

Browse files
authored
Merge pull request #4210 from pleroy/Clang
Fix warnings emitted by Clang
2 parents 7ea51b4 + 6838ec3 commit b12f915

9 files changed

+15
-21
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ SHARED_ARGS := \
115115
-fbracket-depth=257 \
116116
-fexceptions \
117117
-ferror-limit=1000 \
118-
-ffp-contract=off \
118+
-ffp-contract=off \
119119
-fno-omit-frame-pointer \
120120
-fno-char8_t \
121121
-Wall -Wpedantic \
122+
-Wno-c++23-extensions \
122123
-Wno-char-subscripts \
123124
-Wno-elaborated-enum-class \
124125
-Wno-gnu-anonymous-struct \

base/push_pull_callback_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ TEST(PushPullCallback, 4136) {
5252
int x;
5353
bool const more = executor->callback().Pull(x);
5454
if (!more) {
55-
auto const result = executor->get();
55+
[[maybe_unused]] auto const result = executor->get();
5656
delete executor;
5757
break;
5858
}

functions/accurate_table_generator_body.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,7 @@ absl::StatusOr<cpp_rational> StehléZimmermannSimultaneousFullSearch(
660660
// This mutex is not contended as it is only held exclusively when we have
661661
// found a solution.
662662
absl::Mutex lock;
663-
std::optional<absl::StatusOr<cpp_rational>> status_or_solution
664-
GUARDED_BY(lock);
663+
std::optional<absl::StatusOr<cpp_rational>> status_or_solution;
665664

666665
auto search_one_slice = [argument_scale,
667666
&lock,

functions/sin_cos_test.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ TEST_F(SinCosTest, AccurateTableIndex) {
119119

120120
constexpr std::int64_t table_spacing_bits = 9;
121121
constexpr double table_spacing_reciprocal = 1 << table_spacing_bits;
122-
constexpr double table_spacing = 1.0 / table_spacing_reciprocal;
123122
static const __m128d mantissa_index_bits =
124123
_mm_castsi128_pd(_mm_cvtsi64_si128(0x0000'0000'0000'01ff));
125124
std::mt19937_64 random(42);
@@ -143,7 +142,6 @@ TEST_F(SinCosTest, AccurateTableIndex) {
143142
TEST_F(SinCosTest, ReduceIndex) {
144143
static constexpr std::int64_t iterations = 100;
145144

146-
static constexpr std::int64_t π_over_2_zeroes = 18;
147145
static const __m128d sign_bit =
148146
_mm_castsi128_pd(_mm_cvtsi64_si128(0x8000'0000'0000'0000));
149147
static constexpr double mantissa_reduce_shifter =
@@ -156,7 +154,6 @@ TEST_F(SinCosTest, ReduceIndex) {
156154

157155
__m128d const n_128d = _mm_round_sd(
158156
_mm_setzero_pd(), _mm_set_sd(θ * (2 / π)), _MM_FROUND_RINT);
159-
double const n_double = _mm_cvtsd_f64(n_128d);
160157
std::int64_t const n = _mm_cvtsd_si64(n_128d);
161158

162159
double const abs_θ = std::abs(θ);

geometry/pair_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,13 @@ TEST_F(PairDeathTest, SerializationError) {
445445
serialization::Pair message;
446446
pv_.WriteToMessage(&message);
447447
EXPECT_DEATH({
448-
PP const pp = PP::ReadFromMessage(message);
448+
[[maybe_unused]] PP const pp = PP::ReadFromMessage(message);
449449
}, "has_point");
450450
EXPECT_DEATH({
451-
VP const vp = VP::ReadFromMessage(message);
451+
[[maybe_unused]] VP const vp = VP::ReadFromMessage(message);
452452
}, "has_multivector");
453453
EXPECT_DEATH({
454-
VV const vv = VV::ReadFromMessage(message);
454+
[[maybe_unused]] VV const vv = VV::ReadFromMessage(message);
455455
}, "has_multivector");
456456
}
457457

mathematica/integrator_plots.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,9 @@ class WorkErrorGraphGenerator {
465465
problem,
466466
append_state,
467467
/*tolerance_to_error_ratio=*/
468-
[time_step_index, tolerance, this](
469-
Time const& current_step_size,
470-
SecondOrderODE::State const& state,
471-
SecondOrderODE::State::Error const& error) {
468+
[tolerance](Time const& current_step_size,
469+
SecondOrderODE::State const& state,
470+
SecondOrderODE::State::Error const& error) {
472471
return tolerance / error.position_error[0].Norm();
473472
},
474473
AdaptiveStepSizeIntegrator<SecondOrderODE>::Parameters{
@@ -516,10 +515,9 @@ class WorkErrorGraphGenerator {
516515
first_order_problem,
517516
append_first_order_state,
518517
/*tolerance_to_error_ratio=*/
519-
[time_step_index, tolerance, this](
520-
Time const& current_step_size,
521-
FirstOrderODE::State const& state,
522-
FirstOrderODE::State::Error const& error) {
518+
[tolerance](Time const& current_step_size,
519+
FirstOrderODE::State const& state,
520+
FirstOrderODE::State::Error const& error) {
523521
return tolerance / std::get<0>(error).Norm();
524522
},
525523
AdaptiveStepSizeIntegrator<FirstOrderODE>::Parameters{

numerics/angle_reduction_body.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using namespace principia::quantities::_si;
1717
// A somewhat arbitrary value above which we fail argument reduction.
1818
// TODO(phl): We *really* need a proper angle reduction.
1919
double const reduction_threshold =
20-
std::numeric_limits<std::int64_t>::max() / 2.0;
20+
static_cast<double>(std::numeric_limits<std::int64_t>::max() / 2);
2121

2222
template<>
2323
inline constexpr Angle one_π<Angle> = π * Radian;

physics/ephemeris_body.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ Ephemeris<Frame>::ComputeGravitationalJerkOnMassiveBody(
581581
absl::ReaderMutexLock l(&lock_);
582582
degrees_of_freedom.reserve(bodies_.size());
583583
for (int b = 0; b < bodies_.size(); ++b) {
584-
auto const& current_body = bodies_[b];
585584
auto const& current_body_trajectory = trajectories_[b];
586585
degrees_of_freedom.push_back(
587586
current_body_trajectory->EvaluateDegreesOfFreedomLocked(t));

physics/equipotential_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class EquipotentialTest : public ::testing::Test {
107107
ComputePositionInWorld(t, reference_frame, body2);
108108
auto const body2_body1 = body1_position - body2_position;
109109

110-
auto const& binormal = plane.UnitBinormals().front();
110+
auto const binormal = plane.UnitBinormals().front();
111111
Rotation<World, World> const rot_l4(-60 * Degree, binormal);
112112
auto const body2_l4 = rot_l4(body2_body1);
113113
auto const l4 = body2_l4 + body2_position;

0 commit comments

Comments
 (0)