Allow declaring a parameter unused when not DEBUGGING - #24798
Open
khwilliamson wants to merge 1 commit into
Open
Allow declaring a parameter unused when not DEBUGGING#24798khwilliamson wants to merge 1 commit into
khwilliamson wants to merge 1 commit into
Conversation
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.