From patchwork Mon Jan 12 21:43:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 42974 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 36EBF2055F for ; Mon, 12 Jan 2015 21:44:24 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id a1sf11076195wgh.3 for ; Mon, 12 Jan 2015 13:44:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=jVyq1pHE9eSMc4jP2KYxLymUA7NirSnXQEdFVRcSJwM=; b=XPc2Lts1mkFHqnZ0++JUA+nma1Afo6I5IC3An/y4A1vsyHg3q48888GmVCFMIgLXrj /daOcF4LfM0tMiL8yOSSdbR5ghDAsavGE106/DznezHT6VJPTuG0SKm7msguJBb/x+ZV vPptGhbU5p9zyhJo30QP96kOWy4sxeoU4glMcb8kqlCuzBN8X7m6uo+48olwylAj/aAn IJ8v1JF9jzLDKXWbKV9h5poZCURlwjZzHKqz6Am85SyDTSBWn095HKFVg1XbnpK9VyvG C7XzC+oV/3lAvBjUIz8WGYeg0lpr0jXdS/ybDHAnyXmijE4MUVM+XWbhnrzEmXvpGi2J 2FMg== X-Gm-Message-State: ALoCoQlmuLyLqCovfOenkI0tp5SV/wj7czJNpN3S0f2rqsqkfv3st3lREPqdM75PtwZtgjREeReI X-Received: by 10.112.141.232 with SMTP id rr8mr4020276lbb.0.1421099063480; Mon, 12 Jan 2015 13:44:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.201 with SMTP id x9ls766477lae.89.gmail; Mon, 12 Jan 2015 13:44:23 -0800 (PST) X-Received: by 10.152.5.67 with SMTP id q3mr38873874laq.73.1421099063338; Mon, 12 Jan 2015 13:44:23 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id rb6si3115513lbb.8.2015.01.12.13.44.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Jan 2015 13:44:23 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id w7so20237934lbi.2 for ; Mon, 12 Jan 2015 13:44:23 -0800 (PST) X-Received: by 10.112.84.225 with SMTP id c1mr38779366lbz.22.1421099063233; Mon, 12 Jan 2015 13:44:23 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1200370lbb; Mon, 12 Jan 2015 13:44:22 -0800 (PST) X-Received: by 10.140.104.1 with SMTP id z1mr50445420qge.76.1421099061912; Mon, 12 Jan 2015 13:44:21 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id w12si10270509qge.63.2015.01.12.13.44.21 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 12 Jan 2015 13:44:21 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YAmmZ-00072W-Hg; Mon, 12 Jan 2015 21:44:19 +0000 Received: from mail-qg0-f45.google.com ([209.85.192.45]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YAmmQ-00071O-80 for lng-odp@lists.linaro.org; Mon, 12 Jan 2015 21:44:10 +0000 Received: by mail-qg0-f45.google.com with SMTP id z107so19810012qgd.4 for ; Mon, 12 Jan 2015 13:44:05 -0800 (PST) X-Received: by 10.140.81.71 with SMTP id e65mr49834821qgd.82.1421099045108; Mon, 12 Jan 2015 13:44:05 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id i49sm15849062qge.48.2015.01.12.13.44.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jan 2015 13:44:04 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Mon, 12 Jan 2015 16:43:40 -0500 Message-Id: <1421099021-26007-3-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1421099021-26007-1-git-send-email-mike.holmes@linaro.org> References: <1421099021-26007-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 1/2] api: odp_hints: add ODP_NONNULL attribute X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Both gcc and clang can use compiler hints to catch null passed as an argument to a function. This macro allows ODP APIs to take advantage of this feature. Signed-off-by: Mike Holmes --- See also http://clang-analyzer.llvm.org/annotations.html#generic platform/linux-generic/include/api/odp_hints.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/linux-generic/include/api/odp_hints.h b/platform/linux-generic/include/api/odp_hints.h index 7f04886..42b57f1 100644 --- a/platform/linux-generic/include/api/odp_hints.h +++ b/platform/linux-generic/include/api/odp_hints.h @@ -32,6 +32,12 @@ extern "C" { #define ODP_WEAK_SYMBOL __attribute__((__weak__)) /** + * Where an API should not be passed a NULL pointer, provide static analysers + * a hint to help catch transgressions. + */ +#define ODP_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__))) + +/** * Hot code section */ #define ODP_HOT_CODE __attribute__((__hot__))