Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753812AbbBJJk7 (ORCPT ); Tue, 10 Feb 2015 04:40:59 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:2793 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbbBJJk4 (ORCPT ); Tue, 10 Feb 2015 04:40:56 -0500 Message-ID: <54D9D114.5000002@huawei.com> Date: Tue, 10 Feb 2015 17:36:20 +0800 From: Wang Nan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: =?UTF-8?B?SmFudXN6IFXFvHlja2k=?= , "Jon Medhurst (Tixy)" CC: Russell King , , "Li Zefan" , "David A. Long" , "Masami Hiramatsu" , Subject: Re: arm: kprobe compilation error References: <54D38982.6000100@elproma.com.pl> <1423475079.2864.49.camel@linaro.org> <54D8934B.6040709@elproma.com.pl> <54D9C121.3000601@huawei.com> In-Reply-To: <54D9C121.3000601@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.69.129] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.54D9D133.010A,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f1e125a55d05a777cd2856f6cb167c4f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2899 Lines: 85 On 2015/2/10 16:28, Wang Nan wrote: > On 2015/2/9 19:00, Janusz Użycki wrote: >> >> W dniu 2015-02-09 o 10:44, Jon Medhurst (Tixy) pisze: >>> Hi Janusz >>> >>> On Thu, 2015-02-05 at 16:17 +0100, Janusz Użycki wrote: >>>> I got the compilation error on next-20150204: >>>> >>> [...] >>>> In file included from arch/arm/probes/kprobes/core.c:37: >>>> arch/arm/probes/kprobes/core.h:43: error: '[*]' not allowed in other >>>> than a declaration >>> [...] >>>> gcc version 4.2.4 >>> Thanks for reporting this, is it OK if I add to a patch to fix this a >>> line saying "Reported-by: Janusz Użycki "? >> >> sure >> >>> >>> Whilst the extra '*' looks like an obvious typo, it's interesting that >>> your error message implies that it's allowed in some situations and that >>> the version of GCC that I use (4.9.1) doesn't complain about it. >>> If it's valid C, I've no idea what that syntax that might represent. >>> >> I've not find such extension in C11 but likely gcc's team knows the answer. >> It also compiles using gcc 4.8.3. However I thing more people use older compilers >> for different platforms. >> > > Hi All, > > Thanks for reporting and fixing this. > > When writing this code I checked C spec from open-std (n1548 and n1570). I got an > feeling that [*] should be a standard way to specify variable length array types. > Please see 6.7.6.3 and 6.7.7 of the spec. However I forgot there are old gccs which > don't support that standard. > > Thank you! > I did a boring searching and found some useful information: The '[*]' syntax was introduced at 1997 as part of variable length array (VLA) support: http://www.open-std.org/JTC1/SC22/WG14/www/docs/n683.htm so it is not a new extension. However, according to 6.7.6.2 of the spec: If the size is not present, the array type is an incomplete type. If the size is * instead of being an expression, the array type is a variable length array type of unspecified size, ... (Variable length arrays are a conditional feature that implementations need not support; see 6.10.8.3.) and 6.10.8.3 provides a macro: __STDC_NO_VLA__ The integer constant 1, intended to indicate that the implementation does not support variable length arrays or variably modified types. In our situation what we need is an incomplete type of array, so Tixy's fix is correct. It's my fault to incorrectly use VLA. Thank you. >> best regards >> Janusz >> > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- 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/