From dff08f848b4276183a3f1430ed8e6268a8856e55 Mon Sep 17 00:00:00 2001
From: "raphael.bach" <raphael.bach@etu.hesge.ch>
Date: Sun, 26 Jun 2022 21:39:09 +0200
Subject: [PATCH] Move `_Static_assert()` outside of function body in
 `fmpi_data.c`

---
 src/fmpi_data.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/fmpi_data.c b/src/fmpi_data.c
index 63b4744..523ad4c 100644
--- a/src/fmpi_data.c
+++ b/src/fmpi_data.c
@@ -57,11 +57,11 @@ struct fmpi_data fmpi_data_out_##T( \
 FMPI_DEFINE_FUNCS_T(FMPI_DATA_FUNC_DEFINITION_T, FMPI_DATA_TYPES)
 
 #define FMPI_DATA_FUNC_DEFINITION_DT(D, T) \
+_Static_assert((D) > 0 && (D) <= FMPI_DIM_MAX, ""); \
 struct fmpi_data fmpi_data_##D##d_in_##T( \
     const struct fmpi_ctx * const ctx, T * const data, \
     const size_t x, const size_t y, const size_t z \
 ){ \
-    _Static_assert((D) <= FMPI_DIM_MAX, ""); \
     assert(ctx != NULL); \
     assert(data != NULL); \
     const size_t cnt = (x * y * z); \
@@ -83,7 +83,6 @@ struct fmpi_data fmpi_data_##D##d_out_##T( \
     const struct fmpi_ctx * const ctx, T * const data, \
     const size_t x, const size_t y, const size_t z \
 ){ \
-    _Static_assert((D) <= FMPI_DIM_MAX, ""); \
     assert(ctx != NULL); \
     assert(data != NULL); \
     const size_t cnt = (x * y * z); \
-- 
GitLab