Skip to content

Commit

Permalink
Fix access and apply [[noreturn]].
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed Jan 31, 2024
1 parent 5c8a4eb commit a26c99e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/courierr/courierr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Courierr {
virtual ~Courierr() = default;

// Methods to be used in library source code
virtual void error(const std::string& message) final
[[noreturn]] virtual void error(const std::string& message) final
{
error_override(message);
throw std::runtime_error("Courierr: Error not handled by derived class: \"" + message +
Expand All @@ -23,9 +23,9 @@ class Courierr {
virtual void info(const std::string& message) final { info_override(message); }
virtual void debug(const std::string& message) final { debug_override(message); }

private:
protected:
// Virtual methods to be overridden by derived class
virtual void error_override(const std::string& message) = 0;
[[noreturn]] virtual void error_override(const std::string& message) = 0;
virtual void warning_override(const std::string& message) = 0;
virtual void info_override(const std::string& message) = 0;
virtual void debug_override(const std::string& message) = 0;
Expand Down
6 changes: 3 additions & 3 deletions test/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ClientClass {
class SimpleBaseCourier : public Courierr::Courierr {
public:
explicit SimpleBaseCourier() = default;

protected:
void error_override(const std::string& message) override
{
write_message("ERROR", message);
Expand All @@ -25,8 +27,6 @@ class SimpleBaseCourier : public Courierr::Courierr {
}
void info_override(const std::string& message) override { write_message("INFO", message); }
void debug_override(const std::string& message) override { write_message("DEBUG", message); }

protected:
virtual void write_message(const std::string& message_type, const std::string& message) = 0;
};

Expand All @@ -37,7 +37,7 @@ class ClientCourier : public SimpleBaseCourier {
{
}

private:
protected:
ClientClass* client_class_pointer;
void write_message(const std::string& message_type, const std::string& message) override
{
Expand Down

0 comments on commit a26c99e

Please sign in to comment.