Skip to content

Commit aee8996

Browse files
committed
fix: remove dead 'or True' guard — unconditionally emit resync marker
Addressed code review feedback: 'if unsync or multiline or True' makes the unsync/multiline sub-expressions dead code. Since the intent is to always emit a resync linemarker after a $: call, remove the if guard entirely and dedent the body, making the unconditional behaviour explicit in the code rather than hiding it behind a tautological condition.
1 parent d2c3a8d commit aee8996

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
--- a/fypp.py 2026-05-14 18:22:07.622131094 -0400
2-
+++ b/fypp.py 2026-05-14 18:22:07.650131330 -0400
3-
@@ -1848,7 +1848,13 @@
1+
--- a/fypp.py 2026-05-14 19:44:34.158817311 -0400
2+
+++ b/fypp.py 2026-05-14 19:44:34.188817564 -0400
3+
@@ -1848,12 +1848,17 @@
44
and not self._contlinenums)
55
# Eval directive in source consists of more than one line
66
multiline = span[1] - span[0] > 1
77
- if unsync or multiline:
8+
- # For inline eval directives span[0] == span[1]
9+
- # -> next line is span[0] + 1 and not span[1] as for
10+
- # line eval directives
11+
- nextline = max(span[1], span[0] + 1)
12+
- trailing += self._linenumdir(nextline, fname)
813
+ # Always emit a resync marker after a $: call. Without this,
914
+ # single-line $: calls that expand to multi-line #if/#endif
1015
+ # blocks (e.g. GPU_PARALLEL_LOOP) cause the compiler to
1116
+ # attribute the next Fortran statement to the call-site line
1217
+ # rather than the following source line, producing off-by-1
1318
+ # errors in backtraces and debugger line info.
14-
+ if unsync or multiline or True:
15-
# For inline eval directives span[0] == span[1]
16-
# -> next line is span[0] + 1 and not span[1] as for
17-
# line eval directives
19+
+ # For inline eval directives span[0] == span[1]
20+
+ # -> next line is span[0] + 1 and not span[1] as for
21+
+ # line eval directives
22+
+ nextline = max(span[1], span[0] + 1)
23+
+ trailing += self._linenumdir(nextline, fname)
24+
else:
25+
trailing = ''
26+
return result + trailing

0 commit comments

Comments
 (0)