From afe1ed0445bdaf7e2eb0c870bf1a92de2eae2238 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 13 Sep 2016 20:45:30 +0200 Subject: [PATCH] Fix clang warnings about undefined variable templates in pkcspad.h Recent versions of clang warn about missing PKCS_DigestDecoration definitions, specifically the decoration members. For example: In file included from testpkcs.cpp:8: ./pkcspad.h:89:53: warning: instantiation of variable 'CryptoPP::PKCS_DigestDecoration::decoration' required here, but no definition is available [-Wundefined-var-template] return HashIdentifier(PKCS_DigestDecoration::decoration, (size_t)PKCS_DigestDecoration::length); ^ ./pubkey.h:608:19: note: in instantiation of member function 'CryptoPP::PKCS1v15_SignatureMessageEncodingMethod::HashIdentifierLookup::HashIdentifierLookup2::Lookup' requested here return L::Lookup(); ^ ./pubkey.h:638:26: note: in instantiation of member function 'CryptoPP::TF_ObjectImplBase, CryptoPP::RSAFunction>::GetHashIdentifier' requested here class CRYPTOPP_NO_VTABLE TF_ObjectImpl : public TF_ObjectImplBase ^ ./pkcspad.h:32:20: note: forward declaration of template entity is here static const byte decoration[]; ^ This is because pkcspad.h doen't contain explicit instantiation declarations for PKCS_DigestDecoration. These warnings can be fixed by adding them in the !CRYPTOPP_IS_DLL case, which appears to apply only to Windows. --- pkcspad.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkcspad.h b/pkcspad.h index a400e988..7ab98adb 100644 --- a/pkcspad.h +++ b/pkcspad.h @@ -54,6 +54,16 @@ CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +#else +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; +extern template class PKCS_DigestDecoration; #endif //! EMSA-PKCS1-v1_5