Skip to content

Allow declaring a parameter unused when not DEBUGGING - #24798

Open
khwilliamson wants to merge 1 commit into
Perl:bleadfrom
khwilliamson:debug_only
Open

Allow declaring a parameter unused when not DEBUGGING#24798
khwilliamson wants to merge 1 commit into
Perl:bleadfrom
khwilliamson:debug_only

Conversation

@khwilliamson

Copy link
Copy Markdown
Contributor

This is a follow on to b35a6ea which adds the ability to decare a parameter to be unused. This new commit makes it convenient to declare a parameter to be DEBUG_ONLY, allowing the removal of PERL_UNUSED_ARG statements in the code that the previous commit didn't.

And this commit removes two related such statements, to show how it works.

The purpose of PERL_UNUSED_ARG is to avoid expected warnings that are known harmless, without turning off all warnings of that kind. It is possible to use that macro when there are actual uses of the parameter, thus defeating the macro's purpose to some extent. This is typically done when some Configure options cause the parameter to be used, and some do not, and the author didn't want to add the extra #ifdef's required to get the macro to be in effect in just the precise conditions. After all, there's added complexity in the code for both the author and future readers that can obscure the basic logic, with not that much gain.

But, the most common case where the parameter is only used in some Configurations is in DEBUGGING builds. This commit handles this common case. It is a simple extension to
b35a6ea, to whose commit message you are referred to the details.

This is enabled only for core perl and extensions.

To use this capability, the symbol DEBUG_ONLY is added after the parameter name in both its embed.fnc entry and its definition.

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

This is a follow on to b35a6ea which
adds the ability to decare a parameter to be unused.  This new commit
makes it convenient to declare a parameter to be DEBUG_ONLY, allowing
the removal of PERL_UNUSED_ARG statements in the code that the previous
commit didn't.

And this commit removes two related such statements, to show how it
works.

The purpose of PERL_UNUSED_ARG is to avoid expected warnings that are
known harmless, without turning off all warnings of that kind.  It is
possible to use that macro when there are actual uses of the parameter,
thus defeating the macro's purpose to some extent.  This is typically
done when some Configure options cause the parameter to be used, and
some do not, and the author didn't want to add the extra #ifdef's
required to get the macro to be in effect in just the precise
conditions.  After all, there's added complexity in the code for both
the author and future readers that can obscure the basic logic, with not
that much gain.

But, the most common case where the parameter is only used in some
Configurations is in DEBUGGING builds.  This commit handles this common
case.  It is a simple extension to
b35a6ea, to whose commit message you
are referred to the details.

This is enabled only for core perl and extensions.

To use this capability, the symbol DEBUG_ONLY is added after the
parameter name in *both* its embed.fnc entry and its definition.
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.

1 participant