Skip to content

Commit d507899

Browse files
committed
op.c: Make ifdef structure of argument to S_op_clear_gv() less objectionable to syntax parsers
The prior structure of this syntax made it look to tree-sitter-based parsers as if two separate functions were being defined, though only the second of which was ever finished. This resulted in the entire rest of the file appearing to be nested inside the first function, meaning no top-level function analysis was performed on them. This has various knock-on effects on code analysis in tooling such as editors or browsers. The fix for it moves the `#ifdef` syntax inside the argument parentheses to ensure that only one function appears to be created, so the entire rest of the file is parsed as normal.
1 parent d85c3a2 commit d507899

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

op.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,11 +1027,13 @@ Perl_op_free(pTHX_ OP *o)
10271027
/* S_op_clear_gv(): free a GV attached to an OP */
10281028

10291029
STATIC
1030-
#ifdef USE_ITHREADS
1031-
void S_op_clear_gv(pTHX_ OP *o, PADOFFSET *ixp)
1032-
#else
1033-
void S_op_clear_gv(pTHX_ OP *o, SV**svp)
1034-
#endif
1030+
void S_op_clear_gv(pTHX_ OP *o,
1031+
#ifdef USE_ITHREADS
1032+
PADOFFSET *ixp
1033+
#else
1034+
SV**svp
1035+
#endif
1036+
)
10351037
{
10361038

10371039
GV *gv = (o->op_type == OP_GV || o->op_type == OP_GVSV

0 commit comments

Comments
 (0)