Skip to content

Commit

Permalink
minor fixes reduce warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-urban committed Jul 5, 2024
1 parent 5a6ecfa commit e5b5048
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 12 deletions.
10 changes: 9 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project(
license: 'MPL-2.0',

version: '0.24.2',
default_options: ['warning_level=1', 'buildtype=release', 'cpp_std=c++20'],
default_options: ['warning_level=2', 'buildtype=release', 'cpp_std=c++20'],
meson_version: '>=1.3.2' #first version with clang-cl openmp support,
)

Expand All @@ -29,6 +29,14 @@ endif
tools_compile_args = ['-D_USE_MATH_DEFINES', '-fPIC']


if meson.get_compiler('cpp').get_id() == 'clang' or meson.get_compiler('cpp').get_id() == 'gcc'
# TODO: find a way to include these warnings again
# these are generated in xtensor and I don't know how to deal with them ...
tools_compile_args += '-Wno-array-bounds'
tools_compile_args += '-Wno-maybe-uninitialized'
tools_compile_args += '-Wno-stringop-overflow'
endif

# # boost
boost_version = '>=1.73'
boost_modules = dependency(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: ff0a645e6b17cda8f06c412340fbcd7e24cb7d2833f0de66c017d5d311985ac2
//sourcehash: c8f61022b9a099f0db955db9fcbf9fb15f6391b47c566a52597b4227e797c900

/*
This file contains docstrings for use in the Python bindings.
Expand Down
6 changes: 4 additions & 2 deletions src/themachinethatgoesping/tools/hashhelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include ".docstrings/hashhelper.doc.hpp"

#include <xxhash.hpp>
#include "helper/xtensor.hpp"

/**
* @brief boost hash specializations for some types
Expand All @@ -19,15 +20,16 @@
*
*/
namespace xt {

/**
* @brief Boost hash function for xt tensors
*
* @tparam T
* @param b
* @return std::size_t
*/
template<typename T, size_t d>
std::size_t hash_value(const xt::xtensor<T, d>& array)
template<themachinethatgoesping::tools::helper::XContainerConcept T>
std::size_t hash_value(const T& array)
{
return xxh::xxhash3<64>(array.data(), array.size() * sizeof(T));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//sourcehash: f846bcaf4a095bae3a7af48998653e36c522d4b2376064d57db25535bb0c2d44

/*
This file contains docstrings for use in the Python bindings.
Do not edit! They were automatically extracted by pybind11_mkdoc.
This is a modified version which allows for more than 8 arguments and includes def-guard
*/

#pragma once

#ifndef __DOCSTRINGS_HPP__

#define __EXPAND(x) x
#define __COUNT(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, COUNT, ...) COUNT
#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1))
#define __CAT1(a, b) a##b
#define __CAT2(a, b) __CAT1(a, b)
#define __DOC1(n1) __doc_##n1
#define __DOC2(n1, n2) __doc_##n1##_##n2
#define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3
#define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4
#define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5
#define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6
#define __DOC7(n1, n2, n3, n4, n5, n6, n7) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7
#define __DOC8(n1, n2, n3, n4, n5, n6, n7, n8) \
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8
#define __DOC9(n1, n2, n3, n4, n5, n6, n7, n8, n9) \
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8##_##n9
#define __DOC10(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10) \
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8##_##n9##_##n10
#define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__))

#endif // NEW_DOC_HEADER_HPP
#if defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif


#if defined(__GNUG__)
#pragma GCC diagnostic pop
#endif


17 changes: 17 additions & 0 deletions src/themachinethatgoesping/tools/helper/xtensor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

// SPDX-FileCopyrightText: 2023 Peter Urban, Ghent University
//
// SPDX-License-Identifier: MPL-2.0

#include <xtensor/xcontainer.hpp>

namespace themachinethatgoesping {
namespace tools {
namespace helper {

// define a xcontainer concept that works for both xtensor and pytensor
template <typename T>
concept XContainerConcept = std::is_base_of<xt::xcontainer<T>, T>::value;
}
}
}
1 change: 1 addition & 0 deletions src/themachinethatgoesping/tools/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ headers = [
'helper/enum.hpp',
'helper/isviewstream.hpp',
'helper/omp_helper.hpp',
'helper/xtensor.hpp',
'helper/.docstrings/defaultmap.doc.hpp',
'helper/.docstrings/defaultsharedpointermap.doc.hpp',
'helper/.docstrings/enum.doc.hpp',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: 0752dae92ed263d2feb4c48e2e4c57c1a7fd467f54c427cd77a1ab05986470dd
//sourcehash: 12b75430c31f5f8201205f6df7a536126122af73b78661006d38d967ee650dd7

/*
This file contains docstrings for use in the Python bindings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: 8021d63d9fadfdc593e81c23601eee9860f3d31130419fdf17145a5fe2676951
//sourcehash: f9c19fe29b61a1c3d245cf4d6968a730427e48d6dba9616643d025df1348ef54

/*
This file contains docstrings for use in the Python bindings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: b197b5e4dfdc934f168dee4f4551b91dea06e427cdff66627ce5f6a16989eecb
//sourcehash: 42e8d3059f4a08c413f463e970679377e81bf9d80dcd1d13ef4ee26bc0c79224

/*
This file contains docstrings for use in the Python bindings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//sourcehash: 806981daac7f82395a86aea9b4f1046d975b547a87e304614341e98c9bb51436
//sourcehash: 226209818f7900941a258d9145de12e13bb728d83808f985b3a6204fd85216f3

/*
This file contains docstrings for use in the Python bindings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class AkimaInterpolator : public I_Interpolator<XYType, XYType>
container_to_stream(os, this->_Y);
}

classhelper::ObjectPrinter __printer__(unsigned int float_precision) const
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const override
{
classhelper::ObjectPrinter printer(this->class_name(), float_precision);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class LinearInterpolator : public I_PairInterpolator<XType, YType>
}

public:
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const override
{
classhelper::ObjectPrinter printer(this->class_name(), float_precision);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class NearestInterpolator : public I_PairInterpolator<XType, YType>
}

public:
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const override
{
classhelper::ObjectPrinter printer(this->class_name(), float_precision);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class SlerpInterpolator : public I_PairInterpolator<XType, Eigen::Quaternion<YTy
}

public:
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const
classhelper::ObjectPrinter __printer__(unsigned int float_precision) const override
{
classhelper::ObjectPrinter printer(this->class_name(), float_precision);

Expand Down

0 comments on commit e5b5048

Please sign in to comment.