From 5ac780b18dc11b36ae9cd00823744e6287a594e4 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 22 Jan 2025 11:40:34 +0000
Subject: [PATCH] TEST: std::execution not supported by clang?

---
 test/Makefile              | 18 ++++++++++--------
 test/test_voxeliterator.cc |  5 ++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 11f47d1..00f7fdf 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -4,6 +4,8 @@ include ${FSLCONFDIR}/default.mk
 PROJNAME   = test-newimage
 TESTXFILES = test-newimage
 
+all: ${TESTXFILES}
+
 LIBS = -lfsl-newimage -lfsl-miscmaths -lfsl-NewNifti \
        -lfsl-cprob -lfsl-utils -lfsl-znz -lboost_unit_test_framework -lpthread
 
@@ -28,16 +30,16 @@ ifeq ($(SYSTYPE), Darwin)
 RPATH := -Wl,-rpath,'@executable_path/..'
 endif
 
-all: ${TESTXFILES}
+USRCXXFLAGS = -I..
+
+# Need this flag to enable std::execution
+# policies in clang
+ifeq ($(SYSTYPE), Darwin)
+USRCXXFLAGS += -fexperimental-library
+endif
 
 OBJS := $(wildcard test_*.cc)
 OBJS := $(OBJS:%.cc=%.o)
 
-# We add -I.., -L.., -Wl,-rpath so that
-# in-source builds take precedence over
-# $FSLDEVDIR/$FSLDIR
-%.o: %.cc
-	$(CXX) -I.. ${CXXFLAGS} -c -o $@ $<
-
 test-newimage: ${OBJS}
-	$(CXX) -o $@ $^ -L.. ${RPATH} ${LDFLAGS}
+	$(CXX) ${CXXFLAGS} -o $@ $^ -L.. ${RPATH} ${LDFLAGS}
diff --git a/test/test_voxeliterator.cc b/test/test_voxeliterator.cc
index 38ff383..d64fdb7 100644
--- a/test/test_voxeliterator.cc
+++ b/test/test_voxeliterator.cc
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(std_for_each)
     result.push_back(vol(x, y, z) * 10);
   };
 
-  std::for_each(std::execution::seq, vol.vbegin(), vol.vend(), run_task_on_voxel);
+  std::for_each(vol.vbegin(), vol.vend(), run_task_on_voxel);
 
   int i = 0;
   for (int z = 0; z < 5; z++) {
@@ -89,8 +89,7 @@ BOOST_AUTO_TEST_CASE(std_transform)
   };
 
   std::vector<float> result(vol.nvoxels());
-  std::transform(std::execution::seq,
-                 vol.vbegin(),
+  std::transform(vol.vbegin(),
                  vol.vend(),
                  result.begin(),
                  run_task_on_voxel);
-- 
GitLab