From d55eb917e24cfd5e4360e7682518c9f794e112b4 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Tue, 11 Aug 2015 07:17:56 +0200 Subject: [PATCH] Silence compiler warnings about unused parameters --- Local.mak.in | 2 +- lib/db_base.cpp | 4 ++-- lib/db_base.h | 3 ++- lib/func.cpp | 4 ++++ lib/main.cpp | 1 + lib/pkcs11.cpp | 6 ++++++ lib/pki_base.cpp | 1 + lib/pki_base.h | 1 + lib/pki_crl.cpp | 1 + lib/pki_evp.cpp | 5 +++++ lib/pki_temp.cpp | 1 + lib/pki_x509.cpp | 1 + lib/pki_x509req.cpp | 1 + lib/x509rev.h | 2 +- widgets/NewKey.cpp | 2 ++ widgets/TempTreeView.cpp | 2 ++ widgets/XcaTreeView.h | 5 ++++- xca.pro | 2 +- 18 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Local.mak.in b/Local.mak.in index 3b8be604..cd5ebfc2 100644 --- a/Local.mak.in +++ b/Local.mak.in @@ -6,7 +6,7 @@ export TOPDIR=@abs_srcdir@ export VERSION=@PACKAGE_VERSION@ CPPFLAGS=-DXCA_PREFIX=\"${xca_prefix}\" -DETC=\"@sysconfdir@\" -DDOCDIR=\"@docdir@\" @CXXFLAGS@ -CFLAGS=-Wall -ggdb -O2 +CFLAGS=-Wall -Wextra -O2 LIBS=@LIBS@ MOC=@QT_MOC@ diff --git a/lib/db_base.cpp b/lib/db_base.cpp index a0ccc238..536ca6b9 100644 --- a/lib/db_base.cpp +++ b/lib/db_base.cpp @@ -520,7 +520,7 @@ QVariant db_base::data(const QModelIndex &index, int role) const } return QVariant(); } -static QVariant getHeaderViewInfo(int sect, dbheader *h) +static QVariant getHeaderViewInfo(dbheader *h) { return QVariant( #if 0 @@ -541,7 +541,7 @@ QVariant db_base::headerData(int section, Qt::Orientation orientation, case Qt::DisplayRole: return QVariant(allHeaders[section]->getName()); case Qt::ToolTipRole: - return getHeaderViewInfo(section, allHeaders[section]); + return getHeaderViewInfo(allHeaders[section]); } } return QVariant(); diff --git a/lib/db_base.h b/lib/db_base.h index fb2ce66d..ecea26c7 100644 --- a/lib/db_base.h +++ b/lib/db_base.h @@ -47,6 +47,7 @@ class db_base: public QAbstractItemModel int handleBadEntry(unsigned char *p, db_header_t *head); virtual exportType::etype clipboardFormat(QModelIndexList indexes) { + (void)indexes; return exportType::Separator; } @@ -99,7 +100,7 @@ class db_base: public QAbstractItemModel colResizing--; } virtual void store(QModelIndexList indexes); - virtual void store(QModelIndex index) { }; + virtual void store(QModelIndex index) { (void)index; }; dbheaderList getAllHeaders() { return allHeaders; } diff --git a/lib/func.cpp b/lib/func.cpp index 1062bb4e..d003a554 100644 --- a/lib/func.cpp +++ b/lib/func.cpp @@ -366,6 +366,10 @@ bool _ign_openssl_error(const QString txt, const char *file, int line) #if PRINT_IGNORED_ANYWAY if (!txt.isEmpty() && ERR_peek_error()) fprintf(stderr, "%s\n", CCHAR(txt)); +#else + (void)txt; + (void)file; + (void)line; #endif while (int i = ERR_get_error() ) { errtxt = ERR_error_string(i, NULL); diff --git a/lib/main.cpp b/lib/main.cpp index fe3f4f38..866c0a97 100644 --- a/lib/main.cpp +++ b/lib/main.cpp @@ -124,6 +124,7 @@ bool XCA_application::eventFilter(QObject *watched, QEvent *ev) QStringList l; int key; + (void)watched; switch (ev->type()) { case QEvent::FileOpen: l << static_cast(ev)->file(); diff --git a/lib/pkcs11.cpp b/lib/pkcs11.cpp index 4178f505..49d51fcb 100644 --- a/lib/pkcs11.cpp +++ b/lib/pkcs11.cpp @@ -470,6 +470,9 @@ pk11_attr_data pkcs11::findUniqueID(unsigned long oclass) pk11_attr_data pkcs11::generateKey(QString name, unsigned long mech, unsigned long bits, int nid) { +#ifdef OPENSSL_NO_EC + (void)nid; +#endif CK_RV rv; CK_OBJECT_HANDLE pubkey, privkey, dsa_param_obj; pk11_attlist priv_atts, pub_atts, dsa_param; @@ -738,6 +741,7 @@ static int eng_pmeth_ctrl_rsa(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) static int eng_pmeth_ctrl_dsa(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) { + (void)p1; switch (type) { case EVP_PKEY_CTRL_MD: EVP_PKEY_CTX_set_data(ctx, NULL); @@ -758,6 +762,7 @@ static int eng_pmeth_ctrl_dsa(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) #ifndef OPENSSL_NO_EC static int eng_pmeth_ctrl_ec(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) { + (void)p1; switch (type) { case EVP_PKEY_CTRL_MD: EVP_PKEY_CTX_set_data(ctx, NULL); @@ -936,6 +941,7 @@ static int eng_pmeth_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) static int eng_meths(ENGINE *e, EVP_PKEY_METHOD **m, const int **nids, int nid) { static const int my_nids[] = { EVP_PKEY_EC, EVP_PKEY_RSA }; + (void)e; if (m) { switch (nid) { #ifndef OPENSSL_NO_EC diff --git a/lib/pki_base.cpp b/lib/pki_base.cpp index 0e26f6f8..bcf682dd 100644 --- a/lib/pki_base.cpp +++ b/lib/pki_base.cpp @@ -185,6 +185,7 @@ QVariant pki_base::column_data(dbheader *hd) QVariant pki_base::getIcon(dbheader *hd) { + (void)hd; return QVariant(); } diff --git a/lib/pki_base.h b/lib/pki_base.h index e4fb58b2..e6ca7480 100644 --- a/lib/pki_base.h +++ b/lib/pki_base.h @@ -100,6 +100,7 @@ class pki_base : public QObject } virtual BIO *pem(BIO *, int format=0) { + (void)format; return NULL; } void fwrite_ba(FILE *fp, QByteArray ba, QString fname); diff --git a/lib/pki_crl.cpp b/lib/pki_crl.cpp index cefb4716..a9fc5ca9 100644 --- a/lib/pki_crl.cpp +++ b/lib/pki_crl.cpp @@ -214,6 +214,7 @@ void pki_crl::writeCrl(const QString fname, bool pem) BIO *pki_crl::pem(BIO *b, int format) { + (void)format; if (!b) b = BIO_new(BIO_s_mem()); PEM_write_bio_X509_CRL(b, crl); diff --git a/lib/pki_evp.cpp b/lib/pki_evp.cpp index 16ffede9..c4de8c94 100644 --- a/lib/pki_evp.cpp +++ b/lib/pki_evp.cpp @@ -77,6 +77,9 @@ void pki_evp::generate(int bits, int type, QProgressBar *progress, int curve_nid { Entropy::seed_rng(); +#ifdef OPENSSL_NO_EC + (void)curve_nid; +#endif progress->setMinimum(0); progress->setMaximum(100); progress->setValue(50); @@ -232,6 +235,8 @@ static void search_ec_oid(EVP_PKEY *pkey) } EC_GROUP_free(builtin); } +#else + (void)pkey; #endif } diff --git a/lib/pki_temp.cpp b/lib/pki_temp.cpp index e87e71b4..5b5bc94a 100644 --- a/lib/pki_temp.cpp +++ b/lib/pki_temp.cpp @@ -359,6 +359,7 @@ void pki_temp::writeDefault(const QString fname) BIO *pki_temp::pem(BIO *b, int format) { + (void)format; QByteArray ba = toExportData(); if (!b) b = BIO_new(BIO_s_mem()); diff --git a/lib/pki_x509.cpp b/lib/pki_x509.cpp index eec8dbba..10de8728 100644 --- a/lib/pki_x509.cpp +++ b/lib/pki_x509.cpp @@ -585,6 +585,7 @@ void pki_x509::writeCert(const QString fname, bool PEM, bool append) BIO *pki_x509::pem(BIO *b, int format) { + (void)format; if (!b) b = BIO_new(BIO_s_mem()); PEM_write_bio_X509(b, cert); diff --git a/lib/pki_x509req.cpp b/lib/pki_x509req.cpp index f588dacd..b03dbc47 100644 --- a/lib/pki_x509req.cpp +++ b/lib/pki_x509req.cpp @@ -257,6 +257,7 @@ void pki_x509req::writeReq(const QString fname, bool pem) BIO *pki_x509req::pem(BIO *b, int format) { + (void)format; if (!b) b = BIO_new(BIO_s_mem()); PEM_write_bio_X509_REQ(b, request); diff --git a/lib/x509rev.h b/lib/x509rev.h index ae5863d2..eb87873b 100644 --- a/lib/x509rev.h +++ b/lib/x509rev.h @@ -95,7 +95,7 @@ class x509rev } X509_REVOKED *get(bool withReason=true) const { - return toREVOKED(); + return toREVOKED(withReason); } }; diff --git a/widgets/NewKey.cpp b/widgets/NewKey.cpp index 0dba2c26..0014265c 100644 --- a/widgets/NewKey.cpp +++ b/widgets/NewKey.cpp @@ -211,6 +211,8 @@ void NewKey::updateCurves(unsigned min, unsigned max, unsigned long ec_flags) curveBox->setCurrentIndex(curveBox->findText(ec_default)); if (curveBox->currentIndex() == -1) curveBox->setCurrentIndex(0); +#else + (void)min; (void)max; (void)ec_flags; #endif } diff --git a/widgets/TempTreeView.cpp b/widgets/TempTreeView.cpp index e71f47ff..a8f61a2f 100644 --- a/widgets/TempTreeView.cpp +++ b/widgets/TempTreeView.cpp @@ -15,6 +15,8 @@ void TempTreeView::fillContextMenu(QMenu *menu, QMenu *subExport, const QModelIndex &index, QModelIndexList indexes) { + (void)subExport; + (void)index; if (indexes.size() != 1) return; menu->addAction(tr("Duplicate"), this, SLOT(duplicateTemp())); diff --git a/widgets/XcaTreeView.h b/widgets/XcaTreeView.h index b310c75f..2da37f8e 100644 --- a/widgets/XcaTreeView.h +++ b/widgets/XcaTreeView.h @@ -39,7 +39,10 @@ class XcaTreeView: public QTreeView void showContextMenu(QContextMenuEvent *e, const QModelIndex &index); virtual void fillContextMenu(QMenu *menu, QMenu *subExport, - const QModelIndex &index, QModelIndexList indexes) {} + const QModelIndex &index, QModelIndexList indexes) + { + (void)menu; (void)subExport; (void)index; (void)indexes; + } void contextMenu(QContextMenuEvent *e, QMenu *parent = NULL, int sect = -1); diff --git a/xca.pro b/xca.pro index 72b4c85e..283b6ca5 100644 --- a/xca.pro +++ b/xca.pro @@ -17,7 +17,7 @@ macx { } LIBS += -lcrypto -lltdl -QMAKE_CXXFLAGS = -Wno-unused-parameters -DPREFIX=\\\"/usr/local\\\" -DETC=\\\"/etc\\\" -DDOCDIR=\\\"/usr/local/doc/xca\\\" +QMAKE_CXXFLAGS = -DPREFIX=\\\"/usr/local\\\" -DETC=\\\"/etc\\\" -DDOCDIR=\\\"/usr/local/doc/xca\\\" -Werror # Input HEADERS += local.h \