mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 17:58:19 +08:00
committed by
Joel Sherrill
parent
6c47d4d000
commit
3480dc3644
@@ -43,26 +43,24 @@
|
||||
|
||||
#include <rtems/error.h>
|
||||
|
||||
namespace rtems
|
||||
{
|
||||
class runtime_error :
|
||||
public std::runtime_error
|
||||
{
|
||||
const rtems_status_code sc;
|
||||
public:
|
||||
runtime_error(const rtems_status_code sc);
|
||||
runtime_error(const rtems_status_code sc, const std::string& what);
|
||||
runtime_error(const rtems_status_code sc, const char* what);
|
||||
~runtime_error();
|
||||
};
|
||||
namespace rtems {
|
||||
class runtime_error : public std::runtime_error {
|
||||
const rtems_status_code sc;
|
||||
|
||||
/**
|
||||
* Throw a rtems::runtime_error exception if the RTEMS status code is
|
||||
* not RTEMS_SUCCESSFUL.
|
||||
*/
|
||||
void runtime_error_check(const rtems_status_code sc);
|
||||
void runtime_error_check(const rtems_status_code sc, const std::string& what);
|
||||
void runtime_error_check(const rtems_status_code sc, const char* what);
|
||||
public:
|
||||
runtime_error(const rtems_status_code sc);
|
||||
runtime_error(const rtems_status_code sc, const std::string& what);
|
||||
runtime_error(const rtems_status_code sc, const char* what);
|
||||
~runtime_error();
|
||||
};
|
||||
|
||||
/**
|
||||
* Throw a rtems::runtime_error exception if the RTEMS status code is
|
||||
* not RTEMS_SUCCESSFUL.
|
||||
*/
|
||||
void runtime_error_check(const rtems_status_code sc);
|
||||
void runtime_error_check(const rtems_status_code sc, const std::string& what);
|
||||
void runtime_error_check(const rtems_status_code sc, const char* what);
|
||||
}; // namespace rtems
|
||||
|
||||
#endif
|
||||
|
||||
+417
-450
File diff suppressed because it is too large
Load Diff
@@ -27,53 +27,35 @@
|
||||
|
||||
#include <rtems/error.hpp>
|
||||
|
||||
namespace rtems
|
||||
{
|
||||
runtime_error::runtime_error(const rtems_status_code sc)
|
||||
: std::runtime_error(::rtems_status_text(sc)),
|
||||
sc(sc)
|
||||
{
|
||||
}
|
||||
namespace rtems {
|
||||
runtime_error::runtime_error(const rtems_status_code sc)
|
||||
: std::runtime_error(::rtems_status_text(sc)), sc(sc) {}
|
||||
|
||||
runtime_error::runtime_error(const rtems_status_code sc,
|
||||
const std::string& what)
|
||||
: std::runtime_error(what + ": " + ::rtems_status_text(sc)),
|
||||
sc(sc)
|
||||
{
|
||||
}
|
||||
runtime_error::runtime_error(const rtems_status_code sc,
|
||||
const std::string& what)
|
||||
: std::runtime_error(what + ": " + ::rtems_status_text(sc)), sc(sc) {}
|
||||
|
||||
runtime_error::runtime_error(const rtems_status_code sc,
|
||||
const char* what)
|
||||
runtime_error::runtime_error(const rtems_status_code sc, const char* what)
|
||||
: std::runtime_error(std::string(what) + ": " + ::rtems_status_text(sc)),
|
||||
sc(sc)
|
||||
{
|
||||
}
|
||||
sc(sc) {}
|
||||
|
||||
runtime_error::~runtime_error()
|
||||
{
|
||||
}
|
||||
runtime_error::~runtime_error() {}
|
||||
|
||||
void
|
||||
runtime_error_check(const rtems_status_code sc)
|
||||
{
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
throw runtime_error(sc);
|
||||
}
|
||||
void runtime_error_check(const rtems_status_code sc) {
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
throw runtime_error(sc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
runtime_error_check(const rtems_status_code sc, const std::string& what)
|
||||
{
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
throw runtime_error(sc, what);
|
||||
}
|
||||
void runtime_error_check(const rtems_status_code sc, const std::string& what) {
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
throw runtime_error(sc, what);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
runtime_error_check(const rtems_status_code sc, const char* what)
|
||||
{
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
throw runtime_error(sc, what);
|
||||
}
|
||||
void runtime_error_check(const rtems_status_code sc, const char* what) {
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
throw runtime_error(sc, what);
|
||||
}
|
||||
};
|
||||
}
|
||||
}; // namespace rtems
|
||||
|
||||
+256
-339
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user