[Darwin, testsuite, committed] Fix Wnonnull on Darwin.
Andreas Schwab
schwab@linux-m68k.org
Sat Oct 19 08:56:00 GMT 2019
On Okt 19 2019, Iain Sandoe <iain@sandoe.co.uk> wrote:
> This test has failed always on Darwin, because Darwin does not mark
> entries in string.h with nonnull attributes. Since the purpose of the test
> is to check that the warnings are issued for an inlined function, not that
> the target headers are marked up, we can provide locally marked up
> function declarations for Darwin.
If the test depends on the non-std declarations, then it should use them
everywhere.
> diff --git a/gcc/testsuite/gcc.dg/Wnonnull.c b/gcc/testsuite/gcc.dg/Wnonnull.c
> index be89a5a755..a165baa99f 100644
> --- a/gcc/testsuite/gcc.dg/Wnonnull.c
> +++ b/gcc/testsuite/gcc.dg/Wnonnull.c
> @@ -2,7 +2,16 @@
> { dg-do compile }
> { dg-options "-O2 -Wall" } */
>
> +#ifndef __APPLE__
> #include <string.h>
> +#else
> +/* OSX headers do not mark up the nonnull elements yet. */
> +# include <stddef.h>
> +extern size_t strlen (const char *__s)
> + __attribute ((pure)) __attribute ((nonnull (1)));
> +extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
> + size_t __n) __attribute ((nonnull (1, 2)));
> +#endif
Perhaps use __SIZE_TYPE__ instead of #include <stddef.h>?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc-patches
mailing list