xref: /petsc/src/sys/tests/ex33.c (revision 3307d110e72ee4e6d2468971620073eb5ff93529)
1 static char help[] = "Tests PetscStack.\n\n";
2 
3 #include <petscsys.h>
4 
5 #if !defined(PETSCSTACKSIZE)
6 #define PETSCSTACKSIZE 64
7 #endif
8 
9 PetscErrorCode correct()
10 {
11   PetscFunctionBegin;
12   PetscFunctionReturn(0);
13 }
14 
15 PetscErrorCode correctu()
16 {
17   PetscFunctionBeginUser;
18   PetscFunctionReturn(0);
19 }
20 
21 PetscErrorCode foo()
22 {
23   PetscFunctionReturn(0);
24 }
25 
26 PetscErrorCode bar()
27 {
28   PetscFunctionBegin;
29   return 0;
30 }
31 
32 PetscErrorCode baru()
33 {
34   PetscFunctionBeginUser;
35   return 0;
36 }
37 
38 int main(int argc,char **argv)
39 {
40   PetscBool      flg = PETSC_FALSE;
41 
42   PetscCall(PetscInitialize(&argc,&argv,(char*)0,help));
43 #if defined(PETSC_USE_DEBUG)
44   PetscCall(PetscOptionsGetBool(NULL,NULL,"-checkstack",&flg,NULL));
45 #endif
46   PetscCall(PetscPrintf(PETSC_COMM_WORLD,"%s for stack\n",flg ? "Checking" : "Not checking"));
47   for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) PetscCall(correct());
48   for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) PetscCall(foo());
49   for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) PetscCall(bar());
50   for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) PetscCall(foo());
51   for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) PetscCall(baru());
52   for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) PetscCall(foo());
53   PetscCall(PetscFinalize());
54   return 0;
55 }
56 
57 /*TEST
58 
59   test:
60 
61 TEST*/
62