Changeset 4fba7ad in mainline


Ignore:
Timestamp:
2018-07-05T21:41:23Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4dfac1e
Parents:
a1c35cc
git-author:
Dzejrou <dzejrou@…> (2018-05-14 19:27:36)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:23)
Message:

cpp: moved system_error what logic to runtime_error

Location:
uspace/lib/cpp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/impl/system_error.hpp

    ra1c35cc r4fba7ad  
    3131
    3232#include <internal/aux.hpp>
     33#include <internal/stringfwd.hpp>
    3334#include <stdexcept>
    3435
     
    340341            const error_code& code() const noexcept;
    341342
    342             const char* what() const noexcept override;
    343 
    344343        private:
    345344            error_code code_;
    346             string what_;
    347345    };
    348346
  • uspace/lib/cpp/src/system_error.cpp

    ra1c35cc r4fba7ad  
    2727 */
    2828
     29#include <cstring>
    2930#include <functional>
    3031#include <string>
     
    263264
    264265    system_error::system_error(error_code ec, const string& what_arg)
    265         : code_{ec}, what_{what_arg}
     266        : runtime_error{what_arg.c_str()}, code_{ec}
    266267    { /* DUMMY BODY */ }
    267268
    268269    system_error::system_error(error_code ec, const char* what_arg)
    269         : code_{ec}, what_{what_arg}
     270        : runtime_error{what_arg}, code_{ec}
    270271    { /* DUMMY BODY */ }
    271272
    272273    system_error::system_error(error_code ec)
    273         : code_{ec}, what_{}
     274        : runtime_error{"system_error"}, code_{ec}
    274275    { /* DUMMY BODY */ }
    275276
    276277    system_error::system_error(int code, const error_category& cat,
    277278                               const string& what_arg)
    278         : code_{code, cat}, what_{what_arg}
     279        : runtime_error{what_arg.c_str()}, code_{code, cat}
    279280    { /* DUMMY BODY */ }
    280281
    281282    system_error::system_error(int code, const error_category& cat,
    282283                               const char* what_arg)
    283         : code_{code, cat}, what_{what_arg}
     284        : runtime_error{what_arg}, code_{code, cat}
    284285    { /* DUMMY BODY */ }
    285286
    286287    system_error::system_error(int code, const error_category& cat)
    287         : code_{code, cat}, what_{}
     288        : runtime_error{"system_error"}, code_{code, cat}
    288289    { /* DUMMY BODY */ }
    289290
     
    292293        return code_;
    293294    }
    294 
    295     const char* system_error::what() const noexcept
    296     {
    297         return what_.c_str();
    298     }
    299295}
Note: See TracChangeset for help on using the changeset viewer.