From 53777aff0695a86c33edbd50c5785f1a2b902206 Mon Sep 17 00:00:00 2001 From: bassiounix Date: Fri, 8 Aug 2025 17:33:46 +0300 Subject: [PATCH] [libc][hdrgen] Fix hdrgen when using macros as guards in stdlib.yaml. --- libc/utils/hdrgen/hdrgen/header.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libc/utils/hdrgen/hdrgen/header.py b/libc/utils/hdrgen/hdrgen/header.py index b054ed4e03bd0..2118db6e5fb75 100644 --- a/libc/utils/hdrgen/hdrgen/header.py +++ b/libc/utils/hdrgen/hdrgen/header.py @@ -204,7 +204,7 @@ def relpath(file): current_guard = None for function in self.functions: - if function.guard == None: + if function.guard == None and current_guard == None: content.append(str(function) + " __NOEXCEPT;") content.append("") else: @@ -221,7 +221,8 @@ def relpath(file): content.append(f"#endif // {current_guard}") content.append("") current_guard = function.guard - content.append(f"#ifdef {current_guard}") + if current_guard is not None: + content.append(f"#ifdef {current_guard}") content.append(str(function) + " __NOEXCEPT;") content.append("") if current_guard != None: