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

Fix compiler warnings #9

Closed
wants to merge 1 commit into from
Closed

Conversation

ppisar
Copy link

@ppisar ppisar commented Aug 9, 2017

GCC 7.1.1 produces these warnings:

gcc -c -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -DVERSION="0.14" -DXS_VERSION="0.14" -fPIC "-I/usr/lib64/perl5/CORE" C.c
C.xs: In function ‘XS_Env__C_getallenv’:
C.xs:162:30: warning: comparison between pointer and zero character constant [-Wpointer-compare]
while ((char*)environ[i] != '\0') {
^~
C.xs:162:12: note: did you mean to dereference the pointer?
while ((char*)environ[i] != '\0') {
^
C.xs:154:9: warning: unused variable ‘av’ [-Wunused-variable]
AV *av = Nullav;
^~
C.xs:153:11: warning: unused variable ‘p’ [-Wunused-variable]
char *p;
^

This patch fixes it.

GCC 7.1.1 produces these warnings:

gcc -c   -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"0.14\" -DXS_VERSION=\"0.14\" -fPIC "-I/usr/lib64/perl5/CORE"   C.c
C.xs: In function ‘XS_Env__C_getallenv’:
C.xs:162:30: warning: comparison between pointer and zero character constant [-Wpointer-compare]
     while ((char*)environ[i] != '\0') {
                              ^~
C.xs:162:12: note: did you mean to dereference the pointer?
     while ((char*)environ[i] != '\0') {
            ^
C.xs:154:9: warning: unused variable ‘av’ [-Wunused-variable]
     AV *av = Nullav;
         ^~
C.xs:153:11: warning: unused variable ‘p’ [-Wunused-variable]
     char *p;
           ^

This patch fixes it.
@mschout
Copy link
Owner

mschout commented Aug 11, 2017

Thanks. I pushed this to the master branch, will be in v0.15 shortly.

@mschout mschout closed this Aug 11, 2017
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