FaultDetection-NoexceptViolations

If a function is declared with noexcept(true) no exceptions should be thrown as this results in a call to std::terminate()

Required inputs: IR, StaticSemanticAnalysis

This check detects functions with a noexcept specification where that specification might be violated at runtime based on the exceptions that could escape from the function.

Possible Messages

Key

Text

Severity

Disabled

implicit_noexcept_spec_violation_without

Function implicitly declared noexcept(false) but no exceptions will be thrown.

None

False

noexcept_spec_violation_with

Exception violates function’s noexcept-specification.

None

False

noexcept_spec_violation_without

Function declared noexcept(false) but no exceptions will be thrown.

None

False

Options

exclude_exception_base_classes

exclude_exception_base_classes : set[bauhaus.analysis.config.QualifiedName] = set()

Exclude issues for the exception types mentioned in this set of qualified names. Also excludes classes derived from those class names as well as pointers or references to any of these class types.
 

generate_violation_path

generate_violation_path : bool = True

Whether to compute a trace for the exception. This improves the usability of the violation description, but requires additional computing which might slow down the rule.
 

ignore_constructor_destructor

ignore_constructor_destructor : bool = False

Whether to ignore escaping exceptions from constructors and destructors.
 

ignore_implicit_noexcept_spec_lambda

ignore_implicit_noexcept_spec_lambda : bool = False

Whether to ignore lambda call operator functions with implicit noexcept specifications.
 

ignore_throwing_functions

ignore_throwing_functions : bool = False

Whether to ignore noexcept specification violations on function that actually throw an exception.
 

ignore_unknown_routines

ignore_unknown_routines : bool = False

Whether to ignore extern or only declared routines.
 

report_noexcept_false_violations

report_noexcept_false_violations : bool = True

Whether to report cases where the function is declarared noexcept(false), but no exceptions are ever thrown (directly or indirectly).