From 690bc950f70c61075d396671e63480bbd64bb297 Mon Sep 17 00:00:00 2001 From: Jan Prach Date: Wed, 20 Jan 2016 19:35:59 -0800 Subject: [PATCH] fix clang warnings "braces around scalar initializer" --- unsupported/Eigen/CXX11/src/Core/util/CXX11Meta.h | 4 ++-- unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 12 ++++++------ .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 2 +- unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h | 8 ++++---- unsupported/Eigen/CXX11/src/Tensor/TensorMap.h | 8 ++++---- .../Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h | 4 ++-- .../Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h | 2 +- unsupported/test/cxx11_tensor_broadcasting.cpp | 6 +++--- unsupported/test/cxx11_tensor_contraction.cpp | 2 +- unsupported/test/cxx11_tensor_map.cpp | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/unsupported/Eigen/CXX11/src/Core/util/CXX11Meta.h b/unsupported/Eigen/CXX11/src/Core/util/CXX11Meta.h index 4d99f786c..c1c57041f 100644 --- a/unsupported/Eigen/CXX11/src/Core/util/CXX11Meta.h +++ b/unsupported/Eigen/CXX11/src/Core/util/CXX11Meta.h @@ -404,7 +404,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const std::vector& a) { template constexpr inline array h_array_zip(array a, array b, numeric_list) { - return array{{ Op::run(array_get(a), array_get(b))... }}; + return array{ Op::run(array_get(a), array_get(b))... }; } template @@ -432,7 +432,7 @@ constexpr inline auto array_zip_and_reduce(array a, array b) -> decl template constexpr inline array h_array_apply(array a, numeric_list) { - return array{{ Op::run(array_get(a))... }}; + return array{ Op::run(array_get(a))... }; } template diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index dc6ca4909..092e30c1f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -119,7 +119,7 @@ class Tensor : public TensorBase{{firstIndex, secondIndex, otherIndices...}}); + return coeff(array{firstIndex, secondIndex, otherIndices...}); } #endif @@ -159,7 +159,7 @@ class Tensor : public TensorBase{{firstIndex, secondIndex, otherIndices...}}); + return coeffRef(array{firstIndex, secondIndex, otherIndices...}); } #endif @@ -199,7 +199,7 @@ class Tensor : public TensorBaseoperator()(array{{firstIndex, secondIndex, otherIndices...}}); + return this->operator()(array{firstIndex, secondIndex, otherIndices...}); } #else EIGEN_DEVICE_FUNC @@ -266,7 +266,7 @@ class Tensor : public TensorBase{{firstIndex, secondIndex, otherIndices...}}); + return operator()(array{firstIndex, secondIndex, otherIndices...}); } #else EIGEN_DEVICE_FUNC @@ -342,7 +342,7 @@ class Tensor : public TensorBase EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor(Index firstDimension, IndexTypes... otherDimensions) - : m_storage(internal::array_prod(array{{firstDimension, otherDimensions...}}), array{{firstDimension, otherDimensions...}}) + : m_storage(internal::array_prod(array{firstDimension, otherDimensions...}), array{firstDimension, otherDimensions...}) { // The number of dimensions used to construct a tensor must be equal to the rank of the tensor. EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE) @@ -427,7 +427,7 @@ class Tensor : public TensorBase{{firstDimension, otherDimensions...}}); + resize(array{firstDimension, otherDimensions...}); } #endif diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h index 52569a359..06cac3570 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h @@ -289,7 +289,7 @@ struct DSizes : array { template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit DSizes(DenseIndex firstDimension, IndexTypes... otherDimensions) { EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumDims, YOU_MADE_A_PROGRAMMING_MISTAKE) - (*this) = array{{firstDimension, otherDimensions...}}; + (*this) = array{firstDimension, otherDimensions...}; } #else EIGEN_DEVICE_FUNC explicit DSizes(const DenseIndex i0) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h index 70282dd83..7d0858d02 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h @@ -73,7 +73,7 @@ class TensorFixedSize : public TensorBase{{firstIndex, otherIndices...}}); + return coeff(array{firstIndex, otherIndices...}); } #endif @@ -105,7 +105,7 @@ class TensorFixedSize : public TensorBase{{firstIndex, otherIndices...}}); + return coeffRef(array{firstIndex, otherIndices...}); } #endif @@ -137,7 +137,7 @@ class TensorFixedSize : public TensorBaseoperator()(array{{firstIndex, otherIndices...}}); + return this->operator()(array{firstIndex, otherIndices...}); } #endif @@ -176,7 +176,7 @@ class TensorFixedSize : public TensorBase{{firstIndex, otherIndices...}}); + return operator()(array{firstIndex, otherIndices...}); } #endif diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h index 6f69da34a..7233f4c89 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h @@ -141,10 +141,10 @@ template class TensorMap : public Tensor { EIGEN_STATIC_ASSERT(sizeof...(otherIndices) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE) if (PlainObjectType::Options&RowMajor) { - const Index index = m_dimensions.IndexOfRowMajor(array{{firstIndex, otherIndices...}}); + const Index index = m_dimensions.IndexOfRowMajor(array{firstIndex, otherIndices...}); return m_data[index]; } else { - const Index index = m_dimensions.IndexOfColMajor(array{{firstIndex, otherIndices...}}); + const Index index = m_dimensions.IndexOfColMajor(array{firstIndex, otherIndices...}); return m_data[index]; } } @@ -228,10 +228,10 @@ template class TensorMap : public Tensor static_assert(sizeof...(otherIndices) + 1 == NumIndices || NumIndices == Dynamic, "Number of indices used to access a tensor coefficient must be equal to the rank of the tensor."); const std::size_t NumDims = sizeof...(otherIndices) + 1; if (PlainObjectType::Options&RowMajor) { - const Index index = m_dimensions.IndexOfRowMajor(array{{firstIndex, otherIndices...}}); + const Index index = m_dimensions.IndexOfRowMajor(array{firstIndex, otherIndices...}); return m_data[index]; } else { - const Index index = m_dimensions.IndexOfColMajor(array{{firstIndex, otherIndices...}}); + const Index index = m_dimensions.IndexOfColMajor(array{firstIndex, otherIndices...}); return m_data[index]; } } diff --git a/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h b/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h index bc4f2025f..1b9fe2779 100644 --- a/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h +++ b/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h @@ -55,7 +55,7 @@ class DynamicSGroup inline internal::tensor_symmetry_value_setter operator()(Tensor_& tensor, typename Tensor_::Index firstIndex, IndexTypes... otherIndices) const { static_assert(sizeof...(otherIndices) + 1 == Tensor_::NumIndices, "Number of indices used to access a tensor coefficient must be equal to the rank of the tensor."); - return operator()(tensor, std::array{{firstIndex, otherIndices...}}); + return operator()(tensor, std::array{firstIndex, otherIndices...}); } template @@ -90,7 +90,7 @@ class DynamicSGroup template inline std::array h_permute(std::size_t which, const std::array& idx, internal::numeric_list) const { - return std::array{{ idx[n >= m_numIndices ? n : m_elements[which].representation[n]]... }}; + return std::array{ idx[n >= m_numIndices ? n : m_elements[which].representation[n]]... }; } template diff --git a/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h b/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h index 942293bd7..255c344b4 100644 --- a/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h +++ b/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h @@ -217,7 +217,7 @@ class StaticSGroup inline internal::tensor_symmetry_value_setter> operator()(Tensor_& tensor, typename Tensor_::Index firstIndex, IndexTypes... otherIndices) const { static_assert(sizeof...(otherIndices) + 1 == Tensor_::NumIndices, "Number of indices used to access a tensor coefficient must be equal to the rank of the tensor."); - return operator()(tensor, std::array{{firstIndex, otherIndices...}}); + return operator()(tensor, std::array{firstIndex, otherIndices...}); } template diff --git a/unsupported/test/cxx11_tensor_broadcasting.cpp b/unsupported/test/cxx11_tensor_broadcasting.cpp index 2ddf47234..6fdefd66c 100644 --- a/unsupported/test/cxx11_tensor_broadcasting.cpp +++ b/unsupported/test/cxx11_tensor_broadcasting.cpp @@ -167,13 +167,13 @@ static void test_fixed_size_broadcasting() TensorFixedSize, DataLayout> t2; t2 = t2.constant(20.0f); - Tensor t3 = t1 + t2.broadcast(Eigen::array{{10}}); + Tensor t3 = t1 + t2.broadcast(Eigen::array{10}); for (int i = 0; i < 10; ++i) { VERIFY_IS_APPROX(t3(i), t1(i) + t2(0)); } - TensorMap, DataLayout> > t4(t2.data(), {{1}}); - Tensor t5 = t1 + t4.broadcast(Eigen::array{{10}}); + TensorMap, DataLayout> > t4(t2.data(), {1}); + Tensor t5 = t1 + t4.broadcast(Eigen::array{10}); for (int i = 0; i < 10; ++i) { VERIFY_IS_APPROX(t5(i), t1(i) + t2(0)); } diff --git a/unsupported/test/cxx11_tensor_contraction.cpp b/unsupported/test/cxx11_tensor_contraction.cpp index b0d52c6cf..c5f3af73e 100644 --- a/unsupported/test/cxx11_tensor_contraction.cpp +++ b/unsupported/test/cxx11_tensor_contraction.cpp @@ -456,7 +456,7 @@ static void test_tensor_product() mat1.setRandom(); mat2.setRandom(); - Tensor result = mat1.contract(mat2, Eigen::array{{}}); + Tensor result = mat1.contract(mat2, Eigen::array{}); VERIFY_IS_EQUAL(result.dimension(0), 2); VERIFY_IS_EQUAL(result.dimension(1), 3); diff --git a/unsupported/test/cxx11_tensor_map.cpp b/unsupported/test/cxx11_tensor_map.cpp index a8a095e38..dc0f8a5a2 100644 --- a/unsupported/test/cxx11_tensor_map.cpp +++ b/unsupported/test/cxx11_tensor_map.cpp @@ -130,7 +130,7 @@ static void test_3d() } TensorMap> mat3(mat1.data(), 2, 3, 7); - TensorMap> mat4(mat2.data(), array{{2, 3, 7}}); + TensorMap> mat4(mat2.data(), array{2, 3, 7}); VERIFY_IS_EQUAL(mat3.rank(), 3); VERIFY_IS_EQUAL(mat3.size(), 2*3*7);