Skip Menu |

This queue is for tickets about the Time-Piece CPAN distribution.

Report information
The Basics
Id: 100737
Status: resolved
Priority: 0/
Queue: Time-Piece

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

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.29_03



Subject: gcc -Wall -Wextra cleanups
Patch attached.
Subject: 0001-gcc-Wall-Wextra-cleanups.patch
From 01ed65a7ef4e9930bf01002451d9ad12a11306f9 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi <jhi@iki.fi> Date: Fri, 5 Dec 2014 21:37:25 -0500 Subject: [PATCH] gcc -Wall -Wextra cleanups. --- cpan/Time-Piece/Piece.xs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpan/Time-Piece/Piece.xs b/cpan/Time-Piece/Piece.xs index 0798b34..f60e96c 100644 --- a/cpan/Time-Piece/Piece.xs +++ b/cpan/Time-Piece/Piece.xs @@ -449,6 +449,8 @@ _strptime(pTHX_ const char *buf, const char *fmt, struct tm *tm, int *got_GMT) len; int Ealternative, Oalternative; + (void)copyright; + (void)sccsid; /* There seems to be a slightly improved version at * http://www.opensource.apple.com/source/Libc/Libc-583/stdtime/strptime-fbsd.c * which we may end up borrowing more from @@ -685,7 +687,7 @@ label: case 'A': case 'a': - for (i = 0; i < asizeof(Locale->weekday); i++) { + for (i = 0; i < (int)asizeof(Locale->weekday); i++) { if (c == 'A') { len = strlen(Locale->weekday[i]); if (strncasecmp(buf, @@ -779,7 +781,7 @@ label: case 'B': case 'b': case 'h': - for (i = 0; i < asizeof(Locale->month); i++) { + for (i = 0; i < (int)asizeof(Locale->month); i++) { if (Oalternative) { if (c == 'B') { len = strlen(Locale->alt_month[i]); @@ -1056,7 +1058,7 @@ _strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1 ** If there is a better way to make it portable, go ahead by ** all means. */ - if ((len > 0 && len < sizeof(tmpbuf)) || (len == 0 && *fmt == '\0')) + if ((len > 0 && len < (int)sizeof(tmpbuf)) || (len == 0 && *fmt == '\0')) ST(0) = sv_2mortal(newSVpv(tmpbuf, len)); else { /* Possibly buf overflowed - try again with a bigger buf */ -- 2.1.2
On Fri Dec 05 21:39:18 2014, JHI wrote: Show quoted text
> Patch attached.
Maintainers of this distribution: Could you apply either this patch or the one Dave Mitchell supplied in https://rt.cpan.org/Ticket/Display.html?id=101499 and release new version so that we can eliminate a compiler warning generated in gcc build of perl 5? Thank you very much. Jim Keenan
I believe there are actually two other people now looking to make a new dev release of Time-Piece, but since I've seen nothing going on yet, I've applied this fix in git and will cut a release soon if I hear nothing back. -- rjbs
Subject: Re: [rt.cpan.org #100737] gcc -Wall -Wextra cleanups
Date: Fri, 20 Feb 2015 08:57:37 -0500
To: bug-Time-Piece [...] rt.cpan.org
From: Jarkko Hietaniemi <jhi [...] iki.fi>
Just heard of another possible warning nit. In OS X, if building from blead (which insinuates -Wall -Wextra on you): Writing Makefile for Time::Piece cc -c -fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings -g -DVERSION=\"1.9726\" -DXS_VERSION=\"1.9726\" "-I../.." -DTIME_HIRES_NANOSLEEP -DTIME_HIRES_CLOCK -DTIME_HIRES_STAT=1 -DATLEASTFIVEOHOHFIVE HiRes.c HiRes.xs:1250:18: warning: comparison of integers of different signs: 'clock_t' (aka 'unsigned long') and 'int' [-Wsign-compare] RETVAL = clocks == -1 ? -1 : (NV)clocks / (NV)CLOCKS_PER_SEC; ~~~~~~ ^ ~~ 1 warning generated. This happens because in OS X the clocks_t (which clocks) is, is unsigned long. So this should be done instead: RETVAL = clocks == (clocks_t) -1 ? -1 : (NV)clocks / (NV)CLOCKS_PER_SEC; Verified to work with 1.9726 in OS X Yosemite, using the default cc/clang, and manually adding the -Wall -Wextra to CFLAGS. Ricardo, if you are planning a release, could you please include that? On Sun, Feb 15, 2015 at 12:47 PM, Ricardo Signes via RT <bug-Time-Piece@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=100737 > > > I believe there are actually two other people now looking to make a new dev release of Time-Piece, but since I've seen nothing going on yet, I've applied this fix in git and will cut a release soon if I hear nothing back. > > -- > rjbs
-- There is this special biologist word we use for 'stable'. It is 'dead'. -- Jack Cohen
RT-Send-CC: jhi [...] iki.fi
On Fri Feb 20 08:57:49 2015, jhi@iki.fi wrote: Show quoted text
> Just heard of another possible warning nit. In OS X, if building from > blead (which insinuates -Wall -Wextra on you): > > Writing Makefile for Time::Piece > cc -c -fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing > -pipe -fstack-protector -I/opt/local/include -Wall > -Werror=declaration-after-statement -Wextra -Wc++-compat > -Wwrite-strings -g -DVERSION=\"1.9726\" -DXS_VERSION=\"1.9726\" > "-I../.." -DTIME_HIRES_NANOSLEEP -DTIME_HIRES_CLOCK > -DTIME_HIRES_STAT=1 -DATLEASTFIVEOHOHFIVE HiRes.c > HiRes.xs:1250:18: warning: comparison of integers of different signs: > 'clock_t' (aka 'unsigned long') and 'int' [-Wsign-compare] > RETVAL = clocks == -1 ? -1 : (NV)clocks / (NV)CLOCKS_PER_SEC; > ~~~~~~ ^ ~~ > 1 warning generated. > > This happens because in OS X the clocks_t (which clocks) is, is > unsigned long. > > So this should be done instead: > > RETVAL = clocks == (clocks_t) -1 ? -1 : (NV)clocks / > (NV)CLOCKS_PER_SEC; > > Verified to work with 1.9726 in OS X Yosemite, using the default > cc/clang, and manually adding the -Wall -Wextra to CFLAGS. > > Ricardo, if you are planning a release, could you please include that? >
I assume this is related to Time::HiRes and not Time::Piece? (HiRes.xs is not found in Time::Piece).
Applied and fixed in 1.29_03.