From e6bb66c8479295808569d05839ad9245da37304c Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Thu, 17 Oct 2024 20:25:47 +0200
Subject: [PATCH] control: Add a copy of the defines as integer to silent the
 warning on the switch case

---
 control/descriptor.c          | 8 ++++----
 include/chameleon/constants.h | 7 +++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/control/descriptor.c b/control/descriptor.c
index ea6b712d1..556dc8ba7 100644
--- a/control/descriptor.c
+++ b/control/descriptor.c
@@ -19,7 +19,7 @@
  * @author Raphael Boucherie
  * @author Samuel Thibault
  * @author Lionel Eyraud-Dubois
- * @date 2023-07-06
+ * @date 2024-10-18
  *
  ***
  *
@@ -295,7 +295,7 @@ int chameleon_desc_init_internal( CHAM_desc_t *desc, const char *name, void *mat
     desc->ooc = 0;
 
     switch ( (intptr_t)mat ) {
-    case (intptr_t)CHAMELEON_MAT_ALLOC_TILE:
+    case CHAMELEON_MAT_CASE_ALLOC_TILE:
         if ( chamctxt->scheduler == RUNTIME_SCHED_STARPU ) {
             /* Let's use the allocation on the fly as in OOC */
             desc->get_blkaddr = chameleon_getaddr_null;
@@ -305,13 +305,13 @@ int chameleon_desc_init_internal( CHAM_desc_t *desc, const char *name, void *mat
         /* Otherwise we switch back to the full allocation */
         chameleon_attr_fallthrough;
 
-    case (intptr_t)CHAMELEON_MAT_ALLOC_GLOBAL:
+    case CHAMELEON_MAT_CASE_ALLOC_GLOBAL:
         rc = chameleon_desc_mat_alloc( desc );
         desc->alloc_mat = 1;
         desc->use_mat   = 1;
         break;
 
-    case (intptr_t)CHAMELEON_MAT_OOC:
+    case CHAMELEON_MAT_CASE_OOC:
         if ( chamctxt->scheduler != RUNTIME_SCHED_STARPU ) {
             chameleon_error("CHAMELEON_Desc_Create", "CHAMELEON Out-of-Core descriptors are supported only with StarPU");
             return CHAMELEON_ERR_NOT_SUPPORTED;
diff --git a/include/chameleon/constants.h b/include/chameleon/constants.h
index 5bcc5ac3c..2fcdf6de8 100644
--- a/include/chameleon/constants.h
+++ b/include/chameleon/constants.h
@@ -353,6 +353,13 @@ typedef enum chameleon_translation_e {
 #define CHAMELEON_MAT_ALLOC_TILE   ((void*)-1)
 #define CHAMELEON_MAT_OOC          ((void*)-2)
 
+/**
+ * @brief Integer constant matching the previous ones for case values
+ */
+#define CHAMELEON_MAT_CASE_ALLOC_GLOBAL  0
+#define CHAMELEON_MAT_CASE_ALLOC_TILE   -1
+#define CHAMELEON_MAT_CASE_OOC          -2
+
 /**
  *  CHAMELEON constants - success & error codes
  */
-- 
GitLab