From patchwork Sat Oct 19 07:55:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1179773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-511348-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UHMnkyF3"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46wFZ35Qklz9sNw for ; Sat, 19 Oct 2019 18:55:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; q=dns; s=default; b=nKhzelQjQIule2zQIvec RqAxqIieZubUCkhdOjQuEZFkGzhfgv4kbE8dT0F5riyamRsf6wNJSu/WAwFVheKh EOcLoHXDr2V6qPKq8AAlDMzDGNfPbSJ7IVcYdhU7G/SxthV+9EsoHPfDwe2Pi7hZ yG0xsZ6v78xkLGjvR3YlM7U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; s=default; bh=AhLGgWZtcZpvwtnyaUfhg67J39 8=; b=UHMnkyF3salnPINjM5tuvPBxRrOijYKbF6xt4jrhA6k1LfOEcwUAZsweDD pgyxLqzwPaAACZnBRyKczcsaSic5LnU6Ha19Ab7IrOHgApiQOHnrJwgsAKkRipdU er+gu6dHLRx0NpXUk0C3/d/WqaHzIDOzVBz2Zudl93ys/WeAw= Received: (qmail 60269 invoked by alias); 19 Oct 2019 07:55:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 60261 invoked by uid 89); 19 Oct 2019 07:55:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=Wnonnullc, wnonnull.c, UD:Wnonnull.c, Wnonnull.c X-HELO: smtp2.wavenetuk.net Received: from smtp.wavenetuk.net (HELO smtp2.wavenetuk.net) (195.26.37.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 19 Oct 2019 07:55:13 +0000 Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id C8DA36000E7; Sat, 19 Oct 2019 08:55:10 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [Darwin, testsuite, committed] Fix Wnonnull on Darwin. Message-Id: <5DDF751A-C750-4CC7-8272-966E663534CF@sandoe.co.uk> Date: Sat, 19 Oct 2019 08:55:08 +0100 Cc: Martin Sebor To: GCC-patches 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. tested on x68_64-darwin16, x86_64-linux-gnu, applied to mainline, thanks, Iain. gcc/testsuite/ChangeLog: 2019-10-19 Iain Sandoe * gcc.dg/Wnonnull.c: Add attributed function declarations for memcpy and strlen for Darwin. 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 +#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];