Skip to content

Commit 7de9bc1

Browse files
authored
Fix building with llvm-20 (#507)
* Make `Globals` class assignable This class is currently intended to be assignable, but also has `const` members which technically makes it not. Compilers like e.g., clang-20 check this and would reject the previous implementation. * Bump testing dependency `madler/zlib` Due to its minimum required 2.4 CMake version it was rejected by any recent and supported CMake version. The previous implementation also redefined macros set on e.g., macos-14.7 and would not build. * Drop unused lambda captures These are reported by e.g., clang-20. * Add virtual destructors to polymorphic classes
1 parent 3b1483e commit 7de9bc1

File tree

10 files changed

+18
-10
lines changed

10 files changed

+18
-10
lines changed

include/CXXGraph/Graph/Algorithm/BestFirstSearch_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ const std::vector<Node<T>> Graph<T>::concurrency_breadth_first_search(
151151
int block_size = 1;
152152
int level = 1;
153153

154-
auto extract_tasks = [&level_tracker, &tracker_mutex, &assigned_tasks,
155-
&num_tasks, &block_size]() -> std::pair<int, int> {
154+
auto extract_tasks = [&assigned_tasks, &num_tasks,
155+
&block_size]() -> std::pair<int, int> {
156156
/*
157157
std::lock_guard<std::mutex> tracker_guard(tracker_mutex);
158158
int task_block_size = std::min(num_tasks - assigned_tasks,

include/CXXGraph/Graph/Algorithm/CycleDetection_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool Graph<T>::isCyclicDirectedGraphDFS() const {
5959
shared<const Node<T>>)>
6060
isCyclicDFSHelper;
6161
isCyclicDFSHelper =
62-
[this, &isCyclicDFSHelper](
62+
[&isCyclicDFSHelper](
6363
const std::shared_ptr<AdjacencyMatrix<T>> adjMatrix,
6464
std::unordered_map<CXXGraph::id_t, nodeStates> &states,
6565
shared<const Node<T>> node) {

include/CXXGraph/Graph/Algorithm/FordFulkerson_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ double Graph<T>::fordFulkersonMaxFlow(const Node<T> &source,
6767
nodeSet.begin(), nodeSet.end(),
6868
[&target](auto node) { return node->getUserId() == target.getUserId(); });
6969

70-
auto bfs_helper = [this, &source_node_ptr, &target_node_ptr, &parent,
70+
auto bfs_helper = [&source_node_ptr, &target_node_ptr, &parent,
7171
&weightMap]() -> bool {
7272
std::unordered_map<shared<const Node<T>>, bool, nodeHash<T>> visited;
7373
std::queue<shared<const Node<T>>> queue;

include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ SCCResult<T> Graph<T>::kosaraju() const {
8989
visited.clear();
9090

9191
std::function<void(shared<const Node<T>>, SCCResult<T>, int)> dfs_helper1 =
92-
[this, &rev, &visited, &dfs_helper1](
93-
shared<const Node<T>> source, SCCResult<T> result, int sccLabel) {
92+
[&rev, &visited, &dfs_helper1](shared<const Node<T>> source,
93+
SCCResult<T> result, int sccLabel) {
9494
// mark the vertex visited
9595
visited[source->getId()] = true;
9696
// Add the current vertex to the strongly connected

include/CXXGraph/Partitioning/PartitionState.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ namespace Partitioning {
4040
template <typename T>
4141
class PartitionState {
4242
public:
43+
virtual ~PartitionState() = default;
44+
4345
virtual shared<Record<T>> getRecord(CXXGraph::id_t x) = 0;
4446
virtual int getMachineLoad(const int m) const = 0;
4547
virtual int getMachineWeight(const int m) const = 0;

include/CXXGraph/Partitioning/PartitionStrategy.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ namespace Partitioning {
3939
template <typename T>
4040
class PartitionStrategy {
4141
public:
42+
virtual ~PartitionStrategy() = default;
43+
4244
virtual void performStep(shared<const Edge<T>> t,
4345
shared<PartitionState<T>> Sstate) = 0;
4446
};

include/CXXGraph/Partitioning/Record.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ namespace Partitioning {
2929
template <typename T>
3030
class Record {
3131
public:
32+
virtual ~Record() = default;
33+
3234
virtual const std::set<int> &getPartitions() const = 0;
3335
virtual void addPartition(const int m) = 0;
3436
virtual bool hasReplicaInPartition(const int m) const = 0;
@@ -41,4 +43,4 @@ class Record {
4143
} // namespace Partitioning
4244
} // namespace CXXGraph
4345

44-
#endif // __CXXGRAPH_PARTITIONING_RECORD_H__
46+
#endif // __CXXGRAPH_PARTITIONING_RECORD_H__

include/CXXGraph/Partitioning/Utility/Globals.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class Globals {
4141
const std::string print() const;
4242

4343
// CONSTANT
44-
const int SLEEP_LIMIT = 16; // In microseconds
45-
const int PLACES = 4;
44+
int SLEEP_LIMIT = 16; // In microseconds
45+
int PLACES = 4;
4646

4747
int numberOfPartition = 0; // number of partitions
4848
// OPTIONAL

include/CXXGraph/Utility/Runnable.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
namespace CXXGraph {
2626
class Runnable {
2727
public:
28+
virtual ~Runnable() = default;
29+
2830
virtual void run() = 0;
2931
};
3032
} // namespace CXXGraph

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if(TEST)
4545
CPMAddPackage(
4646
NAME zlib
4747
GITHUB_REPOSITORY madler/zlib
48-
VERSION 1.2.13
48+
VERSION 1.3.1
4949
OPTIONS "CMAKE_POSITION_INDEPENDENT_CODE True"
5050
)
5151

0 commit comments

Comments
 (0)