Skip to content

Commit 45b1594

Browse files
authored
[libc][hdrgen] Fix hdrgen when using macros as guards in stdlib.yaml. (#152732)
1 parent 7c141e2 commit 45b1594

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libc/utils/hdrgen/hdrgen/header.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def relpath(file):
204204

205205
current_guard = None
206206
for function in self.functions:
207-
if function.guard == None:
207+
if function.guard == None and current_guard == None:
208208
content.append(str(function) + " __NOEXCEPT;")
209209
content.append("")
210210
else:
@@ -221,7 +221,8 @@ def relpath(file):
221221
content.append(f"#endif // {current_guard}")
222222
content.append("")
223223
current_guard = function.guard
224-
content.append(f"#ifdef {current_guard}")
224+
if current_guard is not None:
225+
content.append(f"#ifdef {current_guard}")
225226
content.append(str(function) + " __NOEXCEPT;")
226227
content.append("")
227228
if current_guard != None:

0 commit comments

Comments
 (0)