From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120344 invoked by alias); 4 Apr 2017 07:25:34 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 120247 invoked by uid 89); 4 Apr 2017 07:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Safety, apples, Apples X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Apr 2017 07:25:31 +0000 Received: from [88.198.220.131] (helo=sslproxy02.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1cvIWW-0002u1-VQ; Tue, 04 Apr 2017 09:05:04 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy02.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cvIWW-0002cm-MR; Tue, 04 Apr 2017 09:05:04 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 346742A1667; Tue, 4 Apr 2017 09:05:45 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6ymLQHersRyz; Tue, 4 Apr 2017 09:05:42 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id B6CFA2A1671; Tue, 4 Apr 2017 09:05:42 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id l_bBLoV_2QNV; Tue, 4 Apr 2017 09:05:42 +0200 (CEST) Received: from huber-linux.eb.localhost (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTP id 9E3B82A166A; Tue, 4 Apr 2017 09:05:42 +0200 (CEST) From: Sebastian Huber To: newlib@sourceware.org Cc: pfg Subject: [PATCH 4/8] Addition of clang nullability qualifiers. Date: Tue, 04 Apr 2017 07:25:00 -0000 Message-Id: <1491289499-30548-5-git-send-email-sebastian.huber@embedded-brains.de> In-Reply-To: <1491289499-30548-1-git-send-email-sebastian.huber@embedded-brains.de> References: <1491289499-30548-1-git-send-email-sebastian.huber@embedded-brains.de> X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00252.txt.bz2 From: pfg Add two new qualifiers for use by the static checkers: _Nonnull The _Nonnull nullability qualifier indicates that null is not a meaningful value for a value of the _Nonnull pointer type. _Nullable The _Nullable nullability qualifier indicates that a value of the _Nullable pointer type can be null. These were introduced in Clang 3.7. For more information, see: http://clang.llvm.org/docs/AttributeReference.html#nonnull We add these now without using them so that the GCC ports have time to pick up the header change. Hinted by: Android Bionic libc [1] Also seen in: Apple's Libc-1158.20.4 [1] https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321 --- newlib/libc/include/sys/cdefs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index 68172ad..ad23232 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -645,6 +645,14 @@ #endif /* + * Nullability qualifiers: currently only supported by Clang. + */ +#if !(defined(__clang__) && __has_feature(nullability)) +#define _Nonnull +#define _Nullable +#endif + +/* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety -- 1.8.4.5