From 4b2a64e1053ff9ff75ef1d73f20f8c7873021783 Mon Sep 17 00:00:00 2001 From: iains Date: Sat, 19 Oct 2019 07:44:49 +0000 Subject: [PATCH] [Darwin, testsuite] Fix Wnonnull on Darwin. Darwin does not mark entries in string.h with nonnull attributes so the test fails. 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 marked up headers for Darwin. gcc/testsuite/ChangeLog: 2019-10-19 Iain Sandoe * gcc.dg/Wnonnull.c: Add attributed function declarations for memcpy and strlen for Darwin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277202 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/Wnonnull.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a87247323e9..6fc0c826d4cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-19 Iain Sandoe + + * gcc.dg/Wnonnull.c: Add attributed function declarations for + memcpy and strlen for Darwin. + 2019-10-18 Martin Sebor PR tree-optimization/92157 diff --git a/gcc/testsuite/gcc.dg/Wnonnull.c b/gcc/testsuite/gcc.dg/Wnonnull.c index be89a5a755cf..a165baa99f55 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 +#else +/* OSX headers do not mark up the nonnull elements yet. */ +# include +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 char buf[100]; -- 2.47.2