toke.c: minor adjustment of #ifdef to stop confusing code editors #22774
+4
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Quite possibly the stupidest PR I've ever had to raise. It makes no change to the compiled output behaviour. It isn't even a change for the benefit of human readers. This change is here purely to stop confusing static analysis and code editing tools.
Before this change, the two separate
while
statements would upset the code folding as parsed by tree-sitter-c (and likely many others, I haven't tested), into thinking this was two nested loops. Having failed to find the end of both of them before the end of the function, various confusions result, usually ending up in the entire rest of the file (and it's a long file) getting folded into one giant region. This likely causes various static analysis tools similarly to not see any of the subsequent functions in the file.By adjusting the code so that just the condition part is inside the
#ifdef
, it means that code parsing tools have a much easier time working out the high-level structure of this file.