Skip to content

Commit

Permalink
fix(Exception): static assert to make sure that _HAS_EXCEPTIONS is set (
Browse files Browse the repository at this point in the history
  • Loading branch information
matejk committed Oct 4, 2024
1 parent aab4058 commit 8c5055c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 8 additions & 3 deletions Foundation/include/Poco/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@


#include "Poco/Foundation.h"
#include <stdexcept>

#include <exception>

namespace Poco {

Expand Down Expand Up @@ -100,9 +99,15 @@ class Foundation_API Exception: public std::exception
private:
std::string _msg;
Exception* _pNested;
int _code;
int _code;
};

#if defined(_HAS_EXCEPTIONS)
// Size of Poco::Exception depends on the exception settings (like _HAS_EXCEPTIONS)
// that might influence size of std::exception from which Poco::Exception is derived from.
// It is expected that Poco libraries and application using Poco have the same settings.
static_assert(_HAS_EXCEPTIONS != 0);
#endif

//
// inlines
Expand Down
2 changes: 0 additions & 2 deletions Foundation/src/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include "Poco/Exception.h"
#include <typeinfo>


namespace Poco {


Exception::Exception(int code): _pNested(0), _code(code)
{
}
Expand Down

0 comments on commit 8c5055c

Please sign in to comment.