Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753569Ab2JSIOT (ORCPT ); Fri, 19 Oct 2012 04:14:19 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:51697 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194Ab2JSIOP (ORCPT ); Fri, 19 Oct 2012 04:14:15 -0400 MIME-Version: 1.0 In-Reply-To: <5080f0b3.85712b0a.0d0f.ffff9dd2SMTPIN_ADDED@mx.google.com> References: <1350568765-5723-1-git-send-email-weiyang@linux.vnet.ibm.com> <1350624189.14741.1.camel@wall-e> <5080f0b3.85712b0a.0d0f.ffff9dd2SMTPIN_ADDED@mx.google.com> Date: Fri, 19 Oct 2012 10:14:14 +0200 Message-ID: Subject: Re: [PATCH] remove untouched code in kfifo_in From: richard -rw- weinberger To: Richard Yang Cc: Stefani Seibold , linux-kernel@vger.kernel.org, jkosina@suse.cz Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1623 Lines: 60 On Fri, Oct 19, 2012 at 8:18 AM, Richard Yang wrote: > On Fri, Oct 19, 2012 at 07:23:09AM +0200, Stefani Seibold wrote: >> >>Am Freitag, den 19.10.2012, 00:37 +0200 schrieb richard -rw- weinberger: >>> On Thu, Oct 18, 2012 at 3:59 PM, Wei Yang wrote: >>> > In kfifo_in marco, one piece of code is arounded by if(0). This code in >>> > introduced by Stefani Seibold to suppress a compiler >>> > warning. This warning is not there with the upgrade of gcc version. >>> > >>> > This patch just remove this code. >>> >>> Are you sure? >>> This code fragment looks like a compiler bomb to detect type mismatch to me... >>> >> >>Yes, you are great! That was the reason why i made this peace of code. >>So don't remove it! > Thanks for your confirmation. > > Hmm, would you give me a hint on how it check the type mismatch? Here a small hint: ---cut--- struct x { }; struct y { }; #define check(a, b) \ ({ \ if (0) { \ typeof(a) __dummy __attribute__ ((unused)); \ __dummy = (typeof(b))NULL; \ } \ }) int main(int argc, char **argv) { struct x _x; struct y _y; check(&_x, &_x); //okay check(&_x, &_y); //will explode with "assignment from incompatible pointer type" return 0; } ---cut--- -- Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/