From 266402540d4851212a5639768d1f353c90a7095e Mon Sep 17 00:00:00 2001
From: Petr Písař <ppi...@redhat.com>
Date: Aug 09 2017 15:46:16 +0000
Subject: Fix compiler warnings


---

diff --git a/Env-C-0.14-Fix-compiler-warnings.patch 
b/Env-C-0.14-Fix-compiler-warnings.patch
new file mode 100644
index 0000000..c898d76
--- /dev/null
+++ b/Env-C-0.14-Fix-compiler-warnings.patch
@@ -0,0 +1,57 @@
+From bcc4faebebe8e2d1d49783b9207cfba0d0812b31 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
+Date: Wed, 9 Aug 2017 17:40:20 +0200
+Subject: [PATCH] Fix compiler warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ C.xs | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/C.xs b/C.xs
+index 5b30d52..cf1e4fc 100644
+--- a/C.xs
++++ b/C.xs
+@@ -150,8 +150,6 @@ env_c_getallenv()
+ 
+     PREINIT:
+     int i = 0;
+-    char *p;
+-    AV *av = Nullav;
+ #ifndef __BORLANDC__
+     extern char **environ;
+ #endif
+@@ -159,7 +157,7 @@ env_c_getallenv()
+     CODE:
+     RETVAL = newAV();
+ 
+-    while ((char*)environ[i] != '\0') {
++    while ((char*)environ[i] != NULL) {
+         Perl_av_push(aTHX_ RETVAL, newSVpv((char*)environ[i++], 0));
+     }
+ 
+-- 
+2.9.4
+
diff --git a/perl-Env-C.spec b/perl-Env-C.spec
index d2cf356..47d4cea 100644
--- a/perl-Env-C.spec
+++ b/perl-Env-C.spec
@@ -1,11 +1,13 @@
 Name:           perl-Env-C
 Version:        0.14
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Get/set/unset environment variables on the C level
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Env-C/
 Source0:        
http://www.cpan.org/authors/id/M/MS/MSCHOUT/Env-C-%{version}.tar.gz
+# Fix compiler warnings, <https://github.com/mschout/env-c/pull/9>
+Patch0:         Env-C-0.14-Fix-compiler-warnings.patch
 BuildRequires:  findutils
 BuildRequires:  make
 BuildRequires:  perl-interpreter
@@ -26,6 +28,7 @@ It also can return all the environ variables.
 
 %prep
 %setup -q -n Env-C-%{version}
+%patch0 -p1
 
 %build
 perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1
@@ -47,6 +50,9 @@ make test
 %{_mandir}/man3/*
 
 %changelog
+* Wed Aug 09 2017 Petr Pisar <ppi...@redhat.com> - 0.14-5
+- Fix compiler warnings
+
 * Thu Aug 03 2017 Fedora Release Engineering <rel...@fedoraproject.org> - 
0.14-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
 


        
https://src.fedoraproject.org/rpms/perl-Env-C/c/266402540d4851212a5639768d1f353c90a7095e?branch=master
_______________________________________________
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org

Reply via email to