diff --git a/common/type_system/TypeSystem.h b/common/type_system/TypeSystem.h index d866804db..71a865588 100644 --- a/common/type_system/TypeSystem.h +++ b/common/type_system/TypeSystem.h @@ -76,7 +76,7 @@ class TypeSystem { auto x = lookup_type(type_name); T* result = dynamic_cast(x); if (!result) { - throw std::runtime_error("Failed to get the right type"); + throw std::runtime_error("Failed to get " + type_name + " as the right type"); } return result; } diff --git a/decompiler/util/FileIO.cpp b/decompiler/util/FileIO.cpp index 9a7dd7224..914d647d5 100644 --- a/decompiler/util/FileIO.cpp +++ b/decompiler/util/FileIO.cpp @@ -16,7 +16,7 @@ std::string combine_path(const std::string& parent, const std::string& child) { std::vector read_binary_file(const std::string& filename) { auto fp = fopen(filename.c_str(), "rb"); - if(!fp) throw std::runtime_error("File cannot be opened"); + if(!fp) throw std::runtime_error("File " + filename + " cannot be opened"); fseek(fp, 0, SEEK_END); auto len = ftell(fp); rewind(fp); @@ -25,7 +25,7 @@ std::vector read_binary_file(const std::string& filename) { data.resize(len); if(fread(data.data(), len, 1, fp) != 1) { - throw std::runtime_error("File cannot be read"); + throw std::runtime_error("File " + filename + " cannot be read"); } return data; diff --git a/decompiler/util/Timer.cpp b/decompiler/util/Timer.cpp index 0a5d89506..4ac44ab25 100644 --- a/decompiler/util/Timer.cpp +++ b/decompiler/util/Timer.cpp @@ -48,7 +48,7 @@ int64_t Timer::getNs() { clock_gettime(CLOCK_MONOTONIC, &now); #elif _WIN32 clock_gettime_monotonic(&now); -#endif; +#endif return (int64_t)(now.tv_nsec - _startTime.tv_nsec) + 1000000000 * (now.tv_sec - _startTime.tv_sec); -} \ No newline at end of file +} diff --git a/decompiler/util/Timer.h b/decompiler/util/Timer.h index c589657a0..597202033 100644 --- a/decompiler/util/Timer.h +++ b/decompiler/util/Timer.h @@ -19,8 +19,6 @@ class Timer { int clock_gettime_monotonic(struct timespec* tv); #endif - - /*! * Start the timer */ @@ -29,7 +27,7 @@ class Timer { /*! * Get milliseconds elapsed */ - double getMs() { return (double)getNs() / 1.e6; } + double getMs() { return (double)getNs() / 1.e6; } double getUs() { return (double)getNs() / 1.e3; } diff --git a/goalc/goos/Interpreter.cpp b/goalc/goos/Interpreter.cpp index e98f0df66..f37ba8c1e 100644 --- a/goalc/goos/Interpreter.cpp +++ b/goalc/goos/Interpreter.cpp @@ -97,7 +97,7 @@ void Interpreter::disable_printfs() { */ void Interpreter::load_goos_library() { auto cmd = "(load-file \"goalc/gs/goos-lib.gs\")"; - eval_with_rewind(reader.read_from_string(cmd), global_environment.as_env()); + eval_with_rewind(reader.read_from_string(cmd), global_environment.as_env()); } /*! @@ -137,8 +137,8 @@ void Interpreter::execute_repl() { * for debugging. */ void Interpreter::throw_eval_error(const Object& o, const std::string& err) { - throw std::runtime_error("[GOOS] Evaluation error on " + o.print() + ": " + err + "\n" + - reader.db.get_info_for(o)); + throw std::runtime_error("[GOOS] Evaluation error on " + o.print() + ": " + err + "\n" + + reader.db.get_info_for(o)); } /*! @@ -918,4 +918,4 @@ Object Interpreter::eval_while(const Object& form, return rv; } -} // namespace goos \ No newline at end of file +} // namespace goos diff --git a/goalc/goos/Object.cpp b/goalc/goos/Object.cpp index f2f0dfd62..1023ff358 100644 --- a/goalc/goos/Object.cpp +++ b/goalc/goos/Object.cpp @@ -151,7 +151,7 @@ bool Object::operator==(const Object& other) const { } default: - throw std::runtime_error("equality not implemented for"); + throw std::runtime_error("equality not implemented for " + print()); } } diff --git a/goalc/goos/Object.h b/goalc/goos/Object.h index 6381b3ed2..926014bc6 100644 --- a/goalc/goos/Object.h +++ b/goalc/goos/Object.h @@ -222,7 +222,7 @@ class Object { std::shared_ptr as_pair() const { if (type != ObjectType::PAIR) { - throw std::runtime_error("as_pair called on a " + object_type_to_string(type) + " " + + throw std::runtime_error("as_pair called on a " + object_type_to_string(type) + " " + print()); } return std::dynamic_pointer_cast(heap_obj); @@ -246,7 +246,7 @@ class Object { std::shared_ptr as_string() const { if (type != ObjectType::STRING) { throw std::runtime_error("as_string called on a " + object_type_to_string(type) + " " + - print()); + print()); } return std::dynamic_pointer_cast(heap_obj); } @@ -269,7 +269,7 @@ class Object { std::shared_ptr as_array() const { if (type != ObjectType::ARRAY) { - throw std::runtime_error("as_array called on a " + object_type_to_string(type) + " " + + throw std::runtime_error("as_array called on a " + object_type_to_string(type) + " " + print()); } return std::dynamic_pointer_cast(heap_obj); @@ -284,7 +284,7 @@ class Object { FloatType& as_float() { if (type != ObjectType::FLOAT) { - throw std::runtime_error("as_float called on a " + object_type_to_string(type) + " " + + throw std::runtime_error("as_float called on a " + object_type_to_string(type) + " " + print()); } return float_obj.value; diff --git a/goalc/goos/Reader.cpp b/goalc/goos/Reader.cpp index d39cbe5ce..f4b4ec73d 100644 --- a/goalc/goos/Reader.cpp +++ b/goalc/goos/Reader.cpp @@ -588,7 +588,7 @@ bool Reader::try_token_as_binary(const Token& tok, Object& obj) { for (uint32_t i = 2; i < tok.text.size(); i++) { if (value & (0x8000000000000000)) { - throw std::runtime_error("overflow in binary constant:)"); + throw std::runtime_error("overflow in binary constant: " + tok.text); } value <<= 1u; @@ -628,7 +628,7 @@ bool Reader::try_token_as_hex(const Token& tok, Object& obj) { obj = Object::make_integer(v); return true; } catch (std::exception& e) { - throw std::runtime_error("The number cannot be a hexadecimal constant"); + throw std::runtime_error("The number " + tok.text + " cannot be a hexadecimal constant"); } } return false; @@ -662,7 +662,7 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) { obj = Object::make_integer(v); return true; } catch (std::exception& e) { - throw std::runtime_error("The number cannot be an integer constant"); + throw std::runtime_error("The number " + tok.text + " cannot be an integer constant"); } } return false; @@ -697,7 +697,8 @@ bool Reader::try_token_as_char(const Token& tok, Object& obj) { * Used for reader errors, like "missing close paren" or similar. */ void Reader::throw_reader_error(TextStream& here, const std::string& err, int seek_offset) { - throw std::runtime_error("Reader error at"); + throw std::runtime_error("Reader error:\n" + err + "\nat " + + db.get_info_for(here.text, here.seek + seek_offset)); } /*! @@ -706,4 +707,4 @@ void Reader::throw_reader_error(TextStream& here, const std::string& err, int se std::string Reader::get_source_dir() { return source_dir; } -} // namespace goos \ No newline at end of file +} // namespace goos diff --git a/goalc/util/file_io.cpp b/goalc/util/file_io.cpp index b659ed7bc..d6b35e173 100644 --- a/goalc/util/file_io.cpp +++ b/goalc/util/file_io.cpp @@ -7,7 +7,7 @@ namespace util { std::string read_text_file(const std::string& path) { std::ifstream file(path); if (!file.good()) { - throw std::runtime_error("couldn't open "); + throw std::runtime_error("couldn't open " + path); } std::stringstream ss; ss << file.rdbuf(); diff --git a/test/all_jak1_symbols.cpp b/test/all_jak1_symbols.cpp index e0089acc8..9004c7089 100644 --- a/test/all_jak1_symbols.cpp +++ b/test/all_jak1_symbols.cpp @@ -7748,7 +7748,7 @@ const char* all_syms[7941] = {"ripple-for-lava", "list-control", "sunken-pipegame-idle", "anim-test-edit-seq-insert-item", - "anim-tester-interfaces", + "anim-tester-interface", "anim-tester-adjust-frame", "extra-radius", "*volume-descriptor*", diff --git a/third-party/fmt/format-inl.h b/third-party/fmt/format-inl.h index c379681be..d8c9c8a5e 100644 --- a/third-party/fmt/format-inl.h +++ b/third-party/fmt/format-inl.h @@ -227,7 +227,7 @@ FMT_FUNC void system_error::init(int err_code, string_view format_str, memory_buffer buffer; format_system_error(buffer, err_code, vformat(format_str, args)); std::runtime_error& base = *this; -// base = std::runtime_error(to_string(buffer)); + base = std::runtime_error(to_string(buffer)); } namespace detail { diff --git a/third-party/fmt/format.h b/third-party/fmt/format.h index a778ce376..17509b7b4 100644 --- a/third-party/fmt/format.h +++ b/third-party/fmt/format.h @@ -713,8 +713,8 @@ FMT_CLASS_API class FMT_API format_error : public std::runtime_error { public: explicit format_error(const char* message) : std::runtime_error(message) {} - explicit format_error(const std::string& message); - // : std::runtime_error(message) {} + explicit format_error(const std::string& message) + : std::runtime_error(message) {} format_error(const format_error&) = default; format_error& operator=(const format_error&) = default; format_error(format_error&&) = default; diff --git a/third-party/json.hpp b/third-party/json.hpp index 740e9f12a..b37b2a5f1 100644 --- a/third-party/json.hpp +++ b/third-party/json.hpp @@ -70,7 +70,7 @@ SOFTWARE. #include // exception -#include // exception +#include // runtime_error #include // to_string // #include @@ -92,7 +92,7 @@ struct position_t /// the number of lines read std::size_t lines_read = 0; - /// conversion to size_t to preserve SAX interfaces + /// conversion to size_t to preserve SAX interface constexpr operator size_t() const { return chars_read_total; @@ -2324,7 +2324,7 @@ namespace detail /*! @brief general exception of the @ref basic_json class -This class is an extension of `std::runtime_error` objects with a member @a id for +This class is an extension of `std::exception` objects with a member @a id for exception ids. It is used as the base class for all exceptions thrown by the @ref basic_json class. This class can hence be used as "wildcard" to catch exceptions. @@ -2349,7 +2349,7 @@ caught.,exception} @since version 3.0.0 */ -class exception : public std::runtime_error +class exception : public std::exception { public: /// returns the explanatory string @@ -4823,7 +4823,7 @@ class input_stream_adapter std::char_traits::int_type get_character() { auto res = sb->sbumpc(); - // set eof manually, as we don't use the istream interfaces. + // set eof manually, as we don't use the istream interface. if (JSON_HEDLEY_UNLIKELY(res == EOF)) { is->clear(is->rdstate() | std::ios::eofbit); @@ -5191,9 +5191,9 @@ namespace nlohmann { /*! -@brief SAX interfaces +@brief SAX interface -This class describes the SAX interfaces used by @ref nlohmann::json::sax_parse. +This class describes the SAX interface used by @ref nlohmann::json::sax_parse. Each function is called in different situations while the input is parsed. The boolean return value informs the parser whether to continue processing the input. @@ -5314,7 +5314,7 @@ namespace detail /*! @brief SAX implementation to create a JSON value from SAX events -This class implements the @ref json_sax interfaces and processes the SAX events +This class implements the @ref json_sax interface and processes the SAX events to create a JSON value which makes it basically a DOM parser. The structure or hierarchy of the JSON value is managed by the stack `ref_stack` which contains a pointer to the respective array or object for each recursion depth. @@ -7198,7 +7198,7 @@ scan_number_done: /* @brief get next character from the input - This function provides the interfaces to the used input adapter. It does + This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a `std::char_traits::eof()` in that case. Stores the scanned characters for use in error messages. @@ -9881,7 +9881,7 @@ class binary_reader /*! @brief get next character from the input - This function provides the interfaces to the used input adapter. It does + This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a -'ve valued `std::char_traits::eof()` in that case. @@ -10184,7 +10184,7 @@ class parser } /*! - @brief public parser interfaces + @brief public parser interface @param[in] strict whether to expect the last token to be EOF @param[in,out] result parsed JSON value @@ -10249,7 +10249,7 @@ class parser } /*! - @brief public accept interfaces + @brief public accept interface @param[in] strict whether to expect the last token to be EOF @return whether the input is a proper JSON text @@ -12628,7 +12628,7 @@ namespace nlohmann { namespace detail { -/// abstract output adapter interfaces +/// abstract output adapter interface template struct output_adapter_protocol { virtual void write_character(CharType c) = 0; @@ -12636,7 +12636,7 @@ template struct output_adapter_protocol virtual ~output_adapter_protocol() = default; }; -/// a type to simplify interfaces +/// a type to simplify interface template using output_adapter_t = std::shared_ptr>; @@ -16724,7 +16724,7 @@ class basic_json using initializer_list_t = std::initializer_list>; using input_format_t = detail::input_format_t; - /// SAX interfaces type, see @ref nlohmann::json_sax + /// SAX interface type, see @ref nlohmann::json_sax using json_sax_t = json_sax; //////////////// @@ -21253,7 +21253,7 @@ class basic_json element as string (see example). @param[in] ref reference to a JSON value - @return iteration proxy object wrapping @a ref with an interfaces to use in + @return iteration proxy object wrapping @a ref with an interface to use in range-based for loops @liveexample{The following code shows how the wrapper is used,iterator_wrapper} @@ -21341,7 +21341,7 @@ class basic_json for more information. - @return iteration proxy object wrapping @a ref with an interfaces to use in + @return iteration proxy object wrapping @a ref with an interface to use in range-based for loops @liveexample{The following code shows how the function is used.,items} @@ -23249,7 +23249,7 @@ class basic_json /*! @brief generate SAX events - The SAX event lister must follow the interfaces of @ref json_sax. + The SAX event lister must follow the interface of @ref json_sax. This function reads from a compatible input. Examples are: - an std::istream object diff --git a/third-party/minilzo/lzoconf.h b/third-party/minilzo/lzoconf.h index a8ffb99ef..f9a8bdbee 100644 --- a/third-party/minilzo/lzoconf.h +++ b/third-party/minilzo/lzoconf.h @@ -264,7 +264,7 @@ typedef int const lzo_bytep dict, lzo_uint dict_len ); -/* Callback interfaces. Currently only the progress indicator ("nprogress") +/* Callback interface. Currently only the progress indicator ("nprogress") * is used, but this may change in a future release. */ struct lzo_callback_t;