aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-10-19 07:44:49 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-10-19 07:44:49 +0000
commit2366bf60c667d968c88e7bcec2eb9e2b84d0172d (patch)
tree5009ca1e441c11a7a25bfd267edb541add82788c
parentdc7e9feb19598ea98afb14b18507562211d55349 (diff)
downloadgcc-2366bf60c667d968c88e7bcec2eb9e2b84d0172d.zip
gcc-2366bf60c667d968c88e7bcec2eb9e2b84d0172d.tar.gz
gcc-2366bf60c667d968c88e7bcec2eb9e2b84d0172d.tar.bz2
[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 <iain@sandoe.co.uk> * gcc.dg/Wnonnull.c: Add attributed function declarations for memcpy and strlen for Darwin. From-SVN: r277202
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1a87247..6fc0c82 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.dg/Wnonnull.c: Add attributed function declarations for
+ memcpy and strlen for Darwin.
+
2019-10-18 Martin Sebor <msebor@redhat.com>
PR tree-optimization/92157
diff --git a/gcc/testsuite/gcc.dg/Wnonnull.c b/gcc/testsuite/gcc.dg/Wnonnull.c
index be89a5a..a165baa 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
char buf[100];