xref: /petsc/src/sys/tests/linter/testValidPointers.c (revision 19cff895e468e6eeea17e6de90791a5d0cb0026d)
1 #include <petsc/private/petscimpl.h>
2 
3 PetscErrorCode testValidPointers(void *a, char *b, PetscInt *c, PetscMPIInt *d, PetscInt *e, PetscBool *f, PetscScalar *g, PetscReal *h)
4 {
5   /* incorrect */
6   PetscValidPointer(a, 2);
7   PetscValidPointer(b, 3);
8   PetscValidPointer(c, 4);
9   PetscValidPointer(d, 5);
10   PetscValidPointer(e, 6);
11   PetscValidPointer(f, 7);
12   PetscValidPointer(g, 8);
13   PetscValidPointer(h, 9);
14 
15   /* correct */
16   PetscValidPointer(a, 1);
17   PetscValidPointer(b, 2);
18   PetscValidPointer(c, 3);
19   PetscValidPointer(d, 4);
20   PetscValidPointer(e, 5);
21   PetscValidPointer(f, 6);
22   PetscValidPointer(g, 7);
23   PetscValidPointer(h, 8);
24   return 0;
25 }
26 
27 void testValidPointers2(void *a, char *b, PetscInt *c, PetscMPIInt *d, PetscInt *e, PetscBool *f, PetscScalar *g, PetscReal *h)
28 {
29   /* incorrect */
30   PetscValidPointer(a, 2);
31   PetscValidPointer(b, 3);
32   PetscValidPointer(c, 4);
33   PetscValidPointer(d, 5);
34   PetscValidPointer(e, 6);
35   PetscValidPointer(f, 7);
36   PetscValidPointer(g, 8);
37   PetscValidPointer(h, 9);
38 
39   /* correct */
40   PetscValidPointer(a, 1);
41   PetscValidPointer(b, 2);
42   PetscValidPointer(c, 3);
43   PetscValidPointer(d, 4);
44   PetscValidPointer(e, 5);
45   PetscValidPointer(f, 6);
46   PetscValidPointer(g, 7);
47   PetscValidPointer(h, 8);
48   return;
49 }
50 
51 void testValidPointers3(void **a, char **b, PetscInt **c, PetscMPIInt **d, PetscInt **e, PetscBool **f, PetscScalar **g, PetscReal **h)
52 {
53   /* incorrect */
54   PetscValidPointer(a, 1);
55   PetscValidPointer(b, 2);
56   PetscValidPointer(c, 3);
57   PetscValidPointer(d, 4);
58   PetscValidPointer(e, 5);
59   PetscValidPointer(f, 6);
60   PetscValidPointer(g, 7);
61   PetscValidPointer(h, 8);
62 
63   /* correct */
64   PetscValidPointer(a, 1);
65   PetscValidPointer(b, 2);
66   PetscValidPointer(c, 3);
67   PetscValidPointer(d, 4);
68   PetscValidPointer(e, 5);
69   PetscValidPointer(f, 6);
70   PetscValidPointer(g, 7);
71   PetscValidPointer(h, 8);
72   return;
73 }
74