From 789f07309818cc1793374a3f02bf77b1b833613f Mon Sep 17 00:00:00 2001 From: Anders Kaestner Date: Fri, 6 Dec 2024 13:54:12 +0100 Subject: [PATCH 1/4] Fixed warnings in FDK. --- .../kipl/include/math/core/LinearAlgebra.hpp | 4 +- .../FDKBackProjectors/src/fdkbp_single.cpp | 99 +++++++++---------- .../FDKBackProjectors/src/genericbp.cpp | 4 +- 3 files changed, 49 insertions(+), 58 deletions(-) diff --git a/core/kipl/kipl/include/math/core/LinearAlgebra.hpp b/core/kipl/kipl/include/math/core/LinearAlgebra.hpp index 9ae0709c5..45f2f8eba 100644 --- a/core/kipl/kipl/include/math/core/LinearAlgebra.hpp +++ b/core/kipl/kipl/include/math/core/LinearAlgebra.hpp @@ -216,14 +216,14 @@ T TMatrix::Determinant() template -TMatrix Solve(TMatrix &a, TMatrix &b) +TMatrix Solve(TMatrix & /*a*/, TMatrix & /*b*/) { TMatrix x; return x; } template -void LUdecomposition(const TMatrix &a, TMatrix &L,TMatrix &U) +void LUdecomposition(const TMatrix &a, TMatrix & /*L*/,TMatrix &U) { if (a.Rows()!=a.Cols()) throw kipl::base::KiplException("LUdecomp: Matrix is not square",__FILE__, __LINE__); diff --git a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp index f5602ef97..adbe5b6fc 100644 --- a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp +++ b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp @@ -28,15 +28,15 @@ #include "fdkbp_single.h" -#ifndef DEGTORADF -static const float DEGTORADF = fPi/ 180.0f; -#endif +// #ifndef DEGTORADF +// static const float DEGTORADF = fPi/ 180.0f; +// #endif -#ifndef MARGINF -static const unsigned int MARGINF = 5; -#else -#error "MARGINF IS DEFINED" -#endif +// #ifndef MARGINF +// static const unsigned int MARGINF = 5; +// #else +// #error "MARGINF IS DEFINED" +// #endif // Matrix element m[i,j] for matrix with c columns @@ -290,11 +290,11 @@ size_t FDKbp_single::reconstruct(kipl::base::TImage &proj, float angles void FDKbp_single::project_volume_onto_image_c(kipl::base::TImage &cbi, - float *proj_matrix, size_t nProj) + float *proj_matrix, size_t /*nProj*/) { logger.debug("Started FDK back-projector"); - long int i, j, k; + // long int i, j, k; float* img = cbct_volume.GetDataPtr(); @@ -387,7 +387,7 @@ void FDKbp_single::project_volume_onto_image_c(kipl::base::TImage &cbi // } //#pragma omp parallel for - for (i=0; i &cbi // Precompute partial projections here //#pragma omp parallel for - for (i = 0; i < volume.Size(0); ++i) + for (size_t i = 0; i < volume.Size(0); ++i) { - float x = (float) (origin[0] + i * spacing[0]); + float x = static_cast (origin[0] + i * spacing[0]); xip[i*3+0] = x * (proj_matrix[0] + ic[0] * proj_matrix[8]); xip[i*3+1] = x * (proj_matrix[4] + ic[1] * proj_matrix[8]); xip[i*3+2] = x * proj_matrix[8]; } //#pragma omp parallel for - for (j = 0; j < volume.Size(1); ++j) + for (size_t j = 0; j < volume.Size(1); ++j) { - float y = (float) (origin[1] + j * spacing[1]); + float y = static_cast (origin[1] + j * spacing[1]); yip[j*3+0] = y * (proj_matrix[1] + ic[0] * proj_matrix[9]); yip[j*3+1] = y * (proj_matrix[5] + ic[1] * proj_matrix[9]); yip[j*3+2] = y * proj_matrix[9]; @@ -443,9 +443,9 @@ void FDKbp_single::project_volume_onto_image_c(kipl::base::TImage &cbi float cor_tilted; //#pragma omp parallel for - for (k = 0; k < volume.Size(2); ++k) + for (size_t k = 0; k < volume.Size(2); ++k) { - float z = (float) (origin[2] + k * spacing[2]); + float z = static_cast (origin[2] + k * spacing[2]); // not so elegant solution but it seems to work POSSIBLY ANCHE QST DA ADATTARE if (mConfig.ProjectionInfo.bCorrectTilt) @@ -468,13 +468,11 @@ void FDKbp_single::project_volume_onto_image_c(kipl::base::TImage &cbi logger.verbose("backproj loop"); #pragma omp parallel for // not sure about this firstprivate - for (k = 0; k < volume.Size(2); ++k) + for (size_t k = 0; k < volume.Size(2); ++k) { // int long p = k * volume.Size(1) * volume.Size(0); - int long j; - for (j = 0; j < volume.Size(1); ++j) + for (size_t j = 0; j < volume.Size(1); ++j) { - int long i; float acc2[3]; // static inline void vec3_add3 (float* v1, const float* v2, const float* v3) { // v1[0] = v2[0] + v3[0]; v1[1] = v2[1] + v3[1]; v1[2] = v2[2] + v3[2]; @@ -484,12 +482,12 @@ void FDKbp_single::project_volume_onto_image_c(kipl::base::TImage &cbi acc2[1] = zip[3*k+1] + yip[3*j+1]; acc2[2] = zip[3*k+2] + yip[3*j+2]; int long p=k * volume.Size(1) * volume.Size(0)+j *volume.Size(0); - for (i = mask[j].first+1; i <= mask[j].second; ++i) + for (size_t i = mask[j].first+1; i <= mask[j].second; ++i) { // for (i = 0; i < volume.Size(0); i++) { float dw; - float acc3[3]; + // float acc3[3]; // vec3_add3 (acc3, acc2, &xip[3*i]); // AK // acc3[0] = acc2[0]+xip[3*i]; @@ -524,20 +522,20 @@ void FDKbp_single::project_volume_onto_image_reference ( float *nrm ) { - int i, j, k, p; + // int i, j, k, p; float vp[4]; /* vp = voxel position */ // float* img = (float*) vol->img; // voxel data of the reconstructed volume -> è il mio volume. float *img = volume.GetDataPtr(); // do i need this? - const size_t SizeZ = volume.Size(0)>>2; - __m128 column[2048]; // not used for now.. + // const size_t SizeZ = volume.Size(0)>>2; + // __m128 column[2048]; // not used for now.. // Proj_matrix *pmat = cbi->pmat; /* projection matrix 3D -> 2D in homogenous coordinates */ - p = 0; - vp[3] = 1.0; + size_t p = 0UL; + vp[3] = 1.0f; /* Loop k (slices), j (rows), i (cols) */ @@ -560,22 +558,22 @@ void FDKbp_single::project_volume_onto_image_reference ( // the following part is not updated - for (k = 0; k < volume.Size(2); k++) + for (size_t k = 0; k < volume.Size(2); k++) { // vp[2] = (float) (vol->origin[2] + k * vol->spacing[2]); - vp[2] = (float) (origin[2] + k * spacing[2]); + vp[2] = static_cast (origin[2] + k * spacing[2]); - for (j = 0; j < volume.Size(1); j++) + for (size_t j = 0; j < volume.Size(1); j++) { - vp[1] = (float) (origin[1] + j * spacing[1]); + vp[1] = static_cast (origin[1] + j * spacing[1]); - for (i = 0; i < volume.Size(0); i++) + for (size_t i = 0; i < volume.Size(0); i++) { float ip[3]; // ip = image position float s; // s = projection of vp onto s axis - vp[0] = (float) (origin[0] + i * spacing[0]); + vp[0] = static_cast (origin[0] + i * spacing[0]); // mat43_mult_vec3 (ip, pmat->matrix, vp); // ip = matrix * vp ip[0] = proj_matrix[0]*vp[0]+proj_matrix[1]*vp[1]+proj_matrix[2]*vp[2]+proj_matrix[3]*vp[3]; @@ -611,13 +609,12 @@ void FDKbp_single::project_volume_onto_image_reference ( // Nearest neighbor interpolation of intensity value on image float FDKbp_single::get_pixel_value_b (kipl::base::TImage &cbi, float r, float c) { - int rr, cc; - - rr = (int)(r); - if ( (rr < 0) || (rr >= cbi.Size(1)) ) return 0.0; - cc = (int)(c); + if ( (r < 0.0f) || (r >= static_cast(cbi.Size(1)))) return 0.0f; + if ( (c < 0.0f) || (c >= static_cast(cbi.Size(0)))) return 0.0f; + + size_t rr = static_cast(r); + size_t cc = static_cast(c); - if (cc < 0 || cc >= cbi.Size(0)) return 0.0; return cbi[rr*cbi.Size(0) + cc]; } @@ -625,20 +622,14 @@ void FDKbp_single::project_volume_onto_image_reference ( // get_pixel_value_c seems to be no faster than get_pixel_value_b, despite having two fewer compares. float FDKbp_single::get_pixel_value_c (kipl::base::TImage &cbi, float r, float c) { - int rr, cc; - - r += 0.5; - if (r < 0) return 0.0; - if (r >= static_cast(cbi.Size(1))) - return 0.0; - - rr = static_cast(r); - - c += 0.5; - if (c < 0) return 0.0; - if (c >= static_cast(cbi.Size(0))) - return 0.0f; - cc = static_cast(c); + r += 0.5f; + if ((r < 0.0f) || (r >= static_cast(cbi.Size(1)))) return 0.0f; + + c += 0.5f; + if ((c < 0.0f) || (c >= static_cast(cbi.Size(0)))) return 0.0f; + + size_t rr = static_cast(r); + size_t cc = static_cast(c); return cbi[rr*cbi.Size(0) + cc]; } diff --git a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/genericbp.cpp b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/genericbp.cpp index d82100e52..d40531053 100644 --- a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/genericbp.cpp +++ b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/genericbp.cpp @@ -21,14 +21,14 @@ GenericBP::~GenericBP() } -size_t GenericBP::Process(kipl::base::TImage proj, float angle, float weight, bool bLastProjection) +size_t GenericBP::Process(kipl::base::TImage /*proj*/, float /*angle*/, float /*weight*/, bool /*bLastProjection*/) { // Back project single projections at angle and weighted. This is an inifite task that is terminated when bLastProjection is true. return 0; } -size_t GenericBP::Process(kipl::base::TImage proj, std::map parameters) +size_t GenericBP::Process(kipl::base::TImage /*proj*/, std::map /*parameters*/) { // Back project a set of projections stored in a volume as xy-slices // In the parameter list there will be the parameters angles and weights are provided from the framework. From e4cd618bb1a8b1e2df439f82ed4b1bdc4bfc3c38 Mon Sep 17 00:00:00 2001 From: Anders Kaestner Date: Fri, 6 Dec 2024 14:46:27 +0100 Subject: [PATCH 2/4] Fixed more warnings in fdk --- .../tst_testImagingAlgorithms.cpp | 10 +- .../tDirAnalysis/tst_tdiranalysistest.cpp | 9 +- core/kipl/UnitTests/tLogging/tst_logging.cpp | 11 +- .../tst_stlvecoperations.cpp | 9 +- .../FDKBackProjectors/src/fdkbp.cpp | 119 +++++++----------- .../FDKBackProjectors/src/fdkreconbase.cpp | 23 ++-- .../tst_FDKBackprojectors.cpp | 10 +- 7 files changed, 95 insertions(+), 96 deletions(-) diff --git a/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp b/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp index 844486c3a..97f4e1e4a 100644 --- a/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp +++ b/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp @@ -700,9 +700,11 @@ void TestImagingAlgorithms::ProjSeriesCorr_Correction() } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" -QTEST_APPLESS_MAIN(TestImagingAlgorithms) -#pragma clang diagnostic pop +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TestImagingAlgorithms) + #pragma clang diagnostic pop +#endif #include "tst_testImagingAlgorithms.moc" diff --git a/core/kipl/UnitTests/tDirAnalysis/tst_tdiranalysistest.cpp b/core/kipl/UnitTests/tDirAnalysis/tst_tdiranalysistest.cpp index a29122a10..822ef2e2f 100644 --- a/core/kipl/UnitTests/tDirAnalysis/tst_tdiranalysistest.cpp +++ b/core/kipl/UnitTests/tDirAnalysis/tst_tdiranalysistest.cpp @@ -310,6 +310,13 @@ void TDirAnalysisTest::testCountLinesInFile() QVERIFY(N==cnt); } -QTEST_APPLESS_MAIN(TDirAnalysisTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TDirAnalysisTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TDirAnalysisTest) +#endif #include "tst_tdiranalysistest.moc" diff --git a/core/kipl/UnitTests/tLogging/tst_logging.cpp b/core/kipl/UnitTests/tLogging/tst_logging.cpp index 292d988c3..f9734f568 100644 --- a/core/kipl/UnitTests/tLogging/tst_logging.cpp +++ b/core/kipl/UnitTests/tLogging/tst_logging.cpp @@ -91,6 +91,15 @@ void LoggingTests::testMultiTargetLogger() } -QTEST_APPLESS_MAIN(LoggingTests) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(LoggingTests) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(LoggingTests) +#endif + + #include "include/tst_logging.moc" diff --git a/core/kipl/UnitTests/tSTLVectorOperations/tst_stlvecoperations.cpp b/core/kipl/UnitTests/tSTLVectorOperations/tst_stlvecoperations.cpp index 154371905..ba2fdf4f2 100644 --- a/core/kipl/UnitTests/tSTLVectorOperations/tst_stlvecoperations.cpp +++ b/core/kipl/UnitTests/tSTLVectorOperations/tst_stlvecoperations.cpp @@ -66,6 +66,13 @@ void STLVecOperations::test_MAD() } -QTEST_APPLESS_MAIN(STLVecOperations) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(STLVecOperations) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(STLVecOperations) +#endif #include "include/tst_stlvecoperations.moc" diff --git a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp.cpp b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp.cpp index 19e1ff5b3..bff8173a5 100644 --- a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp.cpp +++ b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp.cpp @@ -30,15 +30,15 @@ #include "fdkbp.h" -#ifndef DEGTORAD -static const double DEGTORAD = dPi/ 180.0; -#endif +// #ifndef DEGTORAD +// static const double DEGTORAD = dPi/ 180.0; +// #endif -#ifndef MARGIN -static const unsigned int MARGIN = 5; -#else -#error "MARGIN IS DEFINED" -#endif +// #ifndef MARGIN +// static const unsigned int MARGIN = 5; +// #else +// #error "MARGIN IS DEFINED" +// #endif // Matrix element m[i,j] for matrix with c columns @@ -310,12 +310,10 @@ size_t FDKbp::reconstruct(kipl::base::TImage &proj, float angles, size_ void FDKbp::project_volume_onto_image_c(kipl::base::TImage &cbi, - double *proj_matrix, size_t nProj) + double *proj_matrix, size_t /*nProj*/) { logger(logger.LogDebug,"Started FDK back-projector"); - long int i, j, k; - float* img = cbct_volume.GetDataPtr(); double *xip, *yip, *zip; double sad_sid_2; @@ -399,30 +397,28 @@ void FDKbp::project_volume_onto_image_c(kipl::base::TImage &cbi, #pragma omp parallel for - for (i=0; i(cbi.Size(0)*cbi.Size(1)); ++i) { cbi[i] *=sad_sid_2; // Speedup trick re: Kachelsreiss cbi[i] *=scale; // User scaling } - - - xip = (double*) malloc (3*volume.Size(0)*sizeof(double)); - yip = (double*) malloc (3*volume.Size(1)*sizeof(double)); - zip = (double*) malloc (3*volume.Size(2)*sizeof(double)); + xip = static_cast(malloc(3*volume.Size(0)*sizeof(double))); + yip = static_cast(malloc(3*volume.Size(1)*sizeof(double))); + zip = static_cast(malloc(3*volume.Size(2)*sizeof(double))); // Precompute partial projections here #pragma omp parallel for - for (i = 0; i < volume.Size(0); i++) { - double x = (double) (origin[0] + i * spacing[0]); + for (ptrdiff_t i = 0; i < static_cast(volume.Size(0)); ++i) { + double x = static_cast (origin[0] + i * spacing[0]); xip[i*3+0] = x * (proj_matrix[0] + ic[0] * proj_matrix[8]); xip[i*3+1] = x * (proj_matrix[4] + ic[1] * proj_matrix[8]); xip[i*3+2] = x * proj_matrix[8]; } #pragma omp parallel for - for (j = 0; j < volume.Size(1); j++) { - double y = (double) (origin[1] + j * spacing[1]); + for (ptrdiff_t j = 0; j < static_cast(volume.Size(1)); ++j) { + double y = static_cast (origin[1] + j * spacing[1]); yip[j*3+0] = y * (proj_matrix[1] + ic[0] * proj_matrix[9]); yip[j*3+1] = y * (proj_matrix[5] + ic[1] * proj_matrix[9]); yip[j*3+2] = y * proj_matrix[9]; @@ -431,8 +427,8 @@ void FDKbp::project_volume_onto_image_c(kipl::base::TImage &cbi, double cor_tilted; #pragma omp parallel for - for (k = 0; k < volume.Size(2); k++) { - double z = (double) (origin[2] + k * spacing[2]); + for (ptrdiff_t k = 0; k < static_cast(volume.Size(2)); ++k) { + double z = static_cast (origin[2] + k * spacing[2]); // not so elegant solution but it seems to work if (mConfig.ProjectionInfo.bCorrectTilt){ @@ -453,12 +449,11 @@ void FDKbp::project_volume_onto_image_c(kipl::base::TImage &cbi, // int long p; #pragma omp parallel for - for (k = 0; k < volume.Size(2); k++) { + for (ptrdiff_t k = 0; k < static_cast(volume.Size(2)); ++k) { // p = k * volume.Size(1) * volume.Size(0); // int long p; - int long j; - for (j = 0; j < volume.Size(1); j++) { - int long i; + + for (ptrdiff_t j = 0; j < static_cast(volume.Size(1)); ++j) { double acc2[3]; // static inline void vec3_add3 (double* v1, const double* v2, const double* v3) { // v1[0] = v2[0] + v3[0]; v1[1] = v2[1] + v3[1]; v1[2] = v2[2] + v3[2]; @@ -470,7 +465,7 @@ void FDKbp::project_volume_onto_image_c(kipl::base::TImage &cbi, // int long p = k * volume.Size(1) * volume.Size(0)+j *volume.Size(0); // for (i = 0; i < volume.Size(0); i++) { int long p=k * volume.Size(1) * volume.Size(0)+j *volume.Size(0); - for (i = mask[j].first+1; i <= mask[j].second; i++) { + for (ptrdiff_t i = static_cast(mask[j].first+1); i <= static_cast(mask[j].second); ++i) { double dw; double acc3[3]; acc3[0] = acc2[0]+xip[3*i]; @@ -500,19 +495,19 @@ void FDKbp::project_volume_onto_image_reference ( double *nrm ) { - int i, j, k, p; + // int i, j, k, p; double vp[4]; /* vp = voxel position */ // float* img = (float*) vol->img; // voxel data of the reconstructed volume -> è il mio volume. float *img = volume.GetDataPtr(); // do i need this? - const size_t SizeZ = volume.Size(0)>>2; - __m128 column[2048]; // not used for now.. + // const size_t SizeZ = volume.Size(0)>>2; + // __m128 column[2048]; // not used for now.. // Proj_matrix *pmat = cbi->pmat; // projection matrix 3D -> 2D in homogenous coordinates - p = 0; + ptrdiff_t p = 0; vp[3] = 1.0; // Loop k (slices), j (rows), i (cols) @@ -535,19 +530,19 @@ void FDKbp::project_volume_onto_image_reference ( origin[2] = -(V-(mConfig.ProjectionInfo.fpPoint[1]-mConfig.ProjectionInfo.roi[1]))*spacing[2]-spacing[2]/2; - for (k = 0; k < volume.Size(2); k++) { + for (ptrdiff_t k = 0; k < static_cast(volume.Size(2)); k++) { // vp[2] = (double) (vol->origin[2] + k * vol->spacing[2]); - vp[2] = (double) (origin[2] + k * spacing[2]); + vp[2] = static_cast (origin[2] + k * spacing[2]); - for (j = 0; j < volume.Size(1); j++) { - vp[1] = (double) (origin[1] + j * spacing[1]); + for (ptrdiff_t j = 0; j < static_cast(volume.Size(1)); j++) { + vp[1] = static_cast (origin[1] + j * spacing[1]); - for (i = mask[j].first+1; i <= mask[j].second; i++) { + for (ptrdiff_t i = static_cast(mask[j].first+1); i <= static_cast(mask[j].second); ++i) { double ip[3]; // ip = image position double s; // s = projection of vp onto s axis - vp[0] = (double) (origin[0] + i * spacing[0]); + vp[0] = static_cast (origin[0] + i * spacing[0]); // mat43_mult_vec3 (ip, pmat->matrix, vp); // ip = matrix * vp ip[0] = proj_matrix[0]*vp[0]+proj_matrix[1]*vp[1]+proj_matrix[2]*vp[2]+proj_matrix[3]*vp[3]; @@ -585,14 +580,12 @@ void FDKbp::project_volume_onto_image_reference ( // Nearest neighbor interpolation of intensity value on image float FDKbp::get_pixel_value_b (kipl::base::TImage &cbi, double r, double c) { - int rr, cc; - - rr = (int)(r); -// if (rr < 0 || rr >= cbi->dim[1]) return 0.0; - if (rr < 0 || rr >= cbi.Size(1)) return 0.0; - cc = (int)(c); -// if (cc < 0 || cc >= cbi->dim[0]) return 0.0; - if (cc < 0 || cc >= cbi.Size(0)) return 0.0; + if (r < 0.0 || r >= static_cast(cbi.Size(1))) return 0.0; + if (c < 0.0 || c >= static_cast(cbi.Size(0))) return 0.0; + + ptrdiff_t rr = static_cast(r); + ptrdiff_t cc = static_cast(c); + return cbi[rr*cbi.Size(0) + cc]; } @@ -602,41 +595,15 @@ float FDKbp::get_pixel_value_c (kipl::base::TImage &cbi, double r, doub { int rr, cc; -// #if defined (commentout) -// r += 0.5; -// if (r < 0) return 0.0; -// rr = (int) r; -// if (rr >= cbi->dim[1]) return 0.0; - -// c += 0.5; -// if (c < 0) return 0.0; -// cc = (int) c; -// if (cc >= cbi->dim[0]) return 0.0; -// #endif - -// r += 0.5; -// if (r < 0) return 0.0; -// if (r >= (double) cbi->dim[1]) return 0.0; -// rr = (int) r; - -// c += 0.5; -// if (c < 0) return 0.0; -// if (c >= (double) cbi->dim[0]) return 0.0; -// cc = (int) c; - -// return cbi->img[rr*cbi->dim[0] + cc]; - r += 0.5; if (r < 0) return 0.0; - if (r >= (double) cbi.Size(1)) return 0.0; - rr = (int) r; + if (r >= static_cast(cbi.Size(1))) return 0.0; + rr = static_cast(r); c += 0.5; if (c < 0) return 0.0; - if (c >= (double) cbi.Size(0)) return 0.0; - cc = (int) c; - -// std::cout << cbi[rr*cbi.Size(0) + cc] << std::endl; + if (c >= static_cast(cbi.Size(0))) return 0.0; + cc = static_cast(c); return cbi[rr*cbi.Size(0) + cc]; diff --git a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkreconbase.cpp b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkreconbase.cpp index 4bea9e860..5d748c529 100644 --- a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkreconbase.cpp +++ b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkreconbase.cpp @@ -17,7 +17,7 @@ #include #include -FdkReconBase::FdkReconBase(std::string application, std::string name, eMatrixAlignment alignment, kipl::interactors::InteractionBase *interactor) : +FdkReconBase::FdkReconBase(std::string /*application*/, std::string name, eMatrixAlignment alignment, kipl::interactors::InteractionBase *interactor) : BackProjectorModuleBase("muhrec",name,alignment,interactor), nProjCounter(0), SizeU(0), @@ -67,7 +67,7 @@ int FdkReconBase::Initialize() return 0; } -int FdkReconBase::InitializeBuffers(int width, int height) +int FdkReconBase::InitializeBuffers(int /*width*/, int /*height*/) { return 0; } @@ -174,18 +174,18 @@ size_t FdkReconBase::Process(kipl::base::TImage proj, float angle, floa kipl::base::TImage img; proj*=weight; - size_t N=0; + // size_t N=0; if (MatrixAlignment==MatrixZXY) { kipl::base::Transpose transpose; img=transpose(proj); pProj=img.GetDataPtr(); - N=img.Size(0); + // N=img.Size(0); } else { pProj=proj.GetDataPtr(); - N=proj.Size(0); + // N=proj.Size(0); } #ifdef USE_PROJ_PADDING @@ -216,16 +216,16 @@ size_t FdkReconBase::Process(kipl::base::TImage proj, float angle, floa /// Starts the back-projection process of projections stored as a 3D volume. /// \param proj The projection data /// \param parameters A list of parameters, the list shall contain at least the parameters angles and weights each containing a space separated list with as many values as projections -size_t FdkReconBase::Process(kipl::base::TImage projections, std::map parameters) +size_t FdkReconBase::Process(kipl::base::TImage proj, std::map parameters) { logger.message("FdkReconBase::Process 3D"); if (volume.Size()==0) throw ReconException("The target matrix is not allocated.",__FILE__,__LINE__); - kipl::base::TImage img(projections.dims()); + kipl::base::TImage img(proj.dims()); - size_t nProj=projections.Size(2); + size_t nProj=proj.Size(2); // Extract the projection parameters std::vector weights; @@ -244,19 +244,18 @@ size_t FdkReconBase::Process(kipl::base::TImage projections, std::map(i)/nProj,"FDK back-projection")); ++i) + for (size_t i=0; (i(i)/nProj,"FDK back-projection")); ++i) { msg.str(""); msg<<"Reconstructing projection" << i; logger.verbose(msg.str()); - pProj=projections.GetLinePtr(0,i); + pProj=proj.GetLinePtr(0,i); std::copy_n(pProj,img.Size(),pImg); img *= weights[i]; // Process(img,angles[i],weights[i],i,i==(nProj-1)); // to ask for this->reconstruct(img, angles[i], nProj); - } // FinalizeBuffers(); @@ -393,6 +392,6 @@ float FdkReconBase::Max() return maxval; } -size_t FdkReconBase::ComputeGeometryMatrices(float *matrices){ +size_t FdkReconBase::ComputeGeometryMatrices(float */*matrices*/){ return 1; } diff --git a/frameworks/tomography/UnitTests/tFDKBackProjectors/tst_FDKBackprojectors.cpp b/frameworks/tomography/UnitTests/tFDKBackProjectors/tst_FDKBackprojectors.cpp index bdf702e65..3589e1e1f 100644 --- a/frameworks/tomography/UnitTests/tFDKBackProjectors/tst_FDKBackprojectors.cpp +++ b/frameworks/tomography/UnitTests/tFDKBackProjectors/tst_FDKBackprojectors.cpp @@ -53,6 +53,14 @@ void TFDKBackProjectors::test_ftkbp_single_Initialize() } -QTEST_APPLESS_MAIN(TFDKBackProjectors) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TFDKBackProjectors) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TFDKBackProjectors) +#endif + #include "tst_FDKBackprojectors.moc" From 7169e2165902619691ed4c0d87545465394a02f9 Mon Sep 17 00:00:00 2001 From: Anders Kaestner Date: Fri, 6 Dec 2024 15:19:47 +0100 Subject: [PATCH 3/4] Fixed a bunch of variadic macro warnings --- .../tImagingQAAlgorithms/tst_ImagingQAAlgorithms.cpp | 10 +++++++++- core/kipl/UnitTests/tFillHole/tst_fillholetest.cpp | 11 ++++++++++- .../tImageOperators/tst_timageoperatorstest.cpp | 10 +++++++++- .../UnitTests/tIndex2Coord/tst_tindex2coordtest.cpp | 9 ++++++++- core/kipl/UnitTests/tKIPLHistogram/tst_histogram.cpp | 12 +++++++++++- .../tKIPLMathFunctions/tst_MathFunctions.cpp | 10 +++++++++- core/kipl/UnitTests/tKIPLTimers/tst_timertests.cpp | 10 +++++++++- core/kipl/UnitTests/tKIPL_IO/tst_kipl_io.cpp | 10 +++++++++- .../tKIPLbaseTImage/tst_tkiplbasetimagetest.cpp | 11 ++++++++++- core/kipl/UnitTests/tKiplMath/tst_tkiplmathtest.cpp | 10 +++++++++- core/kipl/UnitTests/tLinFit/tst_tlinfittest.cpp | 10 +++++++++- core/kipl/UnitTests/tNoiseImage/tst_noiseimage.cpp | 11 ++++++++++- core/kipl/UnitTests/tThreadPool/tst_ThreadPool.cpp | 10 +++++++++- .../UnitTests/tedgefunction/tst_tedgefunction.cpp | 10 +++++++++- core/kipl/UnitTests/tkiplbasetest/tst_kiplbase.cpp | 11 ++++++++++- core/kipl/UnitTests/tkiplfilters/tst_kiplfilters.cpp | 10 +++++++++- .../UnitTests/tModuleConfig/tst_configbasetest.cpp | 10 +++++++++- .../tReaderConfig/tst_treaderconfigtest.cpp | 9 ++++++++- .../UnitTests/tBBLogNorm/tst_BBLogNorm.cpp | 10 +++++++++- .../UnitTests/tFrameWork/tst_frameworktest.cpp | 10 +++++++++- .../tReconAlgorithms/tst_algorithmtester.cpp | 11 ++++++++++- .../UnitTests/tReconConfig/tst_ReconConfig.cpp | 10 +++++++++- .../tStdBackProjectors/tst_StdBackProjectors.cpp | 10 +++++++++- 23 files changed, 212 insertions(+), 23 deletions(-) diff --git a/core/algorithms/UnitTests/tImagingQAAlgorithms/tst_ImagingQAAlgorithms.cpp b/core/algorithms/UnitTests/tImagingQAAlgorithms/tst_ImagingQAAlgorithms.cpp index d64d7c503..c98d079b8 100644 --- a/core/algorithms/UnitTests/tImagingQAAlgorithms/tst_ImagingQAAlgorithms.cpp +++ b/core/algorithms/UnitTests/tImagingQAAlgorithms/tst_ImagingQAAlgorithms.cpp @@ -229,6 +229,14 @@ void TImagingQAAlgorithmsTest::testProfileExtractor() } -QTEST_APPLESS_MAIN(TImagingQAAlgorithmsTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TImagingQAAlgorithmsTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TImagingQAAlgorithmsTest) +#endif + #include "tst_ImagingQAAlgorithms.moc" diff --git a/core/kipl/UnitTests/tFillHole/tst_fillholetest.cpp b/core/kipl/UnitTests/tFillHole/tst_fillholetest.cpp index e92bd3f1c..f7d2b4d86 100644 --- a/core/kipl/UnitTests/tFillHole/tst_fillholetest.cpp +++ b/core/kipl/UnitTests/tFillHole/tst_fillholetest.cpp @@ -21,6 +21,15 @@ void FillHoleTest::testCase1() QVERIFY2(true, "Failure"); } -QTEST_APPLESS_MAIN(FillHoleTest) + +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(FillHoleTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(FillHoleTest) +#endif + #include "tst_fillholetest.moc" diff --git a/core/kipl/UnitTests/tImageOperators/tst_timageoperatorstest.cpp b/core/kipl/UnitTests/tImageOperators/tst_timageoperatorstest.cpp index 41a53fa1f..c10b9f7bc 100644 --- a/core/kipl/UnitTests/tImageOperators/tst_timageoperatorstest.cpp +++ b/core/kipl/UnitTests/tImageOperators/tst_timageoperatorstest.cpp @@ -119,7 +119,15 @@ void TImageOperatorsTest::makeTestImage() } -QTEST_APPLESS_MAIN(TImageOperatorsTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TImageOperatorsTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TImageOperatorsTest) +#endif + #include "tst_timageoperatorstest.moc" diff --git a/core/kipl/UnitTests/tIndex2Coord/tst_tindex2coordtest.cpp b/core/kipl/UnitTests/tIndex2Coord/tst_tindex2coordtest.cpp index 89ac36eb2..eb1ea0416 100644 --- a/core/kipl/UnitTests/tIndex2Coord/tst_tindex2coordtest.cpp +++ b/core/kipl/UnitTests/tIndex2Coord/tst_tindex2coordtest.cpp @@ -181,8 +181,15 @@ void TIndex2CoordTest::testIndex2Coord3D() } +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TIndex2CoordTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TIndex2CoordTest) +#endif -QTEST_APPLESS_MAIN(TIndex2CoordTest) #include "tst_tindex2coordtest.moc" diff --git a/core/kipl/UnitTests/tKIPLHistogram/tst_histogram.cpp b/core/kipl/UnitTests/tKIPLHistogram/tst_histogram.cpp index ae3368664..e5de3c606 100644 --- a/core/kipl/UnitTests/tKIPLHistogram/tst_histogram.cpp +++ b/core/kipl/UnitTests/tKIPLHistogram/tst_histogram.cpp @@ -75,7 +75,17 @@ void HistogramTest::benchmarkOpt() } } -QTEST_APPLESS_MAIN(HistogramTest) + +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(HistogramTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(HistogramTest) +#endif + + #include "tst_histogram.moc" diff --git a/core/kipl/UnitTests/tKIPLMathFunctions/tst_MathFunctions.cpp b/core/kipl/UnitTests/tKIPLMathFunctions/tst_MathFunctions.cpp index dd12da565..e19c81997 100644 --- a/core/kipl/UnitTests/tKIPLMathFunctions/tst_MathFunctions.cpp +++ b/core/kipl/UnitTests/tKIPLMathFunctions/tst_MathFunctions.cpp @@ -253,6 +253,14 @@ void MathFunctionsTest::testFactorial() QCOMPARE(kipl::math::factorial(10), 3628800); } -QTEST_APPLESS_MAIN(MathFunctionsTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(MathFunctionsTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(MathFunctionsTest) +#endif + #include "tst_MathFunctions.moc" \ No newline at end of file diff --git a/core/kipl/UnitTests/tKIPLTimers/tst_timertests.cpp b/core/kipl/UnitTests/tKIPLTimers/tst_timertests.cpp index 5a4dff930..2bc245db7 100644 --- a/core/kipl/UnitTests/tKIPLTimers/tst_timertests.cpp +++ b/core/kipl/UnitTests/tKIPLTimers/tst_timertests.cpp @@ -117,7 +117,15 @@ void TimerTests::test_ThreadedTiming() } -QTEST_APPLESS_MAIN(TimerTests) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TimerTests) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TimerTests) +#endif + #include "tst_timertests.moc" diff --git a/core/kipl/UnitTests/tKIPL_IO/tst_kipl_io.cpp b/core/kipl/UnitTests/tKIPL_IO/tst_kipl_io.cpp index 4dc5c8280..7355d2155 100644 --- a/core/kipl/UnitTests/tKIPL_IO/tst_kipl_io.cpp +++ b/core/kipl/UnitTests/tKIPL_IO/tst_kipl_io.cpp @@ -167,6 +167,14 @@ void tKIPL_IOTest::testReadNexus() } -QTEST_APPLESS_MAIN(tKIPL_IOTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(tKIPL_IOTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(tKIPL_IOTest) +#endif + #include "tst_kipl_io.moc" diff --git a/core/kipl/UnitTests/tKIPLbaseTImage/tst_tkiplbasetimagetest.cpp b/core/kipl/UnitTests/tKIPLbaseTImage/tst_tkiplbasetimagetest.cpp index ca28417ce..0a71e18ad 100644 --- a/core/kipl/UnitTests/tKIPLbaseTImage/tst_tkiplbasetimagetest.cpp +++ b/core/kipl/UnitTests/tKIPLbaseTImage/tst_tkiplbasetimagetest.cpp @@ -343,6 +343,15 @@ void TKIPLbaseTImageTest::testDataAccess() // indexing outside buffer } -QTEST_APPLESS_MAIN(TKIPLbaseTImageTest) + +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TKIPLbaseTImageTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TKIPLbaseTImageTest) +#endif + #include "tst_tkiplbasetimagetest.moc" diff --git a/core/kipl/UnitTests/tKiplMath/tst_tkiplmathtest.cpp b/core/kipl/UnitTests/tKiplMath/tst_tkiplmathtest.cpp index 9e5616dc1..f5d3ba579 100644 --- a/core/kipl/UnitTests/tKiplMath/tst_tkiplmathtest.cpp +++ b/core/kipl/UnitTests/tKiplMath/tst_tkiplmathtest.cpp @@ -786,6 +786,14 @@ void TKiplMathTest::testFindLimits() QCOMPARE(hi,89UL); } -QTEST_APPLESS_MAIN(TKiplMathTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TKiplMathTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TKiplMathTest) +#endif + #include "tst_tkiplmathtest.moc" diff --git a/core/kipl/UnitTests/tLinFit/tst_tlinfittest.cpp b/core/kipl/UnitTests/tLinFit/tst_tlinfittest.cpp index 372135559..15b8d8058 100644 --- a/core/kipl/UnitTests/tLinFit/tst_tlinfittest.cpp +++ b/core/kipl/UnitTests/tLinFit/tst_tlinfittest.cpp @@ -102,6 +102,14 @@ void TLinFitTest::testCalls() } -QTEST_APPLESS_MAIN(TLinFitTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TLinFitTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TLinFitTest) +#endif + #include "tst_tlinfittest.moc" diff --git a/core/kipl/UnitTests/tNoiseImage/tst_noiseimage.cpp b/core/kipl/UnitTests/tNoiseImage/tst_noiseimage.cpp index 2fa07c631..ebb36c5d0 100644 --- a/core/kipl/UnitTests/tNoiseImage/tst_noiseimage.cpp +++ b/core/kipl/UnitTests/tNoiseImage/tst_noiseimage.cpp @@ -49,6 +49,15 @@ void TNoiseImageTest::testPoisson() } -QTEST_APPLESS_MAIN(TNoiseImageTest) + +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TNoiseImageTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TNoiseImageTest) +#endif + #include "tst_noiseimage.moc" diff --git a/core/kipl/UnitTests/tThreadPool/tst_ThreadPool.cpp b/core/kipl/UnitTests/tThreadPool/tst_ThreadPool.cpp index 96b545a44..e56789d26 100644 --- a/core/kipl/UnitTests/tThreadPool/tst_ThreadPool.cpp +++ b/core/kipl/UnitTests/tThreadPool/tst_ThreadPool.cpp @@ -122,6 +122,14 @@ void TestThreadPool::test_ProcessorSingle() QCOMPARE(result[i],std::floor(sqrt(data[i])*1000.0f)); } -QTEST_APPLESS_MAIN(TestThreadPool) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TestThreadPool) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TestThreadPool) +#endif + #include "tst_ThreadPool.moc" diff --git a/core/kipl/UnitTests/tedgefunction/tst_tedgefunction.cpp b/core/kipl/UnitTests/tedgefunction/tst_tedgefunction.cpp index fd8005604..a0bf0c9c8 100644 --- a/core/kipl/UnitTests/tedgefunction/tst_tedgefunction.cpp +++ b/core/kipl/UnitTests/tedgefunction/tst_tedgefunction.cpp @@ -161,6 +161,14 @@ void tedgefunction::test_case1() std::cout << "testing case 1 empty" << std::endl; } -QTEST_APPLESS_MAIN(tedgefunction) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(tedgefunction) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(tedgefunction) +#endif + #include "tst_tedgefunction.moc" diff --git a/core/kipl/UnitTests/tkiplbasetest/tst_kiplbase.cpp b/core/kipl/UnitTests/tkiplbasetest/tst_kiplbase.cpp index 4d26d5782..8193743ae 100644 --- a/core/kipl/UnitTests/tkiplbasetest/tst_kiplbase.cpp +++ b/core/kipl/UnitTests/tkiplbasetest/tst_kiplbase.cpp @@ -790,6 +790,15 @@ void Tkiplbase::testRotationDirection() } -QTEST_APPLESS_MAIN(Tkiplbase) + +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(Tkiplbase) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(Tkiplbase) +#endif + #include "tst_kiplbase.moc" diff --git a/core/kipl/UnitTests/tkiplfilters/tst_kiplfilters.cpp b/core/kipl/UnitTests/tkiplfilters/tst_kiplfilters.cpp index f51464aad..66299ab61 100644 --- a/core/kipl/UnitTests/tkiplfilters/tst_kiplfilters.cpp +++ b/core/kipl/UnitTests/tkiplfilters/tst_kiplfilters.cpp @@ -162,6 +162,14 @@ void KiplFilters::benchmark_MedianFilterParallel() } } -QTEST_APPLESS_MAIN(KiplFilters) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(KiplFilters) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(KiplFilters) +#endif + #include "tst_kiplfilters.moc" diff --git a/core/modules/UnitTests/tModuleConfig/tst_configbasetest.cpp b/core/modules/UnitTests/tModuleConfig/tst_configbasetest.cpp index 8598bf65a..a359257b4 100644 --- a/core/modules/UnitTests/tModuleConfig/tst_configbasetest.cpp +++ b/core/modules/UnitTests/tModuleConfig/tst_configbasetest.cpp @@ -269,6 +269,14 @@ void ConfigBaseTest::testLibNameManagerWindows() } -QTEST_APPLESS_MAIN(ConfigBaseTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(ConfigBaseTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(ConfigBaseTest) +#endif + #include "tst_configbasetest.moc" diff --git a/core/modules/UnitTests/tReaderConfig/tst_treaderconfigtest.cpp b/core/modules/UnitTests/tReaderConfig/tst_treaderconfigtest.cpp index d1e4a47a0..59e682a4a 100644 --- a/core/modules/UnitTests/tReaderConfig/tst_treaderconfigtest.cpp +++ b/core/modules/UnitTests/tReaderConfig/tst_treaderconfigtest.cpp @@ -384,7 +384,14 @@ void TReaderConfigTest::testCreateDirectories() fs::remove_all("a2"); } +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TReaderConfigTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TReaderConfigTest) +#endif -QTEST_APPLESS_MAIN(TReaderConfigTest) #include "tst_treaderconfigtest.moc" diff --git a/frameworks/tomography/UnitTests/tBBLogNorm/tst_BBLogNorm.cpp b/frameworks/tomography/UnitTests/tBBLogNorm/tst_BBLogNorm.cpp index caaf1be93..197fd6f2c 100644 --- a/frameworks/tomography/UnitTests/tBBLogNorm/tst_BBLogNorm.cpp +++ b/frameworks/tomography/UnitTests/tBBLogNorm/tst_BBLogNorm.cpp @@ -30,6 +30,14 @@ void TBBLogNorm::test_parameters() QSKIP("Placeholder for future development of the BB plugin."); } -QTEST_APPLESS_MAIN(TBBLogNorm) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TBBLogNorm) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TBBLogNorm) +#endif + #include "tst_BBLogNorm.moc" diff --git a/frameworks/tomography/UnitTests/tFrameWork/tst_frameworktest.cpp b/frameworks/tomography/UnitTests/tFrameWork/tst_frameworktest.cpp index a589e3377..8984517d3 100644 --- a/frameworks/tomography/UnitTests/tFrameWork/tst_frameworktest.cpp +++ b/frameworks/tomography/UnitTests/tFrameWork/tst_frameworktest.cpp @@ -1219,6 +1219,14 @@ void FrameWorkTest::testBuildFileList_skipGolden() } -QTEST_APPLESS_MAIN(FrameWorkTest) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(FrameWorkTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(FrameWorkTest) +#endif + #include "tst_frameworktest.moc" diff --git a/frameworks/tomography/UnitTests/tReconAlgorithms/tst_algorithmtester.cpp b/frameworks/tomography/UnitTests/tReconAlgorithms/tst_algorithmtester.cpp index 5947c40d2..d4e6d3146 100644 --- a/frameworks/tomography/UnitTests/tReconAlgorithms/tst_algorithmtester.cpp +++ b/frameworks/tomography/UnitTests/tReconAlgorithms/tst_algorithmtester.cpp @@ -91,6 +91,15 @@ void AlgorithmTesterTest::testLinearFwd() // QVERIFY2(true, "Failure"); } -QTEST_APPLESS_MAIN(AlgorithmTesterTest) + +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(AlgorithmTesterTest) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(AlgorithmTesterTest) +#endif + #include "tst_algorithmtester.moc" diff --git a/frameworks/tomography/UnitTests/tReconConfig/tst_ReconConfig.cpp b/frameworks/tomography/UnitTests/tReconConfig/tst_ReconConfig.cpp index f48c08406..bf4f42b23 100644 --- a/frameworks/tomography/UnitTests/tReconConfig/tst_ReconConfig.cpp +++ b/frameworks/tomography/UnitTests/tReconConfig/tst_ReconConfig.cpp @@ -618,6 +618,14 @@ void ReconConfigTests::testConfigAssignment() QCOMPARE(newconfig.ProjectionInfo.eDirection, config.ProjectionInfo.eDirection); } -QTEST_APPLESS_MAIN(ReconConfigTests) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(ReconConfigTests) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(ReconConfigTests) +#endif + #include "tst_ReconConfig.moc" diff --git a/frameworks/tomography/UnitTests/tStdBackProjectors/tst_StdBackProjectors.cpp b/frameworks/tomography/UnitTests/tStdBackProjectors/tst_StdBackProjectors.cpp index f9398db81..9aa5c155f 100644 --- a/frameworks/tomography/UnitTests/tStdBackProjectors/tst_StdBackProjectors.cpp +++ b/frameworks/tomography/UnitTests/tStdBackProjectors/tst_StdBackProjectors.cpp @@ -58,6 +58,14 @@ void TStdBackProjectors::test_NNMultiProjBP_Initialize() } -QTEST_APPLESS_MAIN(TStdBackProjectors) +#ifdef __APPLE__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" + QTEST_APPLESS_MAIN(TStdBackProjectors) + #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TStdBackProjectors) +#endif + #include "tst_StdBackProjectors.moc" From 11a71d6844113ab7c0f4c99e48f470982550b80f Mon Sep 17 00:00:00 2001 From: Anders Kaestner Date: Fri, 6 Dec 2024 16:00:33 +0100 Subject: [PATCH 4/4] Fixed windows compile error --- .../UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp | 2 ++ .../Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp b/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp index 97f4e1e4a..4351ccb14 100644 --- a/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp +++ b/core/algorithms/UnitTests/tImagingAlgorithms/tst_testImagingAlgorithms.cpp @@ -705,6 +705,8 @@ void TestImagingAlgorithms::ProjSeriesCorr_Correction() #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" QTEST_APPLESS_MAIN(TestImagingAlgorithms) #pragma clang diagnostic pop +#else + QTEST_APPLESS_MAIN(TestImagingAlgorithms) #endif #include "tst_testImagingAlgorithms.moc" diff --git a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp index adbe5b6fc..2688bde37 100644 --- a/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp +++ b/frameworks/tomography/Backprojectors/FDKBackProjectors/src/fdkbp_single.cpp @@ -468,7 +468,7 @@ void FDKbp_single::project_volume_onto_image_c(kipl::base::TImage &cbi logger.verbose("backproj loop"); #pragma omp parallel for // not sure about this firstprivate - for (size_t k = 0; k < volume.Size(2); ++k) + for (ptrdiff_t k = 0; k < static_cast(volume.Size(2)); ++k) { // int long p = k * volume.Size(1) * volume.Size(0); for (size_t j = 0; j < volume.Size(1); ++j)