Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BOOST_OVERRIDE #28

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions include/boost/contract/core/exception.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#ifndef BOOST_CONTRACT_EXCEPTION_HPP_
#define BOOST_CONTRACT_EXCEPTION_HPP_

Expand Down Expand Up @@ -96,16 +95,18 @@ class BOOST_CONTRACT_DETAIL_DECLSPEC bad_virtual_result_cast : // Copy (as str).

@b Throws: This is declared @c noexcept (or @c throw() before C++11).
*/
virtual ~bad_virtual_result_cast()
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */;
~bad_virtual_result_cast()
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */
BOOST_OVERRIDE;

/**
Description for this error (containing both from- and to- type names).

@b Throws: This is declared @c noexcept (or @c throw() before C++11).
*/
virtual char const* what() const
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */;
char const* what() const
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */
BOOST_OVERRIDE;

/** @cond */
private:
Expand Down Expand Up @@ -166,8 +167,9 @@ class BOOST_CONTRACT_DETAIL_DECLSPEC assertion_failure : // Copy (as str, etc.).

@b Throws: This is declared @c noexcept (or @c throw() before C++11).
*/
virtual ~assertion_failure()
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */;
~assertion_failure()
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */
BOOST_OVERRIDE;

/**
String describing the failed assertion.
Expand All @@ -180,8 +182,9 @@ class BOOST_CONTRACT_DETAIL_DECLSPEC assertion_failure : // Copy (as str, etc.).
File, line, and code will be omitted from this string if they were
not specified when constructing this object.
*/
virtual char const* what() const
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */;
char const* what() const
/** @cond */ BOOST_NOEXCEPT_OR_NOTHROW /** @endcond */
BOOST_OVERRIDE;

/**
Name of the file containing the assertion.
Expand Down Expand Up @@ -956,4 +959,3 @@ from_failure_handler const& set_invariant_failure(from_failure_handler const& f)
} } // namespace

#endif // #include guard

6 changes: 3 additions & 3 deletions include/boost/contract/detail/inlined/core/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ BOOST_CONTRACT_DETAIL_DECLINLINE
void assertion_failure::init() {
std::ostringstream text;
text << "assertion";
if(std::string(code_) != "") text << " \"" << code_ << "\"";
if(!std::string(code_).empty()) text << " \"" << code_ << "\"";
text << " failed";
if(std::string(file_) != "") {
if(!std::string(file_).empty()) {
text << ": file \"" << file_ << "\"";
if(line_ != 0) text << ", line " << line_;
}
Expand All @@ -101,7 +101,7 @@ namespace exception_ {

template<failure_key Key>
void default_handler() {
std::string k = "";
std::string k;
switch(Key) {
case check_failure_key: k = "check "; break;
case pre_failure_key: k = "precondition "; break;
Expand Down