From 2a6ac3a79c871362003112d7957b8357e71b019b Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Fri, 8 Aug 2025 19:53:33 +0800 Subject: [PATCH] util: Add namespace over float16_t in half_float.h As float16_t may comes from arm_neon.h: arm_neon.h:74:16: error: conflicting declaration 'typedef __fp16 float16_t' 74 | typedef __fp16 float16_t; Also it is std::float16_t from as part of C++23 So place it under namespace mesa to avoid conflict when upgrading xxhash.h to v0.8.3 Signed-off-by: Yonggang Luo Acked-by: Eric Engestrom Reviewed-by: Erik Faye-Lund Part-of: --- src/compiler/glsl/ir.h | 2 ++ src/util/half_float.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index 4ef8d9a6135..f967ccb1d4b 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -51,6 +51,8 @@ struct gl_builtin_uniform_desc; #ifdef __cplusplus +using float16_t = mesa::float16_t; + /** * \defgroup IR Intermediate representation nodes * diff --git a/src/util/half_float.h b/src/util/half_float.h index fed99277d58..7254c7533b8 100644 --- a/src/util/half_float.h +++ b/src/util/half_float.h @@ -126,6 +126,9 @@ _mesa_half_is_negative(uint16_t h) #ifdef __cplusplus +namespace mesa +{ + /* Helper class for disambiguating fp16 from uint16_t in C++ overloads */ struct float16_t { @@ -137,6 +140,8 @@ struct float16_t { static float16_t zero() { return float16_t(FP16_ZERO); } }; +} /* namespace mesa */ + #endif