1: static char help[] = "Error handling for external library call in void function.\n";
3: #include <petscsys.h>
5: int ReturnAnError(PETSC_UNUSED int dummy)
6: {
7: return 1;
8: }
10: void MakeAnError(void)
11: {
12: PetscCallExternalAbort(ReturnAnError, 0);
13: }
15: int main(int argc, char **argv)
16: {
17: PetscFunctionBeginUser;
18: PetscCall(PetscInitialize(&argc, &argv, NULL, help));
19: MakeAnError();
20: PetscCall(PetscFinalize());
21: return 0;
22: }
24: /*TEST
26: test:
27: requires: !defined(PETSCTEST_VALGRIND) defined(PETSC_USE_DEBUG) !defined(PETSC_HAVE_SANITIZER)
28: args: -petsc_ci_portable_error_output -error_output_stdout
29: filter: grep -E -v "(memory block|leaked context|not freed before MPI_Finalize|Could be the program crashed|PETSc Option Table entries|source: environment)"
31: TEST*/