From ff31181a1ad15f89433d85d2200c6237fcfded27 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Fri, 17 Feb 2023 15:46:43 +0100
Subject: [PATCH] [machdep] more robust regex for equivalent type
 identification

---
 share/machdeps/make_machdep/make_machdep.py       | 2 +-
 share/machdeps/make_machdep/make_machdep_common.h | 2 +-
 share/machdeps/make_machdep/size_t.c              | 7 +++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/share/machdeps/make_machdep/make_machdep.py b/share/machdeps/make_machdep/make_machdep.py
index 55770106954..97aa2901b0a 100755
--- a/share/machdeps/make_machdep/make_machdep.py
+++ b/share/machdeps/make_machdep/make_machdep.py
@@ -191,7 +191,7 @@ def find_value(name, typ, output):
             return int(x)
 
     elif typ == "type":
-        expected = "([a-zA-Z_]+)"
+        expected = "'([^']+)'"
 
         def conversion(x):
             return x
diff --git a/share/machdeps/make_machdep/make_machdep_common.h b/share/machdeps/make_machdep/make_machdep_common.h
index 2dd4ae89ff4..729a741947e 100644
--- a/share/machdeps/make_machdep/make_machdep_common.h
+++ b/share/machdeps/make_machdep/make_machdep_common.h
@@ -39,6 +39,6 @@
 #define mkstr(s) #s
 
 #define TEST_TYPE_COMPATIBLE(T1, T2)                                           \
-  _Static_assert(!COMPATIBLE(T1, T2), "" mkstr(T2) " is " #T1);
+  _Static_assert(!COMPATIBLE(T1, T2), "" mkstr(T2) " is '" #T1 "'");
 
 #define TEST_TYPE_IS(type) TEST_TYPE_COMPATIBLE(type, TEST_TYPE)
diff --git a/share/machdeps/make_machdep/size_t.c b/share/machdeps/make_machdep/size_t.c
index eeca11c8bc7..13a4685263c 100644
--- a/share/machdeps/make_machdep/size_t.c
+++ b/share/machdeps/make_machdep/size_t.c
@@ -23,5 +23,8 @@
 #include "make_machdep_common.h"
 #include <stddef.h>
 
-_Static_assert(!COMPATIBLE(unsigned int, size_t), "size_t is unsigned int");
-_Static_assert(!COMPATIBLE(unsigned long, size_t), "size_t is unsigned long");
+#define TEST_TYPE size_t
+
+TEST_TYPE_IS(unsigned int)
+TEST_TYPE_IS(unsigned long)
+TEST_TYPE_IS(unsigned long long)
-- 
GitLab