xref: /petsc/include/petscerror.h (revision 60a1b3afd779eccf5fbace1d4ebce5aca36800a9)
1 /*
2     Contains all error handling interfaces for PETSc.
3 */
4 #if !defined(PETSCERROR_H)
5 #define PETSCERROR_H
6 
7 /*
8      These are the generic error codes. These error codes are used
9      many different places in the PETSc source code. The string versions are
10      at src/sys/error/err.c any changes here must also be made there
11      These are also define in src/sys/f90-mod/petscerror.h any CHANGES here
12      must be also made there.
13 
14 */
15 #define PETSC_ERR_MIN_VALUE        54   /* should always be one less then the smallest value */
16 
17 #define PETSC_ERR_MEM              55   /* unable to allocate requested memory */
18 #define PETSC_ERR_SUP              56   /* no support for requested operation */
19 #define PETSC_ERR_SUP_SYS          57   /* no support for requested operation on this computer system */
20 #define PETSC_ERR_ORDER            58   /* operation done in wrong order */
21 #define PETSC_ERR_SIG              59   /* signal received */
22 #define PETSC_ERR_FP               72   /* floating point exception */
23 #define PETSC_ERR_COR              74   /* corrupted PETSc object */
24 #define PETSC_ERR_LIB              76   /* error in library called by PETSc */
25 #define PETSC_ERR_PLIB             77   /* PETSc library generated inconsistent data */
26 #define PETSC_ERR_MEMC             78   /* memory corruption */
27 #define PETSC_ERR_CONV_FAILED      82   /* iterative method (KSP or SNES) failed */
28 #define PETSC_ERR_USER             83   /* user has not provided needed function */
29 #define PETSC_ERR_SYS              88   /* error in system call */
30 #define PETSC_ERR_POINTER          70   /* pointer does not point to valid address */
31 #define PETSC_ERR_MPI_LIB_INCOMP   87   /* MPI library at runtime is not compatible with MPI user compiled with */
32 
33 #define PETSC_ERR_ARG_SIZ          60   /* nonconforming object sizes used in operation */
34 #define PETSC_ERR_ARG_IDN          61   /* two arguments not allowed to be the same */
35 #define PETSC_ERR_ARG_WRONG        62   /* wrong argument (but object probably ok) */
36 #define PETSC_ERR_ARG_CORRUPT      64   /* null or corrupted PETSc object as argument */
37 #define PETSC_ERR_ARG_OUTOFRANGE   63   /* input argument, out of range */
38 #define PETSC_ERR_ARG_BADPTR       68   /* invalid pointer argument */
39 #define PETSC_ERR_ARG_NOTSAMETYPE  69   /* two args must be same object type */
40 #define PETSC_ERR_ARG_NOTSAMECOMM  80   /* two args must be same communicators */
41 #define PETSC_ERR_ARG_WRONGSTATE   73   /* object in argument is in wrong state, e.g. unassembled mat */
42 #define PETSC_ERR_ARG_TYPENOTSET   89   /* the type of the object has not yet been set */
43 #define PETSC_ERR_ARG_INCOMP       75   /* two arguments are incompatible */
44 #define PETSC_ERR_ARG_NULL         85   /* argument is null that should not be */
45 #define PETSC_ERR_ARG_UNKNOWN_TYPE 86   /* type name doesn't match any registered type */
46 
47 #define PETSC_ERR_FILE_OPEN        65   /* unable to open file */
48 #define PETSC_ERR_FILE_READ        66   /* unable to read from file */
49 #define PETSC_ERR_FILE_WRITE       67   /* unable to write to file */
50 #define PETSC_ERR_FILE_UNEXPECTED  79   /* unexpected data in file */
51 
52 #define PETSC_ERR_MAT_LU_ZRPVT     71   /* detected a zero pivot during LU factorization */
53 #define PETSC_ERR_MAT_CH_ZRPVT     81   /* detected a zero pivot during Cholesky factorization */
54 
55 #define PETSC_ERR_INT_OVERFLOW     84
56 
57 #define PETSC_ERR_FLOP_COUNT       90
58 #define PETSC_ERR_NOT_CONVERGED    91  /* solver did not converge */
59 #define PETSC_ERR_MISSING_FACTOR   92  /* MatGetFactor() failed */
60 #define PETSC_ERR_OPT_OVERWRITE    93  /* attempted to over write options which should not be changed */
61 #define PETSC_ERR_WRONG_MPI_SIZE   94  /* example/application run with number of MPI ranks it does not support */
62 #define PETSC_ERR_USER_INPUT       95  /* missing or incorrect user input */
63 #define PETSC_ERR_GPU_RESOURCE     96  /* unable to load a GPU resource, for example cuBLAS */
64 #define PETSC_ERR_GPU              97  /* An error from a GPU call, this may be due to lack of resources on the GPU or a true error in the call */
65 #define PETSC_ERR_MPI              98  /* general MPI error */
66 #define PETSC_ERR_MAX_VALUE        99  /* this is always the one more than the largest error code */
67 
68 #define PetscStringizeArg(a) #a
69 #define PetscStringize(a) PetscStringizeArg(a)
70 
71 
72 /*MC
73    SETERRQ - Macro to be called when an error has been detected,
74 
75    Synopsis:
76    #include <petscsys.h>
77    PetscErrorCode SETERRQ(MPI_Comm comm,PetscErrorCode ierr,char *message)
78 
79    Collective
80 
81    Input Parameters:
82 +  comm - A communicator, use PETSC_COMM_SELF unless you know all ranks of another communicator will detect the error
83 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
84 -  message - error message
85 
86   Level: beginner
87 
88    Notes:
89     Once the error handler is called the calling function is then returned from with the given error code.
90 
91     See SETERRQ1(), SETERRQ2(), SETERRQ3() for versions that take arguments
92 
93     Experienced users can set the error handler with PetscPushErrorHandler().
94 
95    Fortran Notes:
96       SETERRQ() may be called from Fortran subroutines but SETERRA() must be called from the
97       Fortran main program.
98 
99 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(), CHKERRMPI()
100 M*/
101 #define SETERRQ(comm,ierr,s) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s)
102 
103 /*
104     Returned from PETSc functions that are called from MPI, such as related to attributes
105       Do not confuse PETSC_MPI_ERROR_CODE and PETSC_ERR_MPI, the first is registered with MPI and returned to MPI as
106       an error code, the latter is a regular PETSc error code passed within PETSc code indicating an error was detected in an MPI call.
107 */
108 PETSC_EXTERN PetscMPIInt PETSC_MPI_ERROR_CLASS;
109 PETSC_EXTERN PetscMPIInt PETSC_MPI_ERROR_CODE;
110 
111 
112 /*MC
113    SETERRMPI - Macro to be called when an error has been detected within an MPI callback function
114 
115    Synopsis:
116    #include <petscsys.h>
117    PetscErrorCode SETERRMPI(MPI_Comm comm,PetscErrorCode ierr,char *message)
118 
119    Collective
120 
121    Input Parameters:
122 +  comm - A communicator, use PETSC_COMM_SELF unless you know all ranks of another communicator will detect the error
123 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
124 -  message - error message
125 
126   Level: developer
127 
128    Notes:
129     This macro is FOR USE IN MPI CALLBACK FUNCTIONS ONLY, such as those passed to MPI_Comm_create_keyval(). It always returns the error code PETSC_MPI_ERROR_CODE
130     which is registered with MPI_Add_error_code() when PETSc is initialized.
131 
132 .seealso: SETERRQ(), CHKERRQ(), CHKERRMPI(), PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3()
133 M*/
134 #define SETERRMPI(comm,ierr,s) return (PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s),PETSC_MPI_ERROR_CODE)
135 
136 /*MC
137    SETERRQ1 - Macro that is called when an error has been detected,
138 
139    Synopsis:
140    #include <petscsys.h>
141    PetscErrorCode SETERRQ1(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg)
142 
143    Collective
144 
145    Input Parameters:
146 +  comm - A communicator, so that the error can be collective
147 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
148 .  message - error message in the printf format
149 -  arg - argument (for example an integer, string or double)
150 
151   Level: beginner
152 
153    Notes:
154     Once the error handler is called the calling function is then returned from with the given error code.
155 
156    Experienced users can set the error handler with PetscPushErrorHandler().
157 
158 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ(), SETERRQ2(), SETERRQ3()
159 M*/
160 #define SETERRQ1(comm,ierr,s,a1) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1)
161 
162 /*MC
163    SETERRQ2 - Macro that is called when an error has been detected,
164 
165    Synopsis:
166    #include <petscsys.h>
167    PetscErrorCode SETERRQ2(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2)
168 
169    Collective
170 
171    Input Parameters:
172 +  comm - A communicator, so that the error can be collective
173 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
174 .  message - error message in the printf format
175 .  arg1 - argument (for example an integer, string or double)
176 -  arg2 - argument (for example an integer, string or double)
177 
178   Level: beginner
179 
180    Notes:
181     Once the error handler is called the calling function is then returned from with the given error code.
182 
183    Experienced users can set the error handler with PetscPushErrorHandler().
184 
185 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ3()
186 M*/
187 #define SETERRQ2(comm,ierr,s,a1,a2) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2)
188 
189 /*MC
190    SETERRQ3 - Macro that is called when an error has been detected,
191 
192    Synopsis:
193    #include <petscsys.h>
194    PetscErrorCode SETERRQ3(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3)
195 
196    Collective
197 
198    Input Parameters:
199 +  comm - A communicator, so that the error can be collective
200 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
201 .  message - error message in the printf format
202 .  arg1 - argument (for example an integer, string or double)
203 .  arg2 - argument (for example an integer, string or double)
204 -  arg3 - argument (for example an integer, string or double)
205 
206   Level: beginner
207 
208    Notes:
209     Once the error handler is called the calling function is then returned from with the given error code.
210 
211     There are also versions for 4, 5, 6 and 7 arguments.
212 
213    Experienced users can set the error handler with PetscPushErrorHandler().
214 
215 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
216 M*/
217 #define SETERRQ3(comm,ierr,s,a1,a2,a3) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3)
218 
219 /*MC
220    SETERRQ4 - Macro that is called when an error has been detected,
221 
222    Synopsis:
223    #include <petscsys.h>
224    PetscErrorCode SETERRQ4(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3,arg4)
225 
226    Collective
227 
228    Input Parameters:
229 +  comm - A communicator, so that the error can be collective
230 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
231 .  message - error message in the printf format
232 .  arg1 - argument (for example an integer, string or double)
233 .  arg2 - argument (for example an integer, string or double)
234 .  arg3 - argument (for example an integer, string or double)
235 -  arg4 - argument (for example an integer, string or double)
236 
237   Level: beginner
238 
239    Notes:
240     Once the error handler is called the calling function is then returned from with the given error code.
241 
242     There are also versions for 4, 5, 6 and 7 arguments.
243 
244    Experienced users can set the error handler with PetscPushErrorHandler().
245 
246 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
247 M*/
248 #define SETERRQ4(comm,ierr,s,a1,a2,a3,a4) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3,a4)
249 
250 /*MC
251    SETERRQ5 - Macro that is called when an error has been detected,
252 
253    Synopsis:
254    #include <petscsys.h>
255    PetscErrorCode SETERRQ5(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3,arg4,arg5)
256 
257    Collective
258 
259    Input Parameters:
260 +  comm - A communicator, so that the error can be collective
261 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
262 .  message - error message in the printf format
263 .  arg1 - argument (for example an integer, string or double)
264 .  arg2 - argument (for example an integer, string or double)
265 .  arg3 - argument (for example an integer, string or double)
266 .  arg4 - argument (for example an integer, string or double)
267 -  arg5 - argument (for example an integer, string or double)
268 
269   Level: beginner
270 
271    Notes:
272     Once the error handler is called the calling function is then returned from with the given error code.
273 
274     There are also versions for 4, 5, 6 and 7 arguments.
275 
276    Experienced users can set the error handler with PetscPushErrorHandler().
277 
278 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
279 M*/
280 #define SETERRQ5(comm,ierr,s,a1,a2,a3,a4,a5) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3,a4,a5)
281 
282 /*MC
283    SETERRQ6 - Macro that is called when an error has been detected,
284 
285    Synopsis:
286    #include <petscsys.h>
287    PetscErrorCode SETERRQ6(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3,arg4,arg5,arg6)
288 
289    Collective
290 
291    Input Parameters:
292 +  comm - A communicator, so that the error can be collective
293 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
294 .  message - error message in the printf format
295 .  arg1 - argument (for example an integer, string or double)
296 .  arg2 - argument (for example an integer, string or double)
297 .  arg3 - argument (for example an integer, string or double)
298 .  arg4 - argument (for example an integer, string or double)
299 .  arg5 - argument (for example an integer, string or double)
300 -  arg6 - argument (for example an integer, string or double)
301 
302   Level: beginner
303 
304    Notes:
305     Once the error handler is called the calling function is then returned from with the given error code.
306 
307     There are also versions for 4, 5, 6 and 7 arguments.
308 
309    Experienced users can set the error handler with PetscPushErrorHandler().
310 
311 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
312 M*/
313 #define SETERRQ6(comm,ierr,s,a1,a2,a3,a4,a5,a6) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3,a4,a5,a6)
314 
315 /*MC
316    SETERRQ7 - Macro that is called when an error has been detected,
317 
318    Synopsis:
319    #include <petscsys.h>
320    PetscErrorCode SETERRQ7(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
321 
322    Collective
323 
324    Input Parameters:
325 +  comm - A communicator, so that the error can be collective
326 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
327 .  message - error message in the printf format
328 .  arg1 - argument (for example an integer, string or double)
329 .  arg2 - argument (for example an integer, string or double)
330 .  arg3 - argument (for example an integer, string or double)
331 .  arg4 - argument (for example an integer, string or double)
332 .  arg5 - argument (for example an integer, string or double)
333 .  arg6 - argument (for example an integer, string or double)
334 -  arg7 - argument (for example an integer, string or double)
335 
336   Level: beginner
337 
338    Notes:
339     Once the error handler is called the calling function is then returned from with the given error code.
340 
341     There are also versions for 4, 5, 6 and 7 arguments.
342 
343    Experienced users can set the error handler with PetscPushErrorHandler().
344 
345 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
346 M*/
347 #define SETERRQ7(comm,ierr,s,a1,a2,a3,a4,a5,a6,a7) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3,a4,a5,a6,a7)
348 
349 /*MC
350    SETERRQ8 - Macro that is called when an error has been detected,
351 
352    Synopsis:
353    #include <petscsys.h>
354    PetscErrorCode SETERRQ8(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
355 
356    Collective
357 
358    Input Parameters:
359 +  comm - A communicator, so that the error can be collective
360 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
361 .  message - error message in the printf format
362 .  arg1 - argument (for example an integer, string or double)
363 .  arg2 - argument (for example an integer, string or double)
364 .  arg3 - argument (for example an integer, string or double)
365 .  arg4 - argument (for example an integer, string or double)
366 .  arg5 - argument (for example an integer, string or double)
367 .  arg6 - argument (for example an integer, string or double)
368 .  arg7 - argument (for example an integer, string or double)
369 -  arg8 - argument (for example an integer, string or double)
370 
371   Level: beginner
372 
373    Notes:
374     Once the error handler is called the calling function is then returned from with the given error code.
375 
376     There are also versions for 4, 5, 6 and 7 arguments.
377 
378    Experienced users can set the error handler with PetscPushErrorHandler().
379 
380 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
381 M*/
382 #define SETERRQ8(comm,ierr,s,a1,a2,a3,a4,a5,a6,a7,a8) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3,a4,a5,a6,a7,a8)
383 
384 /*MC
385    SETERRQ9 - Macro that is called when an error has been detected,
386 
387    Synopsis:
388    #include <petscsys.h>
389    PetscErrorCode SETERRQ9(MPI_Comm comm,PetscErrorCode ierr,char *formatmessage,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
390 
391    Collective
392 
393    Input Parameters:
394 +  comm - A communicator, so that the error can be collective
395 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
396 .  message - error message in the printf format
397 .  arg1 - argument (for example an integer, string or double)
398 .  arg2 - argument (for example an integer, string or double)
399 .  arg3 - argument (for example an integer, string or double)
400 .  arg4 - argument (for example an integer, string or double)
401 .  arg5 - argument (for example an integer, string or double)
402 .  arg6 - argument (for example an integer, string or double)
403 .  arg7 - argument (for example an integer, string or double)
404 .  arg8 - argument (for example an integer, string or double)
405 -  arg9 - argument (for example an integer, string or double)
406 
407   Level: beginner
408 
409    Notes:
410     Once the error handler is called the calling function is then returned from with the given error code.
411 
412     There are also versions for 0 to 9 arguments.
413 
414    Experienced users can set the error handler with PetscPushErrorHandler().
415 
416 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
417 M*/
418 #define SETERRQ9(comm,ierr,s,a1,a2,a3,a4,a5,a6,a7,a8,a9) return PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
419 
420 /*MC
421    SETERRABORT - Macro that can be called when an error has been detected,
422 
423    Synopsis:
424    #include <petscsys.h>
425    PetscErrorCode SETERRABORT(MPI_Comm comm,PetscErrorCode ierr,char *message)
426 
427    Collective
428 
429    Input Parameters:
430 +  comm - A communicator, so that the error can be collective
431 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
432 -  message - error message in the printf format
433 
434   Level: beginner
435 
436    Notes:
437     This function just calls MPI_Abort().
438 
439 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()
440 M*/
441 #define SETERRABORT(comm,ierr,s) do {PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_INITIAL,s);MPI_Abort(comm,ierr);} while (0)
442 
443 /*MC
444    CHKERRQ - Checks error code returned from PETSc function, if non-zero it calls the error handler and then returns. Use CHKERRMPI() for checking errors from MPI calls
445 
446    Synopsis:
447    #include <petscsys.h>
448    PetscErrorCode CHKERRQ(PetscErrorCode ierr)
449 
450    Not Collective
451 
452    Input Parameters:
453 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
454 
455   Level: beginner
456 
457    Notes:
458     Once the error handler is called the calling function is then returned from with the given error code.
459 
460     Experienced users can set the error handler with PetscPushErrorHandler().
461 
462     CHKERRQ(ierr) is fundamentally a macro replacement for
463          if (ierr) return(PetscError(...,ierr,...));
464 
465     Although typical usage resembles "void CHKERRQ(PetscErrorCode)" as described above, for certain uses it is
466     highly inappropriate to use it in this manner as it invokes return(PetscErrorCode). In particular,
467     it cannot be used in functions which return(void) or any other datatype.  In these types of functions,
468     you can use CHKERRV() which returns without an error code (bad idea since the error is ignored or
469          if (ierr) {PetscError(....); return(YourReturnType);}
470     where you may pass back a NULL to indicate an error. You can also call CHKERRABORT(comm,n) to have
471     MPI_Abort() returned immediately.
472 
473    Fortran Notes:
474       CHKERRQ() may be called from Fortran subroutines but CHKERRA() must be called from the
475       Fortran main program.
476 
477 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ2()
478 M*/
479 #if !defined(PETSC_CLANG_STATIC_ANALYZER)
480 #define CHKERRQ(ierr)          do {PetscErrorCode ierr__ = (ierr); if (PetscUnlikely(ierr__)) return PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr__,PETSC_ERROR_REPEAT," ");} while (0)
481 #define CHKERRV(ierr)          do {PetscErrorCode ierr__ = (ierr); if (PetscUnlikely(ierr__)) {PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr__,PETSC_ERROR_REPEAT," ");return;}} while (0)
482 #else
483 #define CHKERRQ(ierr)
484 #define CHKERRV(ierr)
485 #endif
486 
487 
488 /*MC
489    CHKERRABORT - Checks error code returned from PETSc function. If non-zero it aborts immediately.
490 
491    Synopsis:
492    #include <petscsys.h>
493    PetscErrorCode CHKERRABORT(MPI_Comm comm,PetscErrorCode ierr)
494 
495    Not Collective
496 
497    Input Parameters:
498 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
499 
500   Level: intermediate
501 
502 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ2(), SETERRABORT(), CHKERRMPI()
503 M*/
504 #if !defined(PETSC_CLANG_STATIC_ANALYZER)
505 #define CHKERRABORT(comm,ierr) do {PetscErrorCode ierr__ = (ierr); if (PetscUnlikely(ierr__)) {PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr__,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while (0)
506 #define CHKERRCONTINUE(ierr)   do {PetscErrorCode ierr__ = (ierr); if (PetscUnlikely(ierr__)) {PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr__,PETSC_ERROR_REPEAT," ");}} while (0)
507 #else
508 #define CHKERRABORT(comm,ierr)
509 #define CHKERRCONTINUE(ierr)
510 #endif
511 
512 PETSC_EXTERN PetscErrorCode PetscAbortFindSourceFile_Private(const char*,PetscInt*);
513 PETSC_EXTERN PetscBool petscwaitonerrorflg,petscindebugger;
514 
515 /*MC
516    PETSCABORT - Call MPI_Abort with an informative error code
517 
518    Synopsis:
519    #include <petscsys.h>
520    PETSCABORT(MPI_Comm comm, PetscErrorCode ierr)
521 
522    Collective
523 
524    Input Parameters:
525 +  comm - A communicator, so that the error can be collective
526 -  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
527 
528    Level: advanced
529 
530    Notes:
531    We pass MPI_Abort() an error code of format XX_YYYY_ZZZ, where XX, YYYY are an index and line number of the file
532    where PETSCABORT is called, respectively. ZZZ is the PETSc error code.
533 
534    If XX is zero, this means that the call was made in the routine main().
535    If XX is one, that means 1) the file is not in PETSc (it may be in users code); OR 2) the file is in PETSc but PetscAbortSourceFiles[]
536      is out of date. PETSc developers have to update it.
537    Otherwise, look up the value of XX in the table PetscAbortSourceFiles[] in src/sys/error/err.c to map XX back to the source file where the PETSCABORT() was called.
538 
539    If the option -start_in_debugger was used then this calls abort() to stop the program in the debugger.
540 
541 M*/
542 #define PETSCABORT(comm,ierr)  \
543    do {                                                               \
544       PetscInt       idx = 0;                                         \
545       PetscMPIInt    errcode;                                         \
546       PetscAbortFindSourceFile_Private(__FILE__,&idx);                \
547       errcode = (PetscMPIInt)(0*idx*10000000 + 0*__LINE__*1000 + ierr);   \
548       if (petscwaitonerrorflg) PetscSleep(1000);                      \
549       if (petscindebugger) abort();                                   \
550       else MPI_Abort(comm,errcode);                                   \
551    } while (0)
552 
553 /*MC
554    CHKERRMPI - Checks error code returned from MPI calls, if non-zero it calls the error handler and then returns
555 
556    Synopsis:
557    #include <petscsys.h>
558    PetscErrorCode CHKERRMPI(PetscErrorCode ierr)
559 
560    Not Collective
561 
562    Input Parameters:
563 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
564 
565   Level: intermediate
566 
567    Notes:
568     Always returns the error code PETSC_ERR_MPI; the MPI error code and string are embedded in the string error message
569 
570 .seealso: CHKERRQ(), PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ2(), SETERRMPI(), SETERRABORT(), CHKERRABORT()
571 M*/
572 #if !defined(PETSC_CLANG_STATIC_ANALYZER)
573 #define CHKERRMPI(ierr) \
574 do { \
575   PetscErrorCode _7_errorcode = (ierr); \
576   if (PetscUnlikely(_7_errorcode)) { \
577     char _7_errorstring[MPI_MAX_ERROR_STRING]; \
578     PetscMPIInt _7_resultlen; \
579     MPI_Error_string(_7_errorcode,(char*)_7_errorstring,&_7_resultlen); (void)_7_resultlen; \
580     SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_MPI,"MPI error %d %s",(int)_7_errorcode,_7_errorstring); \
581   } \
582 } while (0)
583 #else
584 #define CHKERRMPI(ierr)
585 #endif
586 
587 #ifdef PETSC_CLANGUAGE_CXX
588 
589 /*MC
590    CHKERRXX - Checks error code, if non-zero it calls the C++ error handler which throws an exception
591 
592    Synopsis:
593    #include <petscsys.h>
594    void CHKERRXX(PetscErrorCode ierr)
595 
596    Not Collective
597 
598    Input Parameters:
599 .  ierr - nonzero error code, see the list of standard error codes in include/petscerror.h
600 
601   Level: beginner
602 
603    Notes:
604     Once the error handler throws a ??? exception.
605 
606     You can use CHKERRV() which returns without an error code (bad idea since the error is ignored)
607     or CHKERRABORT(comm,n) to have MPI_Abort() returned immediately.
608 
609 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKERRQ(), CHKMEMQ
610 M*/
611 #define CHKERRXX(ierr)  do {if (PetscUnlikely(ierr)) {PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,ierr,PETSC_ERROR_IN_CXX,0);}} while (0)
612 
613 #endif
614 
615 /* TODO: SEK:  Need to figure out the hipsolver issues */
616 #if defined(PETSC_HAVE_HIP)
617 #define CHKERRHIPSOLVER(err) do {if (PetscUnlikely(err)) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"HIPSOLVER error %d",err);} while (0)
618 #endif
619 /*MC
620    CHKMEMQ - Checks the memory for corruption, calls error handler if any is detected
621 
622    Synopsis:
623    #include <petscsys.h>
624    CHKMEMQ;
625 
626    Not Collective
627 
628   Level: beginner
629 
630    Notes:
631     We highly recommend using valgrind https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind for finding memory problems. This is useful
632     on systems that do not have valgrind, but much much less useful.
633 
634     Must run with the option -malloc_debug (-malloc_test in debug mode; or if PetscMallocSetDebug() called) to enable this option
635 
636     Once the error handler is called the calling function is then returned from with the given error code.
637 
638     By defaults prints location where memory that is corrupted was allocated.
639 
640     Use CHKMEMA for functions that return void
641 
642 .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(),
643           PetscMallocValidate()
644 M*/
645 #if !defined(PETSC_CLANG_STATIC_ANALYZER)
646 #define CHKMEMQ do {PetscErrorCode _7_ierr = PetscMallocValidate(__LINE__,PETSC_FUNCTION_NAME,__FILE__);CHKERRQ(_7_ierr);} while (0)
647 
648 #define CHKMEMA PetscMallocValidate(__LINE__,PETSC_FUNCTION_NAME,__FILE__)
649 #else
650 #define CHKMEMQ
651 #define CHKMEMA
652 #endif
653 /*E
654   PetscErrorType - passed to the PETSc error handling routines indicating if this is the first or a later call to the error handlers
655 
656   Level: advanced
657 
658   PETSC_ERROR_IN_CXX indicates the error was detected in C++ and an exception should be generated
659 
660   Developer Notes:
661     This is currently used to decide when to print the detailed information about the run in PetscTraceBackErrorHandler()
662 
663 .seealso: PetscError(), SETERRXX()
664 E*/
665 typedef enum {PETSC_ERROR_INITIAL=0,PETSC_ERROR_REPEAT=1,PETSC_ERROR_IN_CXX = 2} PetscErrorType;
666 
667 #if defined(__clang_analyzer__)
668 __attribute__((analyzer_noreturn))
669 #endif
670 PETSC_EXTERN PetscErrorCode PetscError(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,...);
671 
672 PETSC_EXTERN PetscErrorCode PetscErrorPrintfInitialize(void);
673 PETSC_EXTERN PetscErrorCode PetscErrorMessage(int,const char*[],char **);
674 PETSC_EXTERN PetscErrorCode PetscTraceBackErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
675 PETSC_EXTERN PetscErrorCode PetscIgnoreErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
676 PETSC_EXTERN PetscErrorCode PetscEmacsClientErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
677 PETSC_EXTERN PetscErrorCode PetscMPIAbortErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
678 PETSC_EXTERN PetscErrorCode PetscAbortErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
679 PETSC_EXTERN PetscErrorCode PetscAttachDebuggerErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
680 PETSC_EXTERN PetscErrorCode PetscReturnErrorHandler(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*);
681 PETSC_EXTERN PetscErrorCode PetscPushErrorHandler(PetscErrorCode (*handler)(MPI_Comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*),void*);
682 PETSC_EXTERN PetscErrorCode PetscPopErrorHandler(void);
683 PETSC_EXTERN PetscErrorCode PetscSignalHandlerDefault(int,void*);
684 PETSC_EXTERN PetscErrorCode PetscPushSignalHandler(PetscErrorCode (*)(int,void *),void*);
685 PETSC_EXTERN PetscErrorCode PetscPopSignalHandler(void);
686 PETSC_EXTERN PetscErrorCode PetscCheckPointerSetIntensity(PetscInt);
687 PETSC_EXTERN void PetscSignalSegvCheckPointerOrMpi(void);
688 PETSC_DEPRECATED_FUNCTION("Use PetscSignalSegvCheckPointerOrMpi() (since version 3.13)") PETSC_STATIC_INLINE void PetscSignalSegvCheckPointer(void) {PetscSignalSegvCheckPointerOrMpi();}
689 
690 /*MC
691     PetscErrorPrintf - Prints error messages.
692 
693    Synopsis:
694     #include <petscsys.h>
695      PetscErrorCode (*PetscErrorPrintf)(const char format[],...);
696 
697     Not Collective
698 
699     Input Parameters:
700 .   format - the usual printf() format string
701 
702    Options Database Keys:
703 +    -error_output_stdout - cause error messages to be printed to stdout instead of the  (default) stderr
704 -    -error_output_none - to turn off all printing of error messages (does not change the way the error is handled.)
705 
706    Notes:
707     Use
708 $     PetscErrorPrintf = PetscErrorPrintfNone; to turn off all printing of error messages (does not change the way the
709 $                        error is handled.) and
710 $     PetscErrorPrintf = PetscErrorPrintfDefault; to turn it back on or you can use your own function
711 
712           Use
713      PETSC_STDERR = FILE* obtained from a file open etc. to have stderr printed to the file.
714      PETSC_STDOUT = FILE* obtained from a file open etc. to have stdout printed to the file.
715 
716           Use
717       PetscPushErrorHandler() to provide your own error handler that determines what kind of messages to print
718 
719    Level: developer
720 
721     Fortran Note:
722     This routine is not supported in Fortran.
723 
724 
725 .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscHelpPrintf(), PetscPrintf(), PetscPushErrorHandler(), PetscVFPrintf(), PetscHelpPrintf()
726 M*/
727 PETSC_EXTERN PetscErrorCode (*PetscErrorPrintf)(const char[],...);
728 
729 typedef enum {PETSC_FP_TRAP_OFF=0,PETSC_FP_TRAP_ON=1} PetscFPTrap;
730 PETSC_EXTERN PetscErrorCode PetscSetFPTrap(PetscFPTrap);
731 PETSC_EXTERN PetscErrorCode PetscFPTrapPush(PetscFPTrap);
732 PETSC_EXTERN PetscErrorCode PetscFPTrapPop(void);
733 PETSC_EXTERN PetscErrorCode PetscDetermineInitialFPTrap(void);
734 
735 /*
736       Allows the code to build a stack frame as it runs
737 */
738 
739 #define PETSCSTACKSIZE 64
740 
741 typedef struct  {
742   const char      *function[PETSCSTACKSIZE];
743   const char      *file[PETSCSTACKSIZE];
744         int       line[PETSCSTACKSIZE];
745         PetscBool petscroutine[PETSCSTACKSIZE];
746         int       currentsize;
747         int       hotdepth;
748 } PetscStack;
749 
750 PETSC_EXTERN PetscStack *petscstack;
751 
752 PetscErrorCode  PetscStackCopy(PetscStack*,PetscStack*);
753 PetscErrorCode  PetscStackPrint(PetscStack *,FILE*);
754 #if defined(PETSC_SERIALIZE_FUNCTIONS)
755 #include <petsc/private/petscfptimpl.h>
756 /*
757    Registers the current function into the global function pointer to function name table
758 
759    Have to fix this to handle errors but cannot return error since used in PETSC_VIEWER_DRAW_() etc
760 */
761 #define PetscRegister__FUNCT__() do { \
762   static PetscBool __chked = PETSC_FALSE; \
763   if (!__chked) {\
764   void *ptr; PetscDLSym(NULL,PETSC_FUNCTION_NAME,&ptr);\
765   __chked = PETSC_TRUE;\
766   }} while (0)
767 #else
768 #define PetscRegister__FUNCT__()
769 #endif
770 
771 #if !defined(PETSC_CLANG_STATIC_ANALYZER)
772 #if defined(PETSC_USE_DEBUG)
773 PETSC_STATIC_INLINE PetscBool PetscStackActive(void)
774 {
775   return(petscstack ? PETSC_TRUE : PETSC_FALSE);
776 }
777 
778 /* Stack handling is based on the following two "NoCheck" macros.  These should only be called directly by other error
779  * handling macros.  We record the line of the call, which may or may not be the location of the definition.  But is at
780  * least more useful than "unknown" because it can distinguish multiple calls from the same function.
781  */
782 #define PetscStackPushNoCheck(funct,petsc_routine,hot)                        \
783   do {                                                                        \
784     PetscStackSAWsTakeAccess();                                                \
785     if (petscstack && (petscstack->currentsize < PETSCSTACKSIZE)) {         \
786       petscstack->function[petscstack->currentsize]  = funct;               \
787       petscstack->file[petscstack->currentsize]      = __FILE__;            \
788       petscstack->line[petscstack->currentsize]      = __LINE__;            \
789       petscstack->petscroutine[petscstack->currentsize] = petsc_routine;    \
790       petscstack->currentsize++;                                             \
791     }                                                                         \
792     if (petscstack) {                                                        \
793       petscstack->hotdepth += (hot || petscstack->hotdepth);                \
794     }                                                                         \
795     PetscStackSAWsGrantAccess();                                               \
796   } while (0)
797 
798 #define PetscStackPopNoCheck                                            \
799   do {                                                                  \
800     PetscStackSAWsTakeAccess();                                          \
801     if (petscstack && petscstack->currentsize > 0) {                  \
802       petscstack->currentsize--;                                       \
803       petscstack->function[petscstack->currentsize]  = NULL;             \
804       petscstack->file[petscstack->currentsize]      = NULL;             \
805       petscstack->line[petscstack->currentsize]      = 0;             \
806       petscstack->petscroutine[petscstack->currentsize] = PETSC_FALSE;\
807     }                                                                   \
808     if (petscstack) {                                                  \
809       petscstack->hotdepth = PetscMax(petscstack->hotdepth-1,0);      \
810     }                                                                   \
811     PetscStackSAWsGrantAccess();                                         \
812   } while (0)
813 
814 /*MC
815    PetscFunctionBegin - First executable line of each PETSc function,  used for error handling. Final
816       line of PETSc functions should be PetscFunctionReturn(0);
817 
818    Synopsis:
819    #include <petscsys.h>
820    void PetscFunctionBegin;
821 
822    Not Collective
823 
824    Usage:
825 .vb
826      int something;
827 
828      PetscFunctionBegin;
829 .ve
830 
831    Notes:
832      Use PetscFunctionBeginUser for application codes.
833 
834      Not available in Fortran
835 
836    Level: developer
837 
838 .seealso: PetscFunctionReturn(), PetscFunctionBeginHot(), PetscFunctionBeginUser()
839 
840 M*/
841 #define PetscFunctionBegin do {                                        \
842     PetscStackPushNoCheck(PETSC_FUNCTION_NAME,PETSC_TRUE,PETSC_FALSE); \
843     PetscRegister__FUNCT__();                                          \
844   } while (0)
845 
846 /*MC
847    PetscFunctionBeginHot - Substitute for PetscFunctionBegin to be used in functions that are called in
848    performance-critical circumstances.  Use of this function allows for lighter profiling by default.
849 
850    Synopsis:
851    #include <petscsys.h>
852    void PetscFunctionBeginHot;
853 
854    Not Collective
855 
856    Usage:
857 .vb
858      int something;
859 
860      PetscFunctionBeginHot;
861 .ve
862 
863    Notes:
864      Not available in Fortran
865 
866    Level: developer
867 
868 .seealso: PetscFunctionBegin, PetscFunctionReturn()
869 
870 M*/
871 #define PetscFunctionBeginHot do {                                     \
872     PetscStackPushNoCheck(PETSC_FUNCTION_NAME,PETSC_TRUE,PETSC_TRUE);  \
873     PetscRegister__FUNCT__();                                          \
874   } while (0)
875 
876 /*MC
877    PetscFunctionBeginUser - First executable line of user provided PETSc routine
878 
879    Synopsis:
880    #include <petscsys.h>
881    void PetscFunctionBeginUser;
882 
883    Not Collective
884 
885    Usage:
886 .vb
887      int something;
888 
889      PetscFunctionBeginUser;
890 .ve
891 
892    Notes:
893       Final line of PETSc functions should be PetscFunctionReturn(0) except for main().
894 
895       Not available in Fortran
896 
897       This is identical to PetscFunctionBegin except it labels the routine as a user
898       routine instead of as a PETSc library routine.
899 
900    Level: intermediate
901 
902 .seealso: PetscFunctionReturn(), PetscFunctionBegin, PetscFunctionBeginHot
903 
904 M*/
905 #define PetscFunctionBeginUser                                          \
906   do {                                                                  \
907     PetscStackPushNoCheck(PETSC_FUNCTION_NAME,PETSC_FALSE,PETSC_FALSE); \
908     PetscRegister__FUNCT__();                                           \
909   } while (0)
910 
911 
912 #define PetscStackPush(n) \
913   do {                                                                  \
914     PetscStackPushNoCheck(n,PETSC_FALSE,PETSC_FALSE);                   \
915     CHKMEMQ;                                                            \
916   } while (0)
917 
918 #define PetscStackPop                           \
919     do {                                        \
920       CHKMEMQ;                                  \
921       PetscStackPopNoCheck;                     \
922     } while (0)
923 
924 /*MC
925    PetscFunctionReturn - Last executable line of each PETSc function
926         used for error handling. Replaces return()
927 
928    Synopsis:
929    #include <petscsys.h>
930    void PetscFunctionReturn(0);
931 
932    Not Collective
933 
934    Usage:
935 .vb
936     ....
937      PetscFunctionReturn(0);
938    }
939 .ve
940 
941    Notes:
942      Not available in Fortran
943 
944    Level: developer
945 
946 .seealso: PetscFunctionBegin()
947 
948 M*/
949 #define PetscFunctionReturn(a) \
950   do {                                                                \
951     PetscStackPopNoCheck;                                             \
952     return(a);} while (0)
953 
954 #define PetscFunctionReturnVoid() \
955   do {                                                                \
956     PetscStackPopNoCheck;                                             \
957     return;} while (0)
958 #else
959 
960 PETSC_STATIC_INLINE PetscBool PetscStackActive(void) {return PETSC_FALSE;}
961 #define PetscStackPushNoCheck(funct,petsc_routine,hot) do {} while (0)
962 #define PetscStackPopNoCheck                           do {} while (0)
963 #define PetscFunctionBegin
964 #define PetscFunctionBeginUser
965 #define PetscFunctionBeginHot
966 #define PetscFunctionReturn(a)    return(a)
967 #define PetscFunctionReturnVoid() return
968 #define PetscStackPop             CHKMEMQ
969 #define PetscStackPush(f)         CHKMEMQ
970 
971 #endif
972 
973 /*
974     PetscStackCall - Calls an external library routine or user function after pushing the name of the routine on the stack.
975 
976    Input Parameters:
977 +   name - string that gives the name of the function being called
978 -   routine - actual call to the routine, including ierr = and CHKERRQ(ierr);
979 
980    Note: Often one should use PetscStackCallStandard() instead. This routine is intended for external library routines that DO NOT return error codes
981 
982    Developer Note: this is so that when a user or external library routine results in a crash or corrupts memory, they get blamed instead of PETSc.
983 
984 
985 
986 */
987 #define PetscStackCall(name,routine) do { PetscStackPush(name);routine;PetscStackPop; } while (0)
988 
989 /*
990     PetscStackCallStandard - Calls an external library routine after pushing the name of the routine on the stack.
991 
992    Input Parameters:
993 +   func-  name of the routine
994 -   args - arguments to the routine surrounded by ()
995 
996    Notes:
997     This is intended for external package routines that return error codes. Use PetscStackCall() for those that do not.
998 
999    Developer Note: this is so that when an external packge routine results in a crash or corrupts memory, they get blamed instead of PETSc.
1000 
1001 */
1002 #define PetscStackCallStandard(func,args) do {                                                            \
1003     PetscErrorCode __ierr;                                                                                \
1004     PetscStackPush(#func);                                                                                \
1005     __ierr = func args;                                                                                   \
1006     PetscStackPop;                                                                                        \
1007     if (__ierr) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in %s(): error code %d",#func,(int)__ierr); \
1008   } while (0)
1009 
1010 #else /* PETSC_CLANG_STATIC_ANALYZER */
1011 PETSC_STATIC_INLINE PetscBool PetscStackActive(void) {return PETSC_FALSE;}
1012 #define PetscStackPushNoCheck(funct,petsc_routine,hot) do {} while (0)
1013 #define PetscStackPopNoCheck                           do {} while (0)
1014 #define PetscFunctionBegin
1015 #define PetscFunctionBeginUser
1016 #define PetscFunctionBeginHot
1017 #define PetscFunctionReturn(a)    return(a)
1018 #define PetscFunctionReturnVoid() return
1019 #define PetscStackPop
1020 #define PetscStackPush(f)
1021 #define PetscStackCall(name,routine)
1022 #define PetscStackCallStandard(name,routine)
1023 #endif /* PETSC_CLANG_STATIC_ANALYZER */
1024 
1025 PETSC_EXTERN PetscErrorCode PetscStackCreate(void);
1026 PETSC_EXTERN PetscErrorCode PetscStackView(FILE*);
1027 PETSC_EXTERN PetscErrorCode PetscStackDestroy(void);
1028 
1029 #endif
1030