From c190d1432b964461bc2366979f39985c7c739fb3 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Thu, 4 Apr 2024 17:36:06 +0200
Subject: [PATCH] [machdep] fix generation of undef directives for
 __fc_machdep.h

---
 src/kernel_internals/runtime/machdep.ml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/kernel_internals/runtime/machdep.ml b/src/kernel_internals/runtime/machdep.ml
index 69980c349a3..5336176113d 100644
--- a/src/kernel_internals/runtime/machdep.ml
+++ b/src/kernel_internals/runtime/machdep.ml
@@ -28,7 +28,13 @@ let gen_define fmt macro pp def =
 let gen_include fmt file =
   Format.fprintf fmt "#include <%s>@\n" file
 
-let gen_undef fmt macro = Format.fprintf fmt "#undef %s@\n" macro
+let gen_undef fmt macro =
+  let macro =
+    match String.index_from_opt macro 0 '(' with
+    | None -> macro
+    | Some n -> String.sub macro 0 n
+  in
+  Format.fprintf fmt "#undef %s@\n" macro
 
 let gen_define_string fmt macro def =
   gen_define fmt macro Format.pp_print_string def
-- 
GitLab