Skip to content

Commit

Permalink
Add support for std::exception::what etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jan 11, 2024
1 parent 6837e8f commit 06a14f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8593,6 +8593,11 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<arg nr="variadic">
</arg>
</function>
<function name="std::exception::what,std::logic_error::what,std::invalid_argument::what,std::domain_error::what,std::length_error::what,std::out_of_range::what,std::future_error::what,std::runtime_error::what,std::range_error::what,std::overflow_error::what,std::underflow_error::what,std::regex_error::what,std::system_error::what,std::ios_base::failure::what,std::filesystem::filesystem_error::what,std::nonexistent_local_time::what,std::ambiguous_local_time::what,std::format_error::what,std::bad_typeid::what,std::bad_cast::what,std::bad_any_cast::what,std::bad_optional_access::what,std::bad_expected_access::what,std::bad_weak_ptr::what,std::bad_function_call::what,std::bad_alloc::what,std::bad_array_new_length::what,std::bad_exception::what,std::ios_base::failure::what,std::bad_variant_access::what">
<noreturn>false</noreturn>
<use-retval/>
<returnValue type="const char *"/>
</function>
<memory>
<alloc init="false" buffer-size="malloc">malloc</alloc>
<alloc init="true" buffer-size="calloc">calloc</alloc>
Expand Down
7 changes: 7 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define __STDC_WANT_LIB_EXT1__ 1
#include <ctime>
#include <cwchar>
#include <exception>
#include <fstream>
#include <functional>
#ifndef __STDC_NO_THREADS__
Expand Down Expand Up @@ -924,6 +925,12 @@ void std_tie_ignoredReturnValue(int a, int b)
std::tie(a, b);
}

void std_exception_ignoredReturnValue(const std::exception& e)
{
// cppcheck-suppress ignoredReturnValue
e.what();
}

void valid_code()
{
std::vector<int> vecInt{0, 1, 2};
Expand Down

0 comments on commit 06a14f8

Please sign in to comment.