From f274109d2e01d0847d087ba99ce1de6476efa7d1 Mon Sep 17 00:00:00 2001
From: Lisandro Dalcin <dalcinl@gmail.com>
Date: Sun, 4 May 2025 09:48:51 +0300
Subject: [PATCH 1/2] UCS: Fix for GCC 15 -Werror=enum-int-mismatch

Signed-off-by: Lisandro Dalcin <dalcinl@gmail.com>
---
 AUTHORS                    | 1 +
 src/ucs/arch/aarch64/cpu.h | 2 +-
 src/ucs/arch/ppc64/cpu.h   | 2 +-
 src/ucs/arch/rv64/cpu.h    | 2 +-
 src/ucs/arch/x86_64/cpu.c  | 6 +++---
 src/ucs/sys/init.c         | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 7ec8a3d4ac5..18c8868b642 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -57,6 +57,7 @@ Khaled Hamidouche <Khaled.Hamidouche@amd.com>
 Konstantin Belousov <kib@freebsd.org>
 Leonid Genkin <lgenkin@nvidia.com>
 Lior Paz <liorpa@nvidia.com>
+Lisandro Dalcin <dalcinl@gmail.com>
 Luis E. Pena <l31g@hotmail.com>
 Manjunath Gorentla Venkata <manjugv@gmail.com>
 Marek Schimara <Marek.Schimara@bull.net>
diff --git a/src/ucs/arch/aarch64/cpu.h b/src/ucs/arch/aarch64/cpu.h
index 213ea6d1f24..3ce685c833e 100644
--- a/src/ucs/arch/aarch64/cpu.h
+++ b/src/ucs/arch/aarch64/cpu.h
@@ -150,7 +150,7 @@ static inline ucs_cpu_model_t ucs_arch_get_cpu_model()
     return UCS_CPU_MODEL_ARM_AARCH64;
 }
 
-static inline int ucs_arch_get_cpu_flag()
+static inline ucs_cpu_flag_t ucs_arch_get_cpu_flag()
 {
     return UCS_CPU_FLAG_UNKNOWN;
 }
diff --git a/src/ucs/arch/ppc64/cpu.h b/src/ucs/arch/ppc64/cpu.h
index c973004c608..1de42873a7c 100644
--- a/src/ucs/arch/ppc64/cpu.h
+++ b/src/ucs/arch/ppc64/cpu.h
@@ -61,7 +61,7 @@ static inline ucs_cpu_vendor_t ucs_arch_get_cpu_vendor()
     return UCS_CPU_VENDOR_GENERIC_PPC;
 }
 
-static inline int ucs_arch_get_cpu_flag()
+static inline ucs_cpu_flag_t ucs_arch_get_cpu_flag()
 {
     return UCS_CPU_FLAG_UNKNOWN;
 }
diff --git a/src/ucs/arch/rv64/cpu.h b/src/ucs/arch/rv64/cpu.h
index 1a83fc2dc93..5e5fb689430 100644
--- a/src/ucs/arch/rv64/cpu.h
+++ b/src/ucs/arch/rv64/cpu.h
@@ -62,7 +62,7 @@ static inline ucs_cpu_model_t ucs_arch_get_cpu_model()
     return UCS_CPU_MODEL_RV64G;
 }
 
-static inline int ucs_arch_get_cpu_flag()
+static inline ucs_cpu_flag_t ucs_arch_get_cpu_flag()
 {
     return UCS_CPU_FLAG_UNKNOWN;
 }
diff --git a/src/ucs/arch/x86_64/cpu.c b/src/ucs/arch/x86_64/cpu.c
index 7894861e69c..4081d89b13f 100644
--- a/src/ucs/arch/x86_64/cpu.c
+++ b/src/ucs/arch/x86_64/cpu.c
@@ -499,9 +499,9 @@ ucs_cpu_model_t ucs_arch_get_cpu_model()
 }
 
 
-int ucs_arch_get_cpu_flag()
+ucs_cpu_flag_t ucs_arch_get_cpu_flag()
 {
-    static int cpu_flag = UCS_CPU_FLAG_UNKNOWN;
+    static ucs_cpu_flag_t cpu_flag = UCS_CPU_FLAG_UNKNOWN;
 
     if (UCS_CPU_FLAG_UNKNOWN == cpu_flag) {
         uint32_t result = 0;
@@ -553,7 +553,7 @@ int ucs_arch_get_cpu_flag()
                 result |= UCS_CPU_FLAG_AVX2;
             }
         }
-        cpu_flag = result;
+        cpu_flag = (ucs_cpu_flag_t) result;
     }
 
     return cpu_flag;
diff --git a/src/ucs/sys/init.c b/src/ucs/sys/init.c
index e05ea689c8e..6330e9f2281 100644
--- a/src/ucs/sys/init.c
+++ b/src/ucs/sys/init.c
@@ -32,7 +32,7 @@ static UCS_F_NOOPTIMIZE void ucs_check_cpu_flags(void)
 {
     char str[256];
     char *p_str;
-    int cpu_flags;
+    ucs_cpu_flag_t cpu_flags;
     struct {
         const char* flag;
         ucs_cpu_flag_t value;

From 1adf2aecb6fedd82227e9c293a77473ad42632be Mon Sep 17 00:00:00 2001
From: Lisandro Dalcin <dalcinl@gmail.com>
Date: Mon, 5 May 2025 20:35:59 +0300
Subject: [PATCH 2/2] TOOLS/PERF: Include headers before BEGIN_C_DECLS

Signed-off-by: Lisandro Dalcin <dalcinl@gmail.com>
---
 src/tools/perf/api/libperf.h     | 6 +++---
 src/tools/perf/lib/libperf_int.h | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/tools/perf/api/libperf.h b/src/tools/perf/api/libperf.h
index d3d9cceb1cc..9cd69f8b452 100644
--- a/src/tools/perf/api/libperf.h
+++ b/src/tools/perf/api/libperf.h
@@ -12,13 +12,13 @@
 
 #include <ucs/sys/compiler.h>
 
+#include <uct/api/uct.h>
+#include <ucp/api/ucp.h>
+
 BEGIN_C_DECLS
 
 /** @file libperf.h */
 
-#include <uct/api/uct.h>
-#include <ucp/api/ucp.h>
-
 
 typedef enum {
     UCX_PERF_API_UCT,
diff --git a/src/tools/perf/lib/libperf_int.h b/src/tools/perf/lib/libperf_int.h
index 3e6d9f77f53..4a228fe5127 100644
--- a/src/tools/perf/lib/libperf_int.h
+++ b/src/tools/perf/lib/libperf_int.h
@@ -11,10 +11,6 @@
 
 #include <tools/perf/api/libperf.h>
 
-BEGIN_C_DECLS
-
-/** @file libperf_int.h */
-
 #include <ucs/async/async.h>
 #include <ucs/time/time.h>
 #include <ucs/sys/math.h>
@@ -24,6 +20,10 @@ BEGIN_C_DECLS
 #include <omp.h>
 #endif
 
+BEGIN_C_DECLS
+
+/** @file libperf_int.h */
+
 
 #define TIMING_QUEUE_SIZE    2048
 #define UCT_PERF_TEST_AM_ID  5
