Enable a clazy CI

Starting with only missing-qobject-macro check enabled
This commit is contained in:
Albert Astals Cid 2020-01-29 14:23:48 +01:00
parent 7df8f7e215
commit dce16514fe
18 changed files with 64 additions and 0 deletions

View File

@ -11,3 +11,16 @@ build_ubuntu_18_04:
- cmake -G Ninja .. - cmake -G Ninja ..
- ninja - ninja
- ctest - ctest
build_clazy:
stage: build
image: debian:unstable
before_script:
- echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list
- apt-get update
- apt-get build-dep --yes --no-install-recommends qca2
- apt-get install --yes --no-install-recommends ninja-build libbotan-2-dev libnss3-dev libgcrypt20-dev libpkcs11-helper1-dev clazy clang
script:
- mkdir -p build && cd build
- CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja ..
- CLAZY_CHECKS="missing-qobject-macro" ninja

View File

@ -31,6 +31,7 @@
class AESCMACContext : public QCA::MACContext class AESCMACContext : public QCA::MACContext
{ {
Q_OBJECT
public: public:
AESCMACContext(QCA::Provider *p) : QCA::MACContext(p, "cmac(aes)") AESCMACContext(QCA::Provider *p) : QCA::MACContext(p, "cmac(aes)")
{ {
@ -316,3 +317,4 @@ int main(int argc, char **argv)
return 0; return 0;
} }
#include "aes-cmac.moc"

View File

@ -26,6 +26,7 @@
class TLSSocket : public QTcpSocket class TLSSocket : public QTcpSocket
{ {
Q_OBJECT
public: public:
TLSSocket(QObject *parent = nullptr); TLSSocket(QObject *parent = nullptr);
~TLSSocket(); ~TLSSocket();

View File

@ -39,6 +39,7 @@
//----------------------------------------------------------- //-----------------------------------------------------------
class botanRandomContext : public QCA::RandomContext class botanRandomContext : public QCA::RandomContext
{ {
Q_OBJECT
public: public:
botanRandomContext(QCA::Provider *p) : RandomContext(p) botanRandomContext(QCA::Provider *p) : RandomContext(p)
{ {
@ -83,6 +84,7 @@ static QString qcaHashToBotanHash(const QString &type)
//----------------------------------------------------------- //-----------------------------------------------------------
class BotanHashContext : public QCA::HashContext class BotanHashContext : public QCA::HashContext
{ {
Q_OBJECT
public: public:
BotanHashContext( QCA::Provider *p, const QString &type) : QCA::HashContext(p, type) BotanHashContext( QCA::Provider *p, const QString &type) : QCA::HashContext(p, type)
{ {
@ -147,6 +149,7 @@ static QString qcaHmacToBotanHmac(const QString &type)
//----------------------------------------------------------- //-----------------------------------------------------------
class BotanHMACContext : public QCA::MACContext class BotanHMACContext : public QCA::MACContext
{ {
Q_OBJECT
public: public:
BotanHMACContext(QCA::Provider *p, const QString &type) : QCA::MACContext(p, type) BotanHMACContext(QCA::Provider *p, const QString &type) : QCA::MACContext(p, type)
{ {
@ -218,6 +221,7 @@ static QString qcaPbkdfToBotanPbkdf(const QString &pbkdf)
//----------------------------------------------------------- //-----------------------------------------------------------
class BotanPBKDFContext: public QCA::KDFContext class BotanPBKDFContext: public QCA::KDFContext
{ {
Q_OBJECT
public: public:
BotanPBKDFContext( QCA::Provider *p, const QString &type) : QCA::KDFContext(p, type) BotanPBKDFContext( QCA::Provider *p, const QString &type) : QCA::KDFContext(p, type)
{ {
@ -295,6 +299,7 @@ static QString qcaHkdfToBotanHkdf(const QString &type)
//----------------------------------------------------------- //-----------------------------------------------------------
class BotanHKDFContext: public QCA::HKDFContext class BotanHKDFContext: public QCA::HKDFContext
{ {
Q_OBJECT
public: public:
BotanHKDFContext(QCA::Provider *p, const QString &type) : QCA::HKDFContext(p, type) BotanHKDFContext(QCA::Provider *p, const QString &type) : QCA::HKDFContext(p, type)
{ {
@ -435,6 +440,7 @@ static void qcaCipherToBotanCipher(const QString &type, std::string *algoName, s
//----------------------------------------------------------- //-----------------------------------------------------------
class BotanCipherContext : public QCA::CipherContext class BotanCipherContext : public QCA::CipherContext
{ {
Q_OBJECT
public: public:
BotanCipherContext( QCA::Provider *p, const QString &type) : QCA::CipherContext(p, type) BotanCipherContext( QCA::Provider *p, const QString &type) : QCA::CipherContext(p, type)
{ {

View File

@ -213,6 +213,7 @@ static QString addrString(const SASLContext::HostPort &hp)
class saslContext : public SASLContext class saslContext : public SASLContext
{ {
Q_OBJECT
saslProvider *g; saslProvider *g;
// core props // core props

View File

@ -44,6 +44,7 @@ void check_error( const QString &label, gcry_error_t err )
class gcryHashContext : public QCA::HashContext class gcryHashContext : public QCA::HashContext
{ {
Q_OBJECT
public: public:
gcryHashContext(int hashAlgorithm, QCA::Provider *p, const QString &type) : QCA::HashContext(p, type) gcryHashContext(int hashAlgorithm, QCA::Provider *p, const QString &type) : QCA::HashContext(p, type)
{ {
@ -93,6 +94,7 @@ protected:
class gcryHMACContext : public QCA::MACContext class gcryHMACContext : public QCA::MACContext
{ {
Q_OBJECT
public: public:
gcryHMACContext(int hashAlgorithm, QCA::Provider *p, const QString &type) : QCA::MACContext(p, type) gcryHMACContext(int hashAlgorithm, QCA::Provider *p, const QString &type) : QCA::MACContext(p, type)
{ {
@ -153,6 +155,7 @@ protected:
class gcryCipherContext : public QCA::CipherContext class gcryCipherContext : public QCA::CipherContext
{ {
Q_OBJECT
public: public:
gcryCipherContext(int algorithm, int mode, bool pad, QCA::Provider *p, const QString &type) : QCA::CipherContext(p, type) gcryCipherContext(int algorithm, int mode, bool pad, QCA::Provider *p, const QString &type) : QCA::CipherContext(p, type)
{ {
@ -271,6 +274,7 @@ protected:
class pbkdf1Context : public QCA::KDFContext class pbkdf1Context : public QCA::KDFContext
{ {
Q_OBJECT
public: public:
pbkdf1Context(int algorithm, QCA::Provider *p, const QString &type) : QCA::KDFContext(p, type) pbkdf1Context(int algorithm, QCA::Provider *p, const QString &type) : QCA::KDFContext(p, type)
{ {
@ -415,6 +419,7 @@ protected:
class pbkdf2Context : public QCA::KDFContext class pbkdf2Context : public QCA::KDFContext
{ {
Q_OBJECT
public: public:
pbkdf2Context(int algorithm, QCA::Provider *p, const QString &type) : QCA::KDFContext(p, type) pbkdf2Context(int algorithm, QCA::Provider *p, const QString &type) : QCA::KDFContext(p, type)
{ {

View File

@ -27,6 +27,7 @@ class MyKeyStoreList;
class MyKeyStoreEntry : public QCA::KeyStoreEntryContext class MyKeyStoreEntry : public QCA::KeyStoreEntryContext
{ {
Q_OBJECT
public: public:
QCA::KeyStoreEntry::Type item_type; QCA::KeyStoreEntry::Type item_type;
QCA::PGPKey pub, sec; QCA::PGPKey pub, sec;

View File

@ -25,6 +25,7 @@ namespace gpgQCAPlugin
class MyOpenPGPContext : public QCA::SMSContext class MyOpenPGPContext : public QCA::SMSContext
{ {
Q_OBJECT
public: public:
MyOpenPGPContext(QCA::Provider *p); MyOpenPGPContext(QCA::Provider *p);

View File

@ -27,6 +27,7 @@ namespace gpgQCAPlugin
class MyPGPKeyContext : public QCA::PGPKeyContext class MyPGPKeyContext : public QCA::PGPKeyContext
{ {
Q_OBJECT
public: public:
QCA::PGPKeyContextProps _props; QCA::PGPKeyContextProps _props;

View File

@ -31,6 +31,7 @@ namespace loggerQCAPlugin {
class StreamLogger : public QCA::AbstractLogDevice class StreamLogger : public QCA::AbstractLogDevice
{ {
Q_OBJECT
public: public:
StreamLogger(QTextStream &stream) : QCA::AbstractLogDevice( "Stream logger" ), _stream(stream) StreamLogger(QTextStream &stream) : QCA::AbstractLogDevice( "Stream logger" ), _stream(stream)
{ {

View File

@ -30,6 +30,7 @@
//----------------------------------------------------------- //-----------------------------------------------------------
class nssHashContext : public QCA::HashContext class nssHashContext : public QCA::HashContext
{ {
Q_OBJECT
public: public:
nssHashContext( QCA::Provider *p, const QString &type) : QCA::HashContext(p, type) nssHashContext( QCA::Provider *p, const QString &type) : QCA::HashContext(p, type)
{ {
@ -139,6 +140,7 @@ private:
//----------------------------------------------------------- //-----------------------------------------------------------
class nssHmacContext : public QCA::MACContext class nssHmacContext : public QCA::MACContext
{ {
Q_OBJECT
public: public:
nssHmacContext( QCA::Provider *p, const QString &type) : QCA::MACContext(p, type) nssHmacContext( QCA::Provider *p, const QString &type) : QCA::MACContext(p, type)
{ {
@ -273,6 +275,7 @@ private:
//----------------------------------------------------------- //-----------------------------------------------------------
class nssCipherContext : public QCA::CipherContext class nssCipherContext : public QCA::CipherContext
{ {
Q_OBJECT
public: public:
nssCipherContext( QCA::Provider *p, const QString &type) : QCA::CipherContext(p, type) nssCipherContext( QCA::Provider *p, const QString &type) : QCA::CipherContext(p, type)
{ {

View File

@ -1031,6 +1031,7 @@ EVP_PKEY *qca_d2i_PKCS8PrivateKey(const SecureArray &in, EVP_PKEY **x, pem_passw
class opensslHashContext : public HashContext class opensslHashContext : public HashContext
{ {
Q_OBJECT
public: public:
opensslHashContext(const EVP_MD *algorithm, Provider *p, const QString &type) : HashContext(p, type) opensslHashContext(const EVP_MD *algorithm, Provider *p, const QString &type) : HashContext(p, type)
{ {
@ -1084,6 +1085,7 @@ protected:
class opensslPbkdf1Context : public KDFContext class opensslPbkdf1Context : public KDFContext
{ {
Q_OBJECT
public: public:
opensslPbkdf1Context(const EVP_MD *algorithm, Provider *p, const QString &type) : KDFContext(p, type) opensslPbkdf1Context(const EVP_MD *algorithm, Provider *p, const QString &type) : KDFContext(p, type)
{ {
@ -1223,6 +1225,7 @@ protected:
class opensslPbkdf2Context : public KDFContext class opensslPbkdf2Context : public KDFContext
{ {
Q_OBJECT
public: public:
opensslPbkdf2Context(Provider *p, const QString &type) : KDFContext(p, type) opensslPbkdf2Context(Provider *p, const QString &type) : KDFContext(p, type)
{ {
@ -1283,6 +1286,7 @@ protected:
#ifdef OSSL_110 #ifdef OSSL_110
class opensslHkdfContext : public HKDFContext class opensslHkdfContext : public HKDFContext
{ {
Q_OBJECT
public: public:
opensslHkdfContext(Provider *p, const QString &type) : HKDFContext(p, type) opensslHkdfContext(Provider *p, const QString &type) : HKDFContext(p, type)
{ {
@ -1313,6 +1317,7 @@ public:
class opensslHMACContext : public MACContext class opensslHMACContext : public MACContext
{ {
Q_OBJECT
public: public:
opensslHMACContext(const EVP_MD *algorithm, Provider *p, const QString &type) : MACContext(p, type) opensslHMACContext(const EVP_MD *algorithm, Provider *p, const QString &type) : MACContext(p, type)
{ {
@ -3003,6 +3008,7 @@ static RSA *createFromExisting(const RSAPrivateKey &key)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class MyPKeyContext : public PKeyContext class MyPKeyContext : public PKeyContext
{ {
Q_OBJECT
public: public:
PKeyBase *k; PKeyBase *k;
@ -3495,6 +3501,7 @@ static bool sameChain(STACK_OF(X509) *ossl, const QList<const MyCertContext*> &q
// TODO: support read/write of multiple info values with the same name // TODO: support read/write of multiple info values with the same name
class MyCertContext : public CertContext class MyCertContext : public CertContext
{ {
Q_OBJECT
public: public:
X509Item item; X509Item item;
CertContextProps _props; CertContextProps _props;
@ -3926,6 +3933,7 @@ bool sameChain(STACK_OF(X509) *ossl, const QList<const MyCertContext*> &qca)
// Thanks to Pascal Patry // Thanks to Pascal Patry
class MyCAContext : public CAContext class MyCAContext : public CAContext
{ {
Q_OBJECT
public: public:
X509Item caCert; X509Item caCert;
MyPKeyContext *privateKey; MyPKeyContext *privateKey;
@ -4094,6 +4102,7 @@ public:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class MyCSRContext : public CSRContext class MyCSRContext : public CSRContext
{ {
Q_OBJECT
public: public:
X509Item item; X509Item item;
CertContextProps _props; CertContextProps _props;
@ -4381,6 +4390,7 @@ public:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class MyCRLContext : public CRLContext class MyCRLContext : public CRLContext
{ {
Q_OBJECT
public: public:
X509Item item; X509Item item;
CRLContextProps _props; CRLContextProps _props;
@ -4883,6 +4893,7 @@ Validity MyCertContext::validate_chain(const QList<CertContext*> &chain, const Q
class MyPKCS12Context : public PKCS12Context class MyPKCS12Context : public PKCS12Context
{ {
Q_OBJECT
public: public:
MyPKCS12Context(Provider *p) : PKCS12Context(p) MyPKCS12Context(Provider *p) : PKCS12Context(p)
{ {
@ -5551,6 +5562,7 @@ static QString cipherIDtoString( const TLS::Version &version, const unsigned lon
static bool ssl_init = false; static bool ssl_init = false;
class MyTLSContext : public TLSContext class MyTLSContext : public TLSContext
{ {
Q_OBJECT
public: public:
enum { Good, TryAgain, Bad }; enum { Good, TryAgain, Bad };
enum { Idle, Connect, Accept, Handshake, Active, Closing }; enum { Idle, Connect, Accept, Handshake, Active, Closing };
@ -6355,6 +6367,7 @@ public:
class CMSContext : public SMSContext class CMSContext : public SMSContext
{ {
Q_OBJECT
public: public:
CertificateCollection trustedCerts; CertificateCollection trustedCerts;
CertificateCollection untrustedCerts; CertificateCollection untrustedCerts;
@ -6992,6 +7005,7 @@ MessageContext *CMSContext::createMessage()
class opensslCipherContext : public CipherContext class opensslCipherContext : public CipherContext
{ {
Q_OBJECT
public: public:
opensslCipherContext(const EVP_CIPHER *algorithm, const int pad, Provider *p, const QString &type) : CipherContext(p, type) opensslCipherContext(const EVP_CIPHER *algorithm, const int pad, Provider *p, const QString &type) : CipherContext(p, type)
{ {
@ -7316,6 +7330,7 @@ public:
class opensslRandomContext : public RandomContext class opensslRandomContext : public RandomContext
{ {
Q_OBJECT
public: public:
opensslRandomContext(QCA::Provider *p) : RandomContext(p) opensslRandomContext(QCA::Provider *p) : RandomContext(p)
{ {

View File

@ -1042,6 +1042,7 @@ private:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class pkcs11PKeyContext : public PKeyContext class pkcs11PKeyContext : public PKeyContext
{ {
Q_OBJECT
private: private:
PKeyBase *_k; PKeyBase *_k;
@ -1195,6 +1196,7 @@ public:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class pkcs11KeyStoreEntryContext : public KeyStoreEntryContext class pkcs11KeyStoreEntryContext : public KeyStoreEntryContext
{ {
Q_OBJECT
private: private:
KeyStoreEntry::Type _item_type; KeyStoreEntry::Type _item_type;
KeyBundle _key; KeyBundle _key;

View File

@ -475,6 +475,7 @@ public:
class softstorePKeyContext : public PKeyContext class softstorePKeyContext : public PKeyContext
{ {
Q_OBJECT
private: private:
PKeyBase *_k; PKeyBase *_k;
@ -625,6 +626,7 @@ public:
class softstoreKeyStoreEntryContext : public KeyStoreEntryContext class softstoreKeyStoreEntryContext : public KeyStoreEntryContext
{ {
Q_OBJECT
private: private:
KeyStoreEntry::Type _item_type; KeyStoreEntry::Type _item_type;
KeyBundle _key; KeyBundle _key;

View File

@ -2124,6 +2124,7 @@ public Q_SLOTS:
class PasswordAsker::Private : public AskerPrivate class PasswordAsker::Private : public AskerPrivate
{ {
Q_OBJECT
public: public:
Private(PasswordAsker *_q) : AskerPrivate(_q) Private(PasswordAsker *_q) : AskerPrivate(_q)
{ {
@ -2185,6 +2186,7 @@ SecureArray PasswordAsker::password() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class TokenAsker::Private : public AskerPrivate class TokenAsker::Private : public AskerPrivate
{ {
Q_OBJECT
public: public:
Private(TokenAsker *_q) : AskerPrivate(_q) Private(TokenAsker *_q) : AskerPrivate(_q)
{ {

View File

@ -87,6 +87,7 @@ public:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class DefaultRandomContext : public RandomContext class DefaultRandomContext : public RandomContext
{ {
Q_OBJECT
public: public:
DefaultRandomContext(Provider *p) : RandomContext(p) {} DefaultRandomContext(Provider *p) : RandomContext(p) {}
@ -512,6 +513,7 @@ md5_finish(md5_state_t *pms, md5_byte_t digest[16])
class DefaultMD5Context : public HashContext class DefaultMD5Context : public HashContext
{ {
Q_OBJECT
public: public:
DefaultMD5Context(Provider *p) : HashContext(p, "md5") DefaultMD5Context(Provider *p) : HashContext(p, "md5")
{ {
@ -609,6 +611,7 @@ typedef union {
class DefaultSHA1Context : public HashContext class DefaultSHA1Context : public HashContext
{ {
Q_OBJECT
public: public:
SHA1_CONTEXT _context; SHA1_CONTEXT _context;
#ifdef Q_PROCESSOR_ARM #ifdef Q_PROCESSOR_ARM
@ -905,6 +908,7 @@ static bool entry_deserialize(const QString &in, QString *storeId, QString *stor
class DefaultKeyStoreEntry : public KeyStoreEntryContext class DefaultKeyStoreEntry : public KeyStoreEntryContext
{ {
Q_OBJECT
public: public:
KeyStoreEntry::Type _type; KeyStoreEntry::Type _type;
QString _id, _name, _storeId, _storeName; QString _id, _name, _storeId, _storeName;

View File

@ -75,6 +75,7 @@ static QStringList wrapstring(const QString &str, int width)
class StreamLogger : public QCA::AbstractLogDevice class StreamLogger : public QCA::AbstractLogDevice
{ {
Q_OBJECT
public: public:
StreamLogger(QTextStream &stream) : QCA::AbstractLogDevice( "Stream logger" ), _stream(stream) StreamLogger(QTextStream &stream) : QCA::AbstractLogDevice( "Stream logger" ), _stream(stream)
{ {
@ -681,6 +682,7 @@ private Q_SLOTS:
class PassphrasePromptThread : public QCA::SyncThread class PassphrasePromptThread : public QCA::SyncThread
{ {
Q_OBJECT
public: public:
PassphrasePrompt *pp; PassphrasePrompt *pp;

View File

@ -48,6 +48,7 @@ private:
class NullLogger : public QCA::AbstractLogDevice class NullLogger : public QCA::AbstractLogDevice
{ {
Q_OBJECT
public: public:
NullLogger() : QCA::AbstractLogDevice( "null logger" ) NullLogger() : QCA::AbstractLogDevice( "null logger" )
{} {}
@ -58,6 +59,7 @@ public:
class LastLogger : public QCA::AbstractLogDevice class LastLogger : public QCA::AbstractLogDevice
{ {
Q_OBJECT
public: public:
LastLogger() : QCA::AbstractLogDevice( "last logger" ) LastLogger() : QCA::AbstractLogDevice( "last logger" )
{} {}