diff options
author | Jack Lloyd <[email protected]> | 2016-02-20 18:06:12 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-02-20 18:06:12 -0500 |
commit | 30edf16ca6fabc22f47e10b18cb1fafb62ad5a82 (patch) | |
tree | 5b65788a3efd0cb3411d88ae1eb027ad22ef27e2 /src/lib/utils | |
parent | f794b638a4059d3c004f092b6bd89d27cf4ffefa (diff) |
Avoid some Wshadows in GCC 4.8
In GCC 4.7 and 4.8, Wshadow also warns if a local variable conflicts
with a member function. This was changed in GCC 4.9 (GCC bugzilla
57709) but causes a lot of warnings on Travis which is on 4.8. Clang's
Wshadow behaves like GCC 4.9
The worst offendor was Exception's constructor argument being named
`what` which conflicts with the member function of the same name,
being in a public header this causes so many warnings the Travis log
files are truncated.
This fixes Exception and a couple of others. Fixing all cases would be
a slog that I'm not up for right at the moment.
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/exceptn.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/utils/exceptn.h b/src/lib/utils/exceptn.h index 7ac32288d..1e9cd68d5 100644 --- a/src/lib/utils/exceptn.h +++ b/src/lib/utils/exceptn.h @@ -21,12 +21,11 @@ namespace Botan { class BOTAN_DLL Exception : public std::exception { public: - Exception(const std::string& what) : m_what(what) {} - Exception(const char* prefix, const std::string& what) : m_what(std::string(prefix) + " " + what) {} - //const char* what() const override BOTAN_NOEXCEPT { return m_what.c_str(); } - const char* what() const BOTAN_NOEXCEPT override { return m_what.c_str(); } + Exception(const std::string& msg) : m_msg(msg) {} + Exception(const char* prefix, const std::string& msg) : m_msg(std::string(prefix) + " " + msg) {} + const char* what() const BOTAN_NOEXCEPT override { return m_msg.c_str(); } private: - std::string m_what; + std::string m_msg; }; /** @@ -35,8 +34,8 @@ class BOTAN_DLL Exception : public std::exception class BOTAN_DLL Invalid_Argument : public Exception { public: - Invalid_Argument(const std::string& what) : - Exception("Invalid argument", what) {} + Invalid_Argument(const std::string& msg) : + Exception("Invalid argument", msg) {} }; /** |