aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-01-17 19:02:13 -0500
committerJack Lloyd <[email protected]>2016-01-17 19:10:33 -0500
commit6fcbd57915d7870c2782bd6e098903353e8756b0 (patch)
treec40505fbf8021819dc15d8a632a2d6fb5557f2aa
parentde22a9eda8bfb087b690feb962fae8313ee526d4 (diff)
Add missing overrides and fix -Wpedantic 'extra ;' warnings
Remove -Wsuggest-attribute=noreturn from maintainer mode flags as it seems like outside of the assertion failure macro any other suggestion would always be a false positive (an unimplemented function or the like). Or at least, if such a function needing noreturn to assist with static analysis is added in the future it will be obvious, by virtue of the static analyzer warnings which occur due to the missing noreturn preventing the analyzer from understanding code flow.
-rw-r--r--src/build-data/cc/gcc.txt2
-rw-r--r--src/cli/asn1.cpp2
-rw-r--r--src/cli/cc_enc.cpp2
-rw-r--r--src/cli/utils.cpp4
-rw-r--r--src/lib/prov/openssl/openssl_block.cpp28
-rw-r--r--src/lib/prov/openssl/openssl_hash.cpp16
-rw-r--r--src/lib/prov/openssl/openssl_rc4.cpp12
7 files changed, 33 insertions, 33 deletions
diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt
index 634b9e751..d5eff4734 100644
--- a/src/build-data/cc/gcc.txt
+++ b/src/build-data/cc/gcc.txt
@@ -8,7 +8,7 @@ add_lib_dir_option -L
add_lib_option -l
lang_flags "-std=c++11 -D_REENTRANT"
-maintainer_warning_flags "-Wold-style-cast -Werror -Wno-error=old-style-cast -Wno-error=zero-as-null-pointer-constant -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=strict-overflow -Wsuggest-override -Wsuggest-attribute=noreturn"
+maintainer_warning_flags "-Wold-style-cast -Werror -Wno-error=old-style-cast -Wno-error=zero-as-null-pointer-constant -Wno-error=unused-parameter -Wno-error=unused-variable -Wno-error=strict-overflow -Wsuggest-override"
warning_flags "-Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor"
compile_flags "-c"
diff --git a/src/cli/asn1.cpp b/src/cli/asn1.cpp
index 34e2fe870..592f363b4 100644
--- a/src/cli/asn1.cpp
+++ b/src/cli/asn1.cpp
@@ -361,7 +361,7 @@ class ASN1_Printer final : public Command
public:
ASN1_Printer() : Command("asn1print file") {}
- void go()
+ void go() override
{
Botan::DataSource_Stream in(get_arg("file"));
diff --git a/src/cli/cc_enc.cpp b/src/cli/cc_enc.cpp
index 6f19e546c..9a3256417 100644
--- a/src/cli/cc_enc.cpp
+++ b/src/cli/cc_enc.cpp
@@ -109,7 +109,7 @@ class CC_Encrypt final : public Command
public:
CC_Encrypt() : Command("cc_encrypt CC passphrase --tweak=") {}
- void go()
+ void go() override
{
const uint64_t cc_number = std::stoull(get_arg("CC"));
const std::vector<uint8_t> tweak = Botan::hex_decode(get_arg("tweak"));
diff --git a/src/cli/utils.cpp b/src/cli/utils.cpp
index 3f59ee923..199a7894f 100644
--- a/src/cli/utils.cpp
+++ b/src/cli/utils.cpp
@@ -237,7 +237,7 @@ class Generate_Bcrypt final : public Command
public:
Generate_Bcrypt() : Command("gen_bcrypt --work-factor=12 password") {}
- void go()
+ void go() override
{
const std::string password = get_arg("password");
const size_t wf = get_arg_sz("work_factor");
@@ -253,7 +253,7 @@ class Check_Bcrypt final : public Command
public:
Check_Bcrypt() : Command("check_bcrypt password hash") {}
- void go()
+ void go() override
{
const std::string password = get_arg("password");
const std::string hash = get_arg("hash");
diff --git a/src/lib/prov/openssl/openssl_block.cpp b/src/lib/prov/openssl/openssl_block.cpp
index b7d9ba7c8..c868e8977 100644
--- a/src/lib/prov/openssl/openssl_block.cpp
+++ b/src/lib/prov/openssl/openssl_block.cpp
@@ -17,34 +17,34 @@ namespace {
class OpenSSL_BlockCipher : public BlockCipher
{
public:
- void clear();
- std::string name() const { return m_cipher_name; }
- BlockCipher* clone() const;
-
- size_t block_size() const { return m_block_sz; }
-
OpenSSL_BlockCipher(const EVP_CIPHER*, const std::string&);
OpenSSL_BlockCipher(const EVP_CIPHER*, const std::string&,
size_t, size_t, size_t);
- Key_Length_Specification key_spec() const { return m_cipher_key_spec; }
-
~OpenSSL_BlockCipher();
- private:
- void encrypt_n(const byte in[], byte out[], size_t blocks) const
+
+ void clear() override;
+ std::string name() const override { return m_cipher_name; }
+ BlockCipher* clone() const override;
+
+ size_t block_size() const override { return m_block_sz; }
+
+ Key_Length_Specification key_spec() const override { return m_cipher_key_spec; }
+
+ void encrypt_n(const byte in[], byte out[], size_t blocks) const override
{
int out_len = 0;
EVP_EncryptUpdate(&m_encrypt, out, &out_len, in, blocks * m_block_sz);
}
- void decrypt_n(const byte in[], byte out[], size_t blocks) const
+ void decrypt_n(const byte in[], byte out[], size_t blocks) const override
{
int out_len = 0;
EVP_DecryptUpdate(&m_decrypt, out, &out_len, in, blocks * m_block_sz);
}
- void key_schedule(const byte[], size_t);
+ void key_schedule(const byte key[], size_t key_len) override;
size_t m_block_sz;
Key_Length_Specification m_cipher_key_spec;
@@ -169,12 +169,12 @@ make_evp_block_maker_keylen(const EVP_CIPHER* cipher, const char* algo,
#define BOTAN_REGISTER_OPENSSL_EVP_BLOCK(NAME, EVP) \
BOTAN_REGISTER_TYPE(BlockCipher, EVP_BlockCipher ## EVP, NAME, \
- make_evp_block_maker(EVP(), NAME), "openssl", BOTAN_OPENSSL_BLOCK_PRIO);
+ make_evp_block_maker(EVP(), NAME), "openssl", BOTAN_OPENSSL_BLOCK_PRIO)
#define BOTAN_REGISTER_OPENSSL_EVP_BLOCK_KEYLEN(NAME, EVP, KMIN, KMAX, KMOD) \
BOTAN_REGISTER_TYPE(BlockCipher, OpenSSL_BlockCipher ## EVP, NAME, \
make_evp_block_maker_keylen(EVP(), NAME, KMIN, KMAX, KMOD), \
- "openssl", BOTAN_OPENSSL_BLOCK_PRIO);
+ "openssl", BOTAN_OPENSSL_BLOCK_PRIO)
#if !defined(OPENSSL_NO_AES)
BOTAN_REGISTER_OPENSSL_EVP_BLOCK("AES-128", EVP_aes_128_ecb);
diff --git a/src/lib/prov/openssl/openssl_hash.cpp b/src/lib/prov/openssl/openssl_hash.cpp
index c89dd777d..574cfed91 100644
--- a/src/lib/prov/openssl/openssl_hash.cpp
+++ b/src/lib/prov/openssl/openssl_hash.cpp
@@ -17,26 +17,26 @@ namespace {
class OpenSSL_HashFunction : public HashFunction
{
public:
- void clear()
+ void clear() override
{
const EVP_MD* algo = EVP_MD_CTX_md(&m_md);
EVP_DigestInit_ex(&m_md, algo, nullptr);
}
- std::string name() const { return m_name; }
+ std::string name() const override { return m_name; }
- HashFunction* clone() const
+ HashFunction* clone() const override
{
const EVP_MD* algo = EVP_MD_CTX_md(&m_md);
return new OpenSSL_HashFunction(algo, name());
}
- size_t output_length() const
+ size_t output_length() const override
{
return EVP_MD_size(EVP_MD_CTX_md(&m_md));
}
- size_t hash_block_size() const
+ size_t hash_block_size() const override
{
return EVP_MD_block_size(EVP_MD_CTX_md(&m_md));
}
@@ -53,12 +53,12 @@ class OpenSSL_HashFunction : public HashFunction
}
private:
- void add_data(const byte input[], size_t length)
+ void add_data(const byte input[], size_t length) override
{
EVP_DigestUpdate(&m_md, input, length);
}
- void final_result(byte output[])
+ void final_result(byte output[]) override
{
EVP_DigestFinal_ex(&m_md, output, nullptr);
const EVP_MD* algo = EVP_MD_CTX_md(&m_md);
@@ -80,7 +80,7 @@ make_evp_hash_maker(const EVP_MD* md, const char* algo)
#define BOTAN_REGISTER_OPENSSL_EVP_HASH(NAME, EVP) \
BOTAN_REGISTER_TYPE(HashFunction, OpenSSL_HashFunction ## EVP, NAME, \
- make_evp_hash_maker(EVP(), NAME), "openssl", BOTAN_OPENSSL_HASH_PRIO);
+ make_evp_hash_maker(EVP(), NAME), "openssl", BOTAN_OPENSSL_HASH_PRIO)
#if !defined(OPENSSL_NO_SHA)
BOTAN_REGISTER_OPENSSL_EVP_HASH("SHA-160", EVP_sha1);
diff --git a/src/lib/prov/openssl/openssl_rc4.cpp b/src/lib/prov/openssl/openssl_rc4.cpp
index 84d739c91..79ad98ca4 100644
--- a/src/lib/prov/openssl/openssl_rc4.cpp
+++ b/src/lib/prov/openssl/openssl_rc4.cpp
@@ -21,9 +21,9 @@ namespace {
class OpenSSL_RC4 : public StreamCipher
{
public:
- void clear() { clear_mem(&m_rc4, 1); }
+ void clear() override { clear_mem(&m_rc4, 1); }
- std::string name() const
+ std::string name() const override
{
switch(m_skip)
{
@@ -36,9 +36,9 @@ class OpenSSL_RC4 : public StreamCipher
}
}
- StreamCipher* clone() const { return new OpenSSL_RC4; }
+ StreamCipher* clone() const override { return new OpenSSL_RC4; }
- Key_Length_Specification key_spec() const
+ Key_Length_Specification key_spec() const override
{
return Key_Length_Specification(1, 32);
}
@@ -46,12 +46,12 @@ class OpenSSL_RC4 : public StreamCipher
OpenSSL_RC4(size_t skip = 0) : m_skip(skip) { clear(); }
~OpenSSL_RC4() { clear(); }
private:
- void cipher(const byte in[], byte out[], size_t length)
+ void cipher(const byte in[], byte out[], size_t length) override
{
::RC4(&m_rc4, length, in, out);
}
- void key_schedule(const byte key[], size_t length)
+ void key_schedule(const byte key[], size_t length) override
{
::RC4_set_key(&m_rc4, length, key);
byte d = 0;