-------------------------------------------------------------------------- void func() noexcept { throw x; } void func() throw() { throw x; } void func() __attribute__((nothrow)); void func() { throw x; } --------------------------------------------------------------------------
| 282 | // void func() __attribute__((nothrow)); void func() { throw x; } |
| 283 | //-------------------------------------------------------------------------- |
| 284 | void CheckExceptionSafetyImpl::nothrowThrows() |
| 285 | { |
| 286 | logChecker("CheckExceptionSafety::nothrowThrows"); |
| 287 | |
| 288 | const SymbolDatabase* const symbolDatabase = mTokenizer->getSymbolDatabase(); |
| 289 | |
| 290 | for (const Scope * scope : symbolDatabase->functionScopes) { |
| 291 | const Function* function = scope->function; |
| 292 | if (!function) |
| 293 | continue; |
| 294 | |
| 295 | bool isNoExcept = false, isEntryPoint = false; |
| 296 | if (function->isNoExcept() || // noexcept and noexcept(true) functions |
| 297 | (function->isThrow() && !function->throwArg) || // throw() functions |
| 298 | function->isAttributeNothrow()) { // __attribute__((nothrow)) or __declspec(nothrow) functions |
| 299 | isNoExcept = true; |
| 300 | } |
| 301 | else if (mSettings.library.isentrypoint(function->name())) { |
| 302 | isEntryPoint = true; |
| 303 | } |
| 304 | if (!isNoExcept && !isEntryPoint) |
| 305 | continue; |
| 306 | |
| 307 | if (const Token* throws = functionThrows(function)) { |
| 308 | if (isEntryPoint) |
| 309 | entryPointThrowError(throws); |
| 310 | else |
| 311 | noexceptThrowError(throws); |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | void CheckExceptionSafetyImpl::noexceptThrowError(const Token * const tok) |
| 317 | { |
no test coverage detected