Skip to content

Conversation

@iabyn
Copy link
Contributor

@iabyn iabyn commented Sep 6, 2025

PERL_RC_STACK builds were giving this warning:

pp_hot.c:3147:21: warning: variable 'i' set but not used
[-Wunused-but-set-variable]

which was true: under that build, the i variable was being set but not used in a couple of places (it's value is only used on non-PERL_RC_STACK builds).

So avoid that var under PERL_RC_STACK builds.

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

PERL_RC_STACK builds were giving this warning:

    pp_hot.c:3147:21: warning: variable 'i' set but not used
    [-Wunused-but-set-variable]

which was true: under that build, the i variable was being set but
not used in a couple of places (it's value is only used on
non-PERL_RC_STACK builds).

So avoid that var under PERL_RC_STACK builds.
@jkeenan
Copy link
Contributor

jkeenan commented Sep 6, 2025

PERL_RC_STACK builds were giving this warning:

I will test this out later today.

@xenu
Copy link
Member

xenu commented Sep 6, 2025

We use C99 now, so I think it would make sense to move the declarations of i and svp inside the loops.

@iabyn
Copy link
Contributor Author

iabyn commented Sep 6, 2025

We use C99 now, so I think it would make sense to move the declarations of i and svp inside the loops.

Possibly, but I'd prefer to keep this commit as minimal as possible, to just address the issue at hand.

@jkeenan jkeenan added the build-time-warnings Replaces [META] Build-time warnings RT #133556 label Sep 6, 2025
Copy link
Contributor

@jkeenan jkeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configured and built with clang and -DPERL_RC_STACK on both Linux and FreeBSD; build-time warning gone. Also built with g++ and -DPERL_RC_STACK on Linux; this particular build-time warning was not emitted. Ready to merge.

SV **svp;
#ifndef PERL_RC_STACK
SSize_t i;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When struggling with the build-time warning (as mentioned in #23661 (comment)), I got this far ...

#else
for (i = 0, svp = relem; svp <= lastrelem; i++, svp++)
#endif
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but didn't realize I should have put this for loop statement inside an #ifdef ... #else ... #endif structure; below as well. Thanks.

@iabyn iabyn merged commit 48f4f43 into blead Sep 7, 2025
68 checks passed
@iabyn iabyn deleted the davem/rc_unused_i branch September 7, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-time-warnings Replaces [META] Build-time warnings RT #133556

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants