Skip Menu |

This queue is for tickets about the Syntax-Keyword-Try CPAN distribution.

Report information
The Basics
Id: 118950
Status: resolved
Priority: 0/
Queue: Syntax-Keyword-Try

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.03
Fixed in: 0.04



Subject: Compilation failure on some systems
On some of my smokers I see compilation failures like this: cc -I/usr/lib/arm-linux-gnueabihf/perl/5.20/CORE -DVERSION="0.03" -DXS_VERSION="0.03" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -o lib/Syntax/Keyword/Try.o lib/Syntax/Keyword/Try.c lib/Syntax/Keyword/Try.xs: In function ‘rethread_op’: lib/Syntax/Keyword/Try.xs:143:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for(OP *kid = cUNOPx(op)->op_first; kid; kid = OpSIBLING(kid)) ^ lib/Syntax/Keyword/Try.xs:143:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code lib/Syntax/Keyword/Try.xs: In function ‘MY_walk_optree_try_in_eval’: lib/Syntax/Keyword/Try.xs:185:13: error: redeclaration of ‘kid’ with no linkage for(OP *kid = cUNOPx(op)->op_first; kid; kid = next) { ^ lib/Syntax/Keyword/Try.xs:184:9: note: previous declaration of ‘kid’ was here OP *kid, *next, *prev = NULL; ^ lib/Syntax/Keyword/Try.xs:185:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for(OP *kid = cUNOPx(op)->op_first; kid; kid = next) { ^ error building lib/Syntax/Keyword/Try.o from 'lib/Syntax/Keyword/Try.c' at /usr/share/perl/5.20/ExtUtils/CBuilder/Base.pm line 175. This happens on linux systems (with Debian/jessie and Debian/wheezy, standard C compiler) and freebsd 9 systems. Compilation is successful on my freebsd 10 system and on Mac OS X (10.11).
On Thu Nov 24 16:18:26 2016, SREZIC wrote: Show quoted text
> lib/Syntax/Keyword/Try.xs:143:5: error: ‘for’ loop initial > declarations are only allowed in C99 or C11 mode > for(OP *kid = cUNOPx(op)->op_first; kid; kid = OpSIBLING(kid)) > ^
Bah. It would be really nice if core would fix this. Make sure to pass -std=c89 when compiling with gcc, so it isn't free to pick a default that's different in different places. If we're not going to use C99, then *force* it to be C89 to pick these things up earlier. -- Paul Evans
Anyway, patch attached. -- Paul Evans
Anyway, patch attached. -- Paul Evans
Subject: rt118950.patch
=== modified file 'lib/Syntax/Keyword/Try.xs' --- lib/Syntax/Keyword/Try.xs 2016-11-24 10:24:24 +0000 +++ lib/Syntax/Keyword/Try.xs 2016-11-25 00:10:28 +0000 @@ -102,7 +102,7 @@ return op; if(warnings == pWARN_STD) - // TODO: understand what STD vs ALL means + /* TODO: understand what STD vs ALL means */ warning_bits = WARN_ALLstring; else if(warnings == pWARN_ALL) warning_bits = WARN_ALLstring; @@ -139,9 +139,11 @@ break; } - if(op->op_flags & OPf_KIDS) - for(OP *kid = cUNOPx(op)->op_first; kid; kid = OpSIBLING(kid)) + if(op->op_flags & OPf_KIDS) { + OP *kid; + for(kid = cUNOPx(op)->op_first; kid; kid = OpSIBLING(kid)) rethread_op(kid, old, new); + } } #define walk_optree_try_in_eval(op_ptr, root) MY_walk_optree_try_in_eval(aTHX_ op_ptr, root) @@ -182,7 +184,7 @@ if(op->op_flags & OPf_KIDS) { OP *kid, *next, *prev = NULL; - for(OP *kid = cUNOPx(op)->op_first; kid; kid = next) { + for(kid = cUNOPx(op)->op_first; kid; kid = next) { OP *newkid = kid; next = OpSIBLING(kid);
Released in 0.04 -- Paul Evans