From d05c9337d744c911151c5d443c7a870a09a19a86 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 6 Dec 2025 17:32:47 +0100 Subject: [PATCH 1/2] lib/typetraits.h: is_same_typeof(): Remove unused macro Signed-off-by: Alejandro Colomar --- lib/typetraits.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/typetraits.h b/lib/typetraits.h index fb3d970d97..26e474c160 100644 --- a/lib/typetraits.h +++ b/lib/typetraits.h @@ -48,11 +48,6 @@ __builtin_types_compatible_p(a, b) \ ) -#define is_same_typeof(a, b) \ -( \ - is_same_type(typeof(a), typeof(b)) \ -) - #define QChar_of(s) typeof \ ( \ From 3351d3d4accc900207e8db7c9e8117193a7997e6 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sat, 6 Dec 2025 17:30:18 +0100 Subject: [PATCH 2/2] lib/, src/: Use _Generic(3) instead of __builtin_types_compatible_p() _Generic(3) is standard C since ISO C11, so let's avoid unnecessarily using this GNU C extension. Signed-off-by: Alejandro Colomar --- lib/typetraits.h | 6 ------ src/usermod.c | 7 ++----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/typetraits.h b/lib/typetraits.h index 26e474c160..fcce130b6c 100644 --- a/lib/typetraits.h +++ b/lib/typetraits.h @@ -43,12 +43,6 @@ ) -#define is_same_type(a, b) \ -( \ - __builtin_types_compatible_p(a, b) \ -) - - #define QChar_of(s) typeof \ ( \ _Generic(s, \ diff --git a/src/usermod.c b/src/usermod.c index e8c9da6687..6d9c8cafdb 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -9,9 +9,6 @@ #include "config.h" -#ident "$Id$" - -#include #include #include #include @@ -325,8 +322,8 @@ getid_range(const char *str) .last = type_min(id_t) }; - static_assert(is_same_type(id_t, uid_t), ""); - static_assert(is_same_type(id_t, gid_t), ""); + _Generic((id_t){}, uid_t: (void)0); + _Generic((id_t){}, gid_t: (void)0); first = type_min(id_t); last = type_max(id_t);