Skip to content

Move ARGS_ASSERT lines to top of their functions#24274

Merged
khwilliamson merged 3 commits intoPerl:bleadfrom
khwilliamson:asserts_to_top
Mar 14, 2026
Merged

Move ARGS_ASSERT lines to top of their functions#24274
khwilliamson merged 3 commits intoPerl:bleadfrom
khwilliamson:asserts_to_top

Conversation

@khwilliamson
Copy link
Copy Markdown
Contributor

Besides being more tidy, this makes sure that the asserts inside them are executed before any attempt to use the parameters. This will give better error messages when those assertions are violated, instead of the generic SEGFAULT that could occur previously.

  • This set of changes does not require a perldelta entry.

@khwilliamson khwilliamson changed the title Move ARGS_ASSERT lines to top of theirfunctions Move ARGS_ASSERT lines to top of their functions Mar 14, 2026
@Leont
Copy link
Copy Markdown
Contributor

Leont commented Mar 14, 2026

Yeah the old order was often necessary in C89 (declarations had to come first), but I agree having the asserts first makes more sense.

embed.fnc thought this function only existed in DEBUGGING, but in
reality it does; most of the contents are stubbed out unless DEBUGGING,
but it is callable without DEBUGGING.
I discovered that these 19 functions had mismatched parameter names in
embed.fnc compared with the actual names in the function definition.
Despite not being good practice, this hasn't mattered so far, but will
in a future commit.
Besides being more tidy, this makes sure that the asserts inside them
are executed before any attempt to use the parameters.  This will give
better error messages when those assertions are violated, instead of the
generic SEGFAULT that could occur previously.
@khwilliamson khwilliamson merged commit 1c44630 into Perl:blead Mar 14, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants