Skip Menu |

This queue is for tickets about the Digest-SHA CPAN distribution.

Report information
The Basics
Id: 96090
Status: resolved
Priority: 0/
Queue: Digest-SHA

People
Owner: mshelor [...] cpan.org
Requestors: jhi [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 5.91
Fixed in: 5.92



Subject: "class" as parameter name breaks C++ builds
Date: Fri, 30 May 2014 21:57:38 -0400
To: bug-Digest-SHA [...] rt.cpan.org
From: Jarkko Hietaniemi <jhi [...] iki.fi>
Perl itself builds with C++, and CPAN modules often do, too. But Digest::SHA 5.91 cannot: ... SV * newSHA(class, alg) char * class int alg The "class" parameter kills C++ (e.g. g++) builds pretty fast. Please consider renaming the parameter. (This came up as we tried to refresh the Digest::SHA to be included in Perl 5.21.1, among other core modules.)
http://www.nntp.perl.org/group/perl.perl5.porters/2014/05/msg215981.html The patch that was appended in the original mail was the following (patch follows inline AND attached): Show quoted text
>From 9f281db9a230ea74fa453d91e4e2a02d937f6a46 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org> Date: Wed, 28 May 2014 19:34:45 -0600 Subject: [PATCH 53/53] Digest-SHA::SHA: Fix C++ compile problem by not using a C++ reserved-word as a formal parameter name --- cpan/Digest-SHA/SHA.xs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpan/Digest-SHA/SHA.xs b/cpan/Digest-SHA/SHA.xs index 7200a62..ce2d11a 100644 --- a/cpan/Digest-SHA/SHA.xs +++ b/cpan/Digest-SHA/SHA.xs @@ -66,8 +66,8 @@ shawrite(bitstr, bitcnt, s) SHA * s SV * -newSHA(class, alg) - char * class +newSHA(type, alg) + char * type int alg PREINIT: SHA *state; @@ -78,7 +78,7 @@ CODE: XSRETURN_UNDEF; } RETVAL = newSV(0); - sv_setref_pv(RETVAL, class, (void *) state); + sv_setref_pv(RETVAL, type, (void *) state); SvREADONLY_on(SvRV(RETVAL)); OUTPUT: RETVAL -- 1.9.1
Subject: 0053-Digest-SHA-SHA-Fix-C-compile-problem.patch
>From 9f281db9a230ea74fa453d91e4e2a02d937f6a46 Mon Sep 17 00:00:00 2001 From: Karl Williamson <khw@cpan.org> Date: Wed, 28 May 2014 19:34:45 -0600 Subject: [PATCH 53/53] Digest-SHA::SHA: Fix C++ compile problem by not using a C++ reserved-word as a formal parameter name --- cpan/Digest-SHA/SHA.xs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpan/Digest-SHA/SHA.xs b/cpan/Digest-SHA/SHA.xs index 7200a62..ce2d11a 100644 --- a/cpan/Digest-SHA/SHA.xs +++ b/cpan/Digest-SHA/SHA.xs @@ -66,8 +66,8 @@ shawrite(bitstr, bitcnt, s) SHA * s SV * -newSHA(class, alg) - char * class +newSHA(type, alg) + char * type int alg PREINIT: SHA *state; @@ -78,7 +78,7 @@ CODE: XSRETURN_UNDEF; } RETVAL = newSV(0); - sv_setref_pv(RETVAL, class, (void *) state); + sv_setref_pv(RETVAL, type, (void *) state); SvREADONLY_on(SvRV(RETVAL)); OUTPUT: RETVAL -- 1.9.1
On Fri May 30 22:52:09 2014, ANDK wrote: Show quoted text
> http://www.nntp.perl.org/group/perl.perl5.porters/2014/05/msg215981.html > > The patch that was appended in the original mail was the following > (patch follows inline AND attached): >
> > From 9f281db9a230ea74fa453d91e4e2a02d937f6a46 Mon Sep 17 00:00:00 > > 2001
> From: Karl Williamson <khw@cpan.org> > Date: Wed, 28 May 2014 19:34:45 -0600 > Subject: [PATCH 53/53] Digest-SHA::SHA: Fix C++ compile problem > > by not using a C++ reserved-word as a formal parameter name > --- > cpan/Digest-SHA/SHA.xs | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/cpan/Digest-SHA/SHA.xs b/cpan/Digest-SHA/SHA.xs > index 7200a62..ce2d11a 100644 > --- a/cpan/Digest-SHA/SHA.xs > +++ b/cpan/Digest-SHA/SHA.xs > @@ -66,8 +66,8 @@ shawrite(bitstr, bitcnt, s) > SHA * s > > SV * > -newSHA(class, alg) > - char * class > +newSHA(type, alg) > + char * type > int alg > PREINIT: > SHA *state; > @@ -78,7 +78,7 @@ CODE: > XSRETURN_UNDEF; > } > RETVAL = newSV(0); > - sv_setref_pv(RETVAL, class, (void *) state); > + sv_setref_pv(RETVAL, type, (void *) state); > SvREADONLY_on(SvRV(RETVAL)); > OUTPUT: > RETVAL
Thanks. Using 'type' in lieu of 'class' is nice and compact, but potentially confusing when scanning this routine out of context. I plan to use 'classname' instead of 'class' in the next Digest::SHA release. This variable name is less ambiguous and also mimics the conventions adopted by perlapi (ref. sv_setrev_pv). Mark
Fixed in 5.92.