-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw exceptions through wrapper to handle platforms without exceptions
Just log and abort on such platforms.
- Loading branch information
Showing
4 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
// This is copyrighted software. More information is at the end of this file. | ||
#pragma once | ||
|
||
#include "aulib_config.h" | ||
#include "aulib_export.h" | ||
|
||
#if not HAVE_EXCEPTIONS | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#include <exception> | ||
#endif | ||
|
||
namespace Aulib { | ||
namespace priv { | ||
|
||
template <typename Exception> | ||
[[noreturn]] void throw_(Exception&& e) | ||
{ | ||
#if HAVE_EXCEPTIONS | ||
throw e; | ||
#else | ||
std::fprintf(stderr, "exception: %s\n", e.what()); | ||
std::abort(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
realnc
Author
Owner
|
||
#endif | ||
} | ||
|
||
} // namespace priv | ||
} // namespace Aulib | ||
|
||
/* | ||
Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019 Nikos Chantziaras. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This should probably be
std::exit(1)
becausestd::abort
skipsatexit
handlers