summaryrefslogtreecommitdiff
path: root/external/mdds/remove-warnings.diff
blob: b98ddb9eef79bf5ff72864410a35a06dbf52692a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff --git a/configure.ac b/configure.ac
index ef22726..00ab937 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,7 @@ AC_ARG_ENABLE(openmp,
 )
 
 AS_IF([test x"$enable_openmp" == "xyes"], [
-  CXXFLAGS="$CXXFLAGS -fopenmp"
+  CXXFLAGS="$CXXFLAGS -fopenmp -DMDDS_USE_OPENMP=1"
   LDFLAGS="$LDFLAGS -fopenmp"
 ])
 
diff --git a/include/mdds/global.hpp b/include/mdds/global.hpp
index f92f0a5..11f0325 100644
--- a/include/mdds/global.hpp
+++ b/include/mdds/global.hpp
@@ -65,6 +65,10 @@
 #define MDDS_LOOP_UNROLLING 1
 #endif
 
+#ifndef MDDS_USE_OPENMP
+#define MDDS_USE_OPENMP 0
+#endif
+
 namespace mdds {
 
 class general_error : public ::std::exception
diff --git a/include/mdds/multi_type_vector.hpp b/include/mdds/multi_type_vector.hpp
index 1c50a42..d941ee2 100644
--- a/include/mdds/multi_type_vector.hpp
+++ b/include/mdds/multi_type_vector.hpp
@@ -1126,8 +1126,7 @@ private:
     void append_cell_to_block(size_type block_index, const _T& cell);
 
     template<typename _T>
-    iterator set_cell_to_empty_block(
-        size_type start_row, size_type block_index, size_type pos_in_block, const _T& cell);
+    iterator set_cell_to_empty_block(size_type block_index, size_type pos_in_block, const _T& cell);
 
     template<typename _T>
     iterator set_cell_to_block_of_size_one(
diff --git a/include/mdds/multi_type_vector_def.inl b/include/mdds/multi_type_vector_def.inl
index a4cfe6d..d4fff49 100644
--- a/include/mdds/multi_type_vector_def.inl
+++ b/include/mdds/multi_type_vector_def.inl
@@ -516,7 +516,9 @@ void multi_type_vector<_CellBlockFunc, _EventFunc>::adjust_block_positions(int64
     int64_t rem = len % 8;
     len -= rem;
     len += start_block_index;
+#if MDDS_USE_OPENMP
     #pragma omp parallel for
+#endif
     for (int64_t i = start_block_index; i < len; i += 8)
     {
         m_blocks[i].m_position += delta;
@@ -533,7 +535,9 @@ void multi_type_vector<_CellBlockFunc, _EventFunc>::adjust_block_positions(int64
     for (int64_t i = len; i < rem; ++i)
         m_blocks[i].m_position += delta;
 #else
+#if MDDS_USE_OPENMP
     #pragma omp parallel for
+#endif
     for (int64_t i = start_block_index; i < n; ++i)
         m_blocks[i].m_position += delta;
 #endif
@@ -583,7 +587,7 @@ multi_type_vector<_CellBlockFunc, _EventFunc>::set_impl(size_type pos, size_type
     if (!blk->mp_data)
     {
         // This is an empty block.
-        return set_cell_to_empty_block(start_row, block_index, pos_in_block, value);
+        return set_cell_to_empty_block(block_index, pos_in_block, value);
     }
 
     assert(blk->mp_data);
@@ -1027,7 +1031,7 @@ template<typename _CellBlockFunc, typename _EventFunc>
 template<typename _T>
 typename multi_type_vector<_CellBlockFunc, _EventFunc>::iterator
 multi_type_vector<_CellBlockFunc, _EventFunc>::set_cell_to_empty_block(
-    size_type start_row, size_type block_index, size_type pos_in_block, const _T& cell)
+    size_type block_index, size_type pos_in_block, const _T& cell)
 {
     block* blk = &m_blocks[block_index];
     assert(!blk->mp_data); // In this call, the current block is an empty block.