From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtYWj-0005qW-81 for qemu-devel@nongnu.org; Sun, 08 Jun 2014 04:32:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtYWd-0000qP-Su for qemu-devel@nongnu.org; Sun, 08 Jun 2014 04:32:29 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:34772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtYWd-0000pR-Ky for qemu-devel@nongnu.org; Sun, 08 Jun 2014 04:32:23 -0400 Received: by mail-wi0-f176.google.com with SMTP id n3so205891wiv.15 for ; Sun, 08 Jun 2014 01:32:22 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53941F93.2000408@redhat.com> Date: Sun, 08 Jun 2014 10:32:19 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <53913773.5040702@ozlabs.ru> <87a99qr1r7.fsf@blackfin.pond.sub.org> <539160C9.9070107@ozlabs.ru> <87r432zevk.fsf@blackfin.pond.sub.org> <5393372D.7080501@weilnetz.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] checkpatch.pl question List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Stefan Weil Cc: Alexey Kardashevskiy , Blue Swirl , Don Slutz , Markus Armbruster , "qemu-devel@nongnu.org" Il 07/06/2014 18:27, Peter Maydell ha scritto: > On 7 June 2014 17:00, Stefan Weil wrote: >> Am 07.06.2014 16:58, schrieb Peter Maydell: >>> It's clearly something to do with it getting confused by the type name, >>> because you can suppress the warning by just changing it so it has >>> an "_t" suffix, for instance. In particular notice that the set of allowed >>> type names constructed by the build_types() subroutine is extremely >>> limited: it looks to me as if the script makes assumptions based on >>> kernel style (where 'struct foo' is preferred over a typedef and plain >>> 'foo') that allow it to assume that if it's not one of a very few allowed >>> formats then it's not a type name. > >> Yes, but that's only part of the story. checkpatch.pl contains some >> special handling for the standard C data types and also knows some Linux >> data type patterns. It also handles the above case correctly in most >> circumstances because there is special code for "*" used in function >> argument lists. > > Interesting. There are obviously multiple situations where it > fails in this way for different reasons. This is the case I saw yesterday: > > @@ -125,19 +125,20 @@ static TCGRegSet tcg_target_available_regs[2]; > static TCGRegSet tcg_target_call_clobber_regs; > > #if TCG_TARGET_INSN_UNIT_SIZE == 1 > -static inline void tcg_out8(TCGContext *s, uint8_t v) > +static __attribute__((unused)) inline void tcg_out8(TCGContext *s, uint8_t v) > { > *s->code_ptr++ = v; > } > > No macros or previous context for it to get confused by. > Saying "TCGContext_t" instead silences the warning. Given QEMU's coding style, any camelcase identifier (or equivalently and identifier containing an uppercase and a lowercase letter) could be considered a type. Paolo