Skip Menu |

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

Report information
The Basics
Id: 82784
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Digest-SHA

People
Owner: mshelor [...] cpan.org
Requestors: shay [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 5.81
Fixed in: 5.82



Subject: [PATCH] Compile error on Windows using VC++ in C++ mode
It can be useful to build things in C++ mode rather than plain C for extra compiler checks / warnings etc. Some people do this with the core perl distribution on Linux and other platforms, but when I try it with VC++ on Windows (by simply adding CXX_FLAG into EXTRACFLAGS in win32/Makefile), the build gets as far as Digest-SHA and then fails with the following compiler errors in Digest-SHA's src\sha[64bit].c files: cl -c -I. -nologo -GF -W3 -TP -EHsc -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -MD -Zi -DNDEBUG -O1 -DVERSION=\"5.81\" -DXS_VERSION=\"5.81\" "-I..\..\lib\CORE" -DSHA_PERL_MODULE SHA.c SHA.c c:\dev\git\perl\cpan\digest-sha\src/sha.c(89) : error C3530: 'auto' cannot be combined with any other type-specifier c:\dev\git\perl\cpan\digest-sha\src/sha.c(90) : error C2440: 'initializing' : cannot convert from 'int [16]' to 'unsigned int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\dev\git\perl\cpan\digest-sha\src/sha.c(93) : error C2440: 'initializing' : cannot convert from 'int [16]' to 'unsigned int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\dev\git\perl\cpan\digest-sha\src/sha.c(156) : error C3530: 'auto' cannot be combined with any other type-specifier c:\dev\git\perl\cpan\digest-sha\src/sha.c(158) : error C2440: 'initializing' : cannot convert from 'int [16]' to 'unsigned int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\dev\git\perl\cpan\digest-sha\src/sha.c(161) : error C2440: 'initializing' : cannot convert from 'int [16]' to 'unsigned int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\dev\git\perl\cpan\digest-sha\src\sha64bit.c(98) : error C3530: 'auto' cannot be combined with any other type-specifier c:\dev\git\perl\cpan\digest-sha\src\sha64bit.c(102) : error C2440: 'initializing' : cannot convert from '__int64 [80]' to 'unsigned __int64 *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.EXE"' : return code '0x2' Stop. Unsuccessful make(cpan/Digest-SHA): code=512 at ..\make_ext.pl line 490. NMAKE : fatal error U1077: '..\miniperl.exe' : return code '0x2' Stop. Simply providing a blank definition of SHA_STO_CLASS for VC++ (identified by _MSC_VER being #defined) fixes the problem. See the attached patch. (Not sure if the same would need doing for g++ builds on Windows too because I haven't got that working very far yet, but probably not since g++ builds work fine on Linux.)
Subject: auto.patch
diff -ruN Digest-SHA-5.81.orig/src/sha.h Digest-SHA-5.81/src/sha.h --- Digest-SHA-5.81.orig/src/sha.h 2013-01-14 12:17:10.000000000 +0000 +++ Digest-SHA-5.81/src/sha.h 2013-01-17 08:45:18.286139500 +0000 @@ -109,7 +109,11 @@ */ #if !defined(SHA_STO_CLASS) - #define SHA_STO_CLASS auto + #if defined(_MSC_VER) + #define SHA_STO_CLASS + #else + #define SHA_STO_CLASS auto + #endif #endif /* Override use of static arrays if compiling for thread-safety */
On Thu Jan 17 03:55:38 2013, SHAY wrote: Show quoted text
> It can be useful to build things in C++ mode rather than plain C for > extra compiler checks / warnings etc. Some people do this with the core > > Simply providing a blank definition of SHA_STO_CLASS for VC++ > (identified by _MSC_VER being #defined) fixes the problem. See the > attached patch.
Thanks for the patch! Actually I'm doing away with SHA_STO_CLASS in the next version. Compilers now produce code with roughly the same performance, regardless of whether the message schedule is stored as a "static" or "auto" variable. This was a kludge to begin with. But, early on, it was a useful kludge: the transforms ran 20% faster on Intels by declaring the message schedule to be static. Such is not the case anymore. BTW your patch would have needed to extend to the next clause in the header file, but there's no need to worry about that now. Mark
Fixed in 5.82. All references to SHA_STO_CLASS were removed from 5.82, so the submitted patch wasn't necessary. Mark