Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc warning: unused variable 'ix' #140

Closed
atoomic opened this issue Feb 14, 2019 · 3 comments
Closed

gcc warning: unused variable 'ix' #140

atoomic opened this issue Feb 14, 2019 · 3 comments

Comments

@atoomic
Copy link

atoomic commented Feb 14, 2019

notice these warnings from this build log http://perl.develop-help.com/raw/?id=223899

Compiler messages(gcc):
Encode.c:1356:5: warning: unused variable 'ix' [-Wunused-variable]
../../XSUB.h:185:20: note: expanded from macro 'dXSI32'
Encode.c:1398:5: warning: unused variable 'ix' [-Wunused-variable]
./const-xs.inc:128:42: warning: AI_IDN_ALLOW_UNASSIGNED is deprecated [-W#pragma-messages]

this is coming from dXSI32
for example in XS_EUPXS I'm not even sure it's required

@atoomic
Copy link
Author

atoomic commented Feb 14, 2019

I see this is coming from the .c file generated from .xs one... where we are using aliases in XS function without having a different code for it, thus no need to use ix variable

for example in decode, the alias is just there as an alternate to decode and do not alter the code

 SV *
 decode(encoding, octets, check = NULL)
 SV *    encoding
 SV *    octets
 SV *    check
 ALIAS:
     bytes2str = 0

Looks like we cannot define XS alias without having dXSI32 loaded...

closing this case as there is nothing we can do there

@atoomic atoomic closed this as completed Feb 14, 2019
@pali
Copy link
Contributor

pali commented Feb 14, 2019

so looks like something for xsubpp... you can report issue to it.

@atoomic
Copy link
Author

atoomic commented Feb 14, 2019

going to report it, this is a convenient feature more than anything else

demerphq added a commit to demerphq/p5-encode that referenced this issue Feb 6, 2020
Fix issue Perl/perl5#17536 and
dankogai#146 and
dankogai#140 and
dankogai#143

Aliasing exposes the 'ix' variable. Since the code does not
change behavior based on the alias (which is what aliases are for)
the functions do not access the 'ix' variable, which throws
warnings. Since Encode is core they need to be fixed.

The correct solution to this is to declare the ix variable
unused by using the PERL_UNUSED_VAR(ix); macro, which
this patch does.
khwilliamson pushed a commit to khwilliamson/p5-encode that referenced this issue May 2, 2020
Fix issue Perl/perl5#17536 and
dankogai#146 and
dankogai#140 and
dankogai#143

Aliasing exposes the 'ix' variable. Since the code does not
change behavior based on the alias (which is what aliases are for)
the functions do not access the 'ix' variable, which throws
warnings. Since Encode is core they need to be fixed.

The correct solution to this is to declare the ix variable
unused by using the PERL_UNUSED_VAR(ix); macro, which
this patch does.
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

No branches or pull requests

2 participants