Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / Wnonnull-2.c
blobd870473d5a92acd36bcdd71d5a11e6ef691abf9a
1 /* PR middle-end/80936 - bcmp, bcopy, and bzero not declared nonnull
2 Verify that -Wnonnull is issued for calls with constant null pointers
3 with no optimization.
4 { dg-do compile }
5 { dg-options "-O0 -Wall" } */
7 void zero0 (void *p, unsigned n)
9 __builtin_memset (0, 0, n); // { dg-warning "\\\[-Wnonnull]" }
12 void zero1 (void *p, unsigned n)
14 __builtin_bzero (0, n); // { dg-warning "\\\[-Wnonnull]" }
17 void copy0 (void *p, const void *q, unsigned n)
19 __builtin_memcpy (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
22 void copy1 (void *p, const void *q, unsigned n)
24 __builtin_memcpy (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
27 void copy2 (void *p, const void *q, unsigned n)
29 __builtin_bcopy (q, 0, n); // { dg-warning "\\\[-Wnonnull]" }
32 void copy3 (void *p, const void *q, unsigned n)
34 __builtin_bcopy (q, 0, n); // { dg-warning "\\\[-Wnonnull]" }
37 int cmp0 (const void *p, const void *q, unsigned n)
39 return __builtin_memcmp (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
42 int cmp1 (const void *p, const void *q, unsigned n)
44 return __builtin_memcmp (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
47 int cmp2 (const void *p, const void *q, unsigned n)
49 return __builtin_bcmp (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
52 int cmp3 (const void *p, const void *q, unsigned n)
54 return __builtin_bcmp (p, 0, n); // { dg-warning "\\\[-Wnonnull]" }