Skip to content

Commit

Permalink
Work on unbreaking the build.
Browse files Browse the repository at this point in the history
- Change infinite() in hard_card to isinfinite() to placate MSVC.
- Tell g++ to ignore another Schulze STV code error.
- Remove unused variable.
- Fix ext/ include that's no longer nonstandard.
  • Loading branch information
kristomu committed Aug 24, 2024
1 parent 45e1b1f commit 85abc67
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ else()
# warning as it falsely triggers on SpookyHash.
# -flto may lead to further speedups, but linking with it enabled is way
# too slow, so it's been omitted here.
set(CMAKE_CXX_FLAGS "-O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror -march=native -mtune=native -fno-math-errno -fno-trapping-math -fno-signed-zeros")
set(CMAKE_CXX_FLAGS "-O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror -march=native -mtune=native -fno-math-errno -fno-trapping-math -fno-signed-zeros -Wno-unknown-warning-option")
endif()

# g++: Disable the free-nonheap-object warning as it seems to be buggy.
Expand Down
4 changes: 3 additions & 1 deletion src/main/multiwinner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
#include "multiwinner/stv.h"
//#include "multiwinner/qpq.cc"

#include "hack/msvc_random.h"

#include <vector>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <ext/numeric>
#include <numeric>
#include <set>
#include <assert.h>

Expand Down
6 changes: 3 additions & 3 deletions src/multiwinner/hard_card.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ double hardcard::birational(const std::vector<bool> & W,
double atw = this_ballot.scores[w],
ats = this_ballot.scores[s];

if (!finite(atw)) {
if (!isfinite(atw)) {
atw = 0;
}
if (!finite(ats)) {
if (!isfinite(ats)) {
ats = 0;
}

Expand Down Expand Up @@ -217,7 +217,7 @@ double hardcard::LPV(const std::vector<bool> & W, int council_size,

double logarithm = log((k + council_size)/(log_denom));

if (!finite(logarithm)) {
if (!isfinite(logarithm)) {
return logarithm;
}

Expand Down
4 changes: 2 additions & 2 deletions src/multiwinner/methods.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include <ext/numeric>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <vector>
Expand Down Expand Up @@ -234,4 +234,4 @@ std::list<int> addt_ballot_reweighting::get_council(int council_size,
}

return (council);
}
}
5 changes: 1 addition & 4 deletions src/multiwinner/qbuck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,11 @@ std::list<int> qltd_pr::get_council(int council_size, int num_candidates,
council.push_back(winner.get_candidate_num());
++num_elected;

double verify = 0;

for (lpos = reweighted_ballots.begin(); lpos !=
reweighted_ballots.end(); ++lpos)
if (is_contributing(*lpos, hopefuls, winner.
get_candidate_num(),
-winner.get_score())) {
verify += lpos->get_weight();
lpos->set_weight(lpos->get_weight() *
surplus/(quota + surplus));
}
Expand Down Expand Up @@ -301,4 +298,4 @@ std::string qltd_pr::name() const {
}

return init;
}
}
2 changes: 1 addition & 1 deletion src/multiwinner/shuntsstv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wsequence-point"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"

#pragma GCC diagnostic ignored "-Wunused-result"

const long double eps1=0.00000000000001;
const long double eps2=0.0000000001;
Expand Down

0 comments on commit 85abc67

Please sign in to comment.