When compiling a program that uses cryptopp with clang, I get the following >> warning: >> >> In file included from test.cpp: >> In file included from cryptopp/aes.h:4: >> In file included from cryptopp/rijndael.h:7: >> In file included from cryptopp/seckey.h:9: >> cryptopp/misc.h:548:20: warning: unused function 'StringNarrow' >> [-Wunused-function] >> static std::string StringNarrow(const wchar_t *str, bool throwOnError = >> true) >> ^ >> >> It looks like this function is only used by the source file 'files.cpp' - >> should it be moved there? >> >> I'm happy to submit a patch if you agree this is the solution. >> > We cleared this by adding inline to the function in the header. It > appeared to be the least intrusive way to make the change while preserving > previous intentions. > > > https://github.com/weidai11/cryptopp/commit/a0390f1fd725e37a201cc47ba47204182ebc1ccf > https://sourceforge.net/p/cryptopp/code/551/ >
I'm beginning to think that static was always incorrect. Adding 'inline' and keeping the definition (implementation) in the header meant multiple definitions existed. Multiple definitions in translation units violated the One Definition Rule (ODR). I think the way to proceed was suggested by Nate on 6/14: (1) drop static, and leave the definition in the header (2) drop static, add inline, and move the definition into a source file I missed the finer points of the ODR violation and what Nate was saying because I was chasing it from the -Wunused-function warning. We are tracking this as an Undefined Behavior bug because of the ODR violation. See http://github.com/weidai11/cryptopp/issues/127 . Jeff -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- 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.
