Skip to content

Commit 03f18c8

Browse files
committed
Remove #ifndef self-test from generated headers
1 parent a86036f commit 03f18c8

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

libc/utils/hdrgen/header.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def public_api(self):
5050
] + [""]
5151

5252
for macro in self.macros:
53-
content.append(f"{macro}\n")
53+
if str(macro):
54+
content.append(f"{macro}\n")
5455

5556
for type_ in self.types:
5657
content.append(f"{type_}")

libc/utils/hdrgen/macro.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ def __init__(self, name, value=None, header=None):
1515

1616
def __str__(self):
1717
if self.header != None:
18-
return f"""#ifndef {self.name}
19-
#error "{self.name} should be defined by llvm-libc-macros/{self.header}"
20-
#endif"""
18+
return ""
2119
if self.value != None:
2220
return f"#define {self.name} {self.value}"
2321
return f"#define {self.name}"

libc/utils/hdrgen/tests/expected_output/test_header.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222

2323
#define MACRO_C
2424

25-
#ifndef MACRO_D
26-
#error "MACRO_D should be defined by llvm-libc-macros/test_small-macros.h"
27-
#endif
28-
29-
#ifndef MACRO_E
30-
#error "MACRO_E should be defined by llvm-libc-macros/test_more-macros.h"
31-
#endif
32-
3325
#include <llvm-libc-types/type_a.h>
3426
#include <llvm-libc-types/type_b.h>
3527

0 commit comments

Comments
 (0)