Skip to content

Commit 852b412

Browse files
committed
Fix @MODULE_BLOCK@ sub for Makefile.pre.
This was failing if the module block text was empty.
1 parent f7cbac5 commit 852b412

File tree

2 files changed

+324
-306
lines changed

2 files changed

+324
-306
lines changed

Tools/configure/transpiler/pyconf.awk

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,10 +2041,15 @@ function _pyconf_subst_file(inf, outf, line, k, pat, val, pos, before, after, sk
20412041
pos = index(line, "@MODULE_BLOCK@")
20422042
before = substr(line, 1, pos - 1)
20432043
after = substr(line, pos + length("@MODULE_BLOCK@"))
2044-
for (i = 1; i <= _module_block_n; i++) {
2045-
b = (i == 1) ? before : ""
2046-
a = (i == _module_block_n) ? after : ""
2047-
printf "%s%s%s\n", b, _module_block_lines[i], a > outf
2044+
if (_module_block_n > 0) {
2045+
for (i = 1; i <= _module_block_n; i++) {
2046+
b = (i == 1) ? before : ""
2047+
a = (i == _module_block_n) ? after : ""
2048+
printf "%s%s%s\n", b, _module_block_lines[i], a > outf
2049+
}
2050+
} else {
2051+
# No modules, just print the before and after parts
2052+
printf "%s%s\n", before, after > outf
20482053
}
20492054
skip = 1
20502055
}

0 commit comments

Comments
 (0)