Skip to content

Commit

Permalink
Remove EXCEPTION_NEEDS_THROW_SPEC
Browse files Browse the repository at this point in the history
We're on C++ 20 now, we don't need this
  • Loading branch information
9999years committed Feb 2, 2024
1 parent 87dc4bc commit faaccec
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/libutil/error.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
#include <sys/stat.h>
#include <fcntl.h>

/* Before 4.7, gcc's std::exception uses empty throw() specifiers for
* its (virtual) destructor and what() in c++11 mode, in violation of spec
*/
#ifdef __GNUC__
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
#define EXCEPTION_NEEDS_THROW_SPEC
#endif
#endif

namespace nix {


Expand Down Expand Up @@ -147,13 +138,7 @@ public:
: err(e)
{ }

#ifdef EXCEPTION_NEEDS_THROW_SPEC
~BaseError() throw () { };
const char * what() const throw () { return calcWhat().c_str(); }
#else
const char * what() const noexcept override { return calcWhat().c_str(); }
#endif

const std::string & msg() const { return calcWhat(); }
const ErrorInfo & info() const { calcWhat(); return err; }

Expand Down

0 comments on commit faaccec

Please sign in to comment.