Skip to content

Commit 517b0d2

Browse files
committed
codegen: emit stdbool.h and complex.h when appropriate in C99 mode
1 parent c8878b1 commit 517b0d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

loopy/target/c/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ def dtype_to_ctype(self, dtype):
8282
def c99_preamble_generator(preamble_info):
8383
if any(dtype.is_integral() for dtype in preamble_info.seen_dtypes):
8484
yield("10_stdint", "#include <stdint.h>")
85+
if any(dtype.numpy_dtype == np.dtype("bool")
86+
for dtype in preamble_info.seen_dtypes):
87+
yield("10_stdbool", "#include <stdbool.h>")
88+
if any(dtype.is_complex() for dtype in preamble_info.seen_dtypes):
89+
yield("10_complex", "#include <complex.h>")
8590

8691

8792
def _preamble_generator(preamble_info):

0 commit comments

Comments
 (0)