Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for maybe_unused parse bug in old gcc #522

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/matx/core/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ class tensor_t : public detail::tensor_impl_t<T,RANK,Desc> {
* @param shape
* Tensor shape (empty braces)
*/
__MATX_INLINE__ tensor_t([[maybe_unused]] const std::initializer_list<detail::no_size_t> shape) :
__MATX_INLINE__ tensor_t(const std::initializer_list<detail::no_size_t> /* unused */) :
// The ctor argument is unused, but matches {} for rank-0 tensors. We do
// not use [[maybe_unused]] due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 in gcc < 9.3
detail::tensor_impl_t<T, RANK, Desc>(std::array<index_t, 0>{}),
storage_{typename Storage::container{sizeof(T)}}
{
Expand Down
6 changes: 5 additions & 1 deletion include/matx/transforms/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ class matxFilter_t {
using filter_tensor = matx::tensor_t<FilterType, 1>;

public:
matxFilter_t([[maybe_unused]] OutType &o, const InType &i,
matxFilter_t(OutType &o, const InType &i,
const filter_tensor &h_rec,
const filter_tensor &h_nonrec)
: h_nonr_copy(h_nonrec)
{
MATX_NVTX_START("", matx::MATX_NVTX_LOG_INTERNAL)

// o may be unused. We use the (void) idiom rather than [[maybe_unused]] due to
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429
(void) o;

if constexpr (RANK == 1) {
MATX_ASSERT(o.Size(0) == i.Size(0), matxInvalidSize);

Expand Down
15 changes: 6 additions & 9 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,17 @@ set (test_sources
# '../test/00_io/small_csv_complex_comma_nh.csv' respectively. Therefore
# they must be copied to the correct location:
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test/00_io)
file(COPY_FILE
file(COPY
${CMAKE_SOURCE_DIR}/test/00_io/small_csv_comma_nh.csv
${CMAKE_BINARY_DIR}/test/00_io/small_csv_comma_nh.csv
ONLY_IF_DIFFERENT
DESTINATION ${CMAKE_BINARY_DIR}/test/00_io
)
file(COPY_FILE
file(COPY
${CMAKE_SOURCE_DIR}/test/00_io/small_csv_complex_comma_nh.csv
${CMAKE_BINARY_DIR}/test/00_io/small_csv_complex_comma_nh.csv
ONLY_IF_DIFFERENT
DESTINATION ${CMAKE_BINARY_DIR}/test/00_io
)
file(COPY_FILE
file(COPY
${CMAKE_SOURCE_DIR}/test/00_io/test.mat
${CMAKE_BINARY_DIR}/test/00_io/test.mat
ONLY_IF_DIFFERENT
DESTINATION ${CMAKE_BINARY_DIR}/test/00_io
)

# Find proprietary parameters
Expand Down