Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161891AbbEEMda (ORCPT ); Tue, 5 May 2015 08:33:30 -0400 Received: from mout.web.de ([212.227.15.4]:51033 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161851AbbEEMdD (ORCPT ); Tue, 5 May 2015 08:33:03 -0400 Message-ID: <5548B87B.4060103@users.sourceforge.net> Date: Tue, 05 May 2015 14:32:59 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Nicholas Mc Guire CC: cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] Coccinelle: Check for return not matching function signature References: <1430820761-28122-1-git-send-email-hofrat@osadl.org> In-Reply-To: <1430820761-28122-1-git-send-email-hofrat@osadl.org> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:1hZ9VtTynuESgCxURLiu722mtaqrUNW7p2UyvssbxgPbtvFGhke As/pCjenD/TOYrCyvShqNnPS3QTWt2ie2rniUfVCWfYdujVHbTjFro1XIlv/cjwCXLa0g/f ESWl3KV9SgjH/ANHqByeXWj/uAx+BK/I1zj37YYtGMMq6iTGa1uvXM8sCUb4SaqQaVMzgIW 23jgTngW+OcjgpH3stn9A== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1122 Lines: 38 > Check if the signature of a function and the return value type match. Is this a task that is usually performed by a compiler? > In many cases this mismatch will have no side-effects > but in some cases it may lead to hard to locate problems It is another software development challenge to find concrete open issues there. > - and for readability and code understanding it is also helpful > when types match. How would you like to check for compatible data types here? > The output is a bit lengthy - not sure if that is too much > but it seemed useful to me to see the non-matching types explicitly > in the warning message. How do you think about to import the result list into a database table? > +if T1 != T2: > + print "%s:%s,%s WARNING: return of wrong type (%s != %s)" % (p[0].file,fn,p[0].line,T1,T2) Is such a check a bit too simple? Regards, Markus -- 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/