mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: kernel@pengutronix.de
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 1/2] kernel.h: introduce BUILD_BUG_ON_NOT_SAME_TYPE
Date: Wed, 16 Feb 2011 22:55:50 +0100	[thread overview]
Message-ID: <1297893351-2900-2-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1297893351-2900-1-git-send-email-mkl@pengutronix.de>

This patch introduces BUILD_BUG_ON_NOT_SAME_TYPE which forces a compilation
error if the two supplied variables don't have the same type.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 include/linux/kernel.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2fe6e84..b637d57 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -612,6 +612,8 @@ extern int __build_bug_on_failed;
 	} while(0)
 #endif
 
+#define BUILD_BUG_ON_NOT_SAME_TYPE(a, b) BUILD_BUG_ON(!__same_type((a), (b)));
+
 /* Trap pasters of __FUNCTION__ at compile-time */
 #define __FUNCTION__ (__func__)
 
-- 
1.7.2.3


  reply	other threads:[~2011-02-16 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 21:55 [PATCH 0/2] RFC: introduce typechecking to platform_{get,set}_drvdata Marc Kleine-Budde
2011-02-16 21:55 ` Marc Kleine-Budde [this message]
2011-02-16 21:55 ` [PATCH 2/2] Driver core: add " Marc Kleine-Budde
2011-02-16 22:02 ` [PATCH 0/2] RFC: introduce " Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297893351-2900-2-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®