From patchwork Tue Dec 20 06:53:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 88546 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1575219qgi; Mon, 19 Dec 2016 22:54:11 -0800 (PST) X-Received: by 10.28.66.7 with SMTP id p7mr483558wma.64.1482216851376; Mon, 19 Dec 2016 22:54:11 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id rl18si21427578wjb.99.2016.12.19.22.54.10; Mon, 19 Dec 2016 22:54:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 899BFA766B; Tue, 20 Dec 2016 07:54:09 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kGF76i1M6Iwr; Tue, 20 Dec 2016 07:54:09 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DB691A75C9; Tue, 20 Dec 2016 07:54:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DDEFDA7662 for ; Tue, 20 Dec 2016 07:54:03 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BBDa-PciytHl for ; Tue, 20 Dec 2016 07:54:03 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-12.nifty.com (conuserg-12.nifty.com [210.131.2.79]) by theia.denx.de (Postfix) with ESMTPS id 0EE2CA75C3 for ; Tue, 20 Dec 2016 07:53:59 +0100 (CET) Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id uBK6ratL015897; Tue, 20 Dec 2016 15:53:39 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com uBK6ratL015897 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1482216819; bh=JDt8Y/L2j5sqW7Ie9S0axD51VNnhD6oRiIOJ05OBDLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r/XIsIhX2LZVouKjFWL4cxrh6Zy4Wtd4gzIcAYZSIDh8bdQYGoOqKIIzrttjVd051 uW4Ti61pA9ftHhnoXTUK2g2BHv6MizbRa9IsI2xHooYgojSEpx7qJ4ylIClnkHYeEY jKu27gGUf/Wm2HT44CffZOXpI3AJk6cN3Ww63ub5E094oxLautb855mQWFvOTANoDs KpcXXqUzXjT2+znd1SjNlByddp93NkiX20WtrJZ3NA6JkqbU8HJwJGaRUGizHKV+Dh 8f7/va/61+yA6ML60gWrHeb8VRG4X/Divt8Zsyjrgu+4zbaophiDQHFwgDoF7Ad+8S 5Tq8radbK9J/w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 20 Dec 2016 15:53:30 +0900 Message-Id: <1482216812-18379-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482216812-18379-1-git-send-email-yamada.masahiro@socionext.com> References: <1482216812-18379-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 3/5] typecheck: import include/linux/typecheck.h from Linux 4.9 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Copied from Linux 4.9. Signed-off-by: Masahiro Yamada --- include/linux/typecheck.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 include/linux/typecheck.h -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h new file mode 100644 index 0000000..eb5b74a --- /dev/null +++ b/include/linux/typecheck.h @@ -0,0 +1,24 @@ +#ifndef TYPECHECK_H_INCLUDED +#define TYPECHECK_H_INCLUDED + +/* + * Check at compile time that something is of a particular type. + * Always evaluates to 1 so you may use it easily in comparisons. + */ +#define typecheck(type,x) \ +({ type __dummy; \ + typeof(x) __dummy2; \ + (void)(&__dummy == &__dummy2); \ + 1; \ +}) + +/* + * Check at compile time that 'function' is a certain type, or is a pointer + * to that type (needs to use typedef for the function type.) + */ +#define typecheck_fn(type,function) \ +({ typeof(type) __tmp = function; \ + (void)__tmp; \ +}) + +#endif /* TYPECHECK_H_INCLUDED */