Commit 4cffd8c
Replace CHECK_ERROR macros with a check() helper using std::source_location
Add la::petsc::check(ierr, petsc_function), a thin wrapper around
error() that throws on a non-zero PETSc error code. Both take a
std::source_location defaulted to the call site, so error() no longer
needs a caller-supplied __FILE__ and reports the exact line, not just
the file.
Being a plain namespaced function rather than a macro, check() is
usable from header-inline code, so it also replaces the private
CHECK_ERROR macros duplicated across la/petsc.cpp, la/slepc.cpp,
fem/petsc.h, and nls/SNESSolver.cpp, and the leftover explicit
if (ierr != 0) sites in la/petsc.h and fem/petsc.cpp that those macros
couldn't reach.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 1684178 commit 4cffd8c
6 files changed
Lines changed: 199 additions & 250 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | | - | |
89 | | - | |
| 87 | + | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
| |||
0 commit comments