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: