On Wednesday, 25 April 2018 07:36:21 UTC+1, Andrew Marlow wrote:
>
> Hello everyone,
>
> I am using cryptopp610 on windows 10 with the Visual Studio 2017 (aka 
> vc15) compiler. All is well regarding the built library but I have run into 
> a problem when I put our code through the clang-tidy static analyser. It 
> complains about stuff in the cryptopp610 headers. The full report is below. 
> I am trying to make it so that the results of the static code analysis are 
> as clean as possible. A few of the third party libraries in use are 
> hampering this, including cryptopp. Can someone take a look please? I am 
> using the latest clang-tidy from LLVM v6.0.0 released a few days ago.
>
>
> C:/ThirdPartyLibs2017/cryptopp610/emsa2.h:62:42: error: explicit 
> specialization of 'id' after instantiation [clang-diagnostic-error]
> template<> const byte EMSA2HashId<SHA1>::id;
>                                          ^
> C:/ThirdPartyLibs2017/cryptopp610/emsa2.h:52:29: note: explicit 
> instantiation first required here
> CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA1>;
>

Just considering this issue, I see from the header that the code has been 
added in response to reports about clang issues. The bug reports are 
https://github.com/weidai11/cryptopp/issues/300 and 
https://github.com/weidai11/cryptopp/issues/533. I appreciate the fact that 
developers are trying to get the cryptopp code clean for clang-tidy but it 
looks like there is still an issue. Here is the code:

#ifdef CRYPTOPP_IS_DLL
CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA1>;
CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA224>;
CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA256>;
CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA384>;
CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA512>;
#endif

// https://github.com/weidai11/cryptopp/issues/300 and
// https://github.com/weidai11/cryptopp/issues/533
#if defined(__clang__)
template<> const byte EMSA2HashId<SHA1>::id;
template<> const byte EMSA2HashId<SHA224>::id;
template<> const byte EMSA2HashId<SHA256>::id;
template<> const byte EMSA2HashId<SHA384>::id;
template<> const byte EMSA2HashId<SHA512>::id;
#endif

The macro CRYPTOPP_DLL_TEMPLATE_CLASS expands to template class, hence we 
really have a case of explicit specialization of 'id' after instantiation.



-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to