From owner-svn-src-all@FreeBSD.ORG Thu Jan 1 09:39:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B5271065670 for ; Thu, 1 Jan 2009 09:39:25 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id A080A8FC08 for ; Thu, 1 Jan 2009 09:39:24 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 01 Jan 2009 09:12:42 -0000 Received: from p54A3DD17.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.221.23] by mail.gmx.net (mp038) with SMTP; 01 Jan 2009 10:12:42 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1/2UzZe8WP2Y2yIre7qmO2+E68hRLQL04p3E6jaGo ODF9C2LbOw2OBT Message-ID: <495C8904.8090008@gmx.de> Date: Thu, 01 Jan 2009 10:12:36 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.18 (X11/20081124) MIME-Version: 1.0 To: Joerg Sonnenberger References: <200812272048.mBRKmBKo082102@svn.freebsd.org> <20081228045055.GA81182@citylink.fud.org.nz> <20081228223039.cf28e3e2.stas@FreeBSD.org> <4957E8F5.90202@andric.com> <20081228210916.GA13945@britannica.bec.de> In-Reply-To: <20081228210916.GA13945@britannica.bec.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.55 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r186529 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jan 2009 09:39:25 -0000 Joerg Sonnenberger schrieb: > On Sun, Dec 28, 2008 at 10:00:37PM +0100, Dimitry Andric wrote: >> On 2008-12-28 20:30, Stanislav Sedov wrote: >>>>> - ACPI_OBJECT acpiarg[0]; >>>>> + ACPI_OBJECT acpiarg[1]; >>> I wonder how does gcc allowed this. It emits warnings only in >>> pedantic mode which we cannot use to compile kernel with. >> Zero-sized arrays are non-standard, but have been allowed by gcc (and >> many other compilers) since a long time, so it is logical that it >> doesn't warn about it by default. > > Having no size at all would be standard compliant, e.g. acpiarg[[]; No, it wouldn't be standard compliant. You are confusing this with a flexible array member as last entry of a struct declaration (C99 §6.7.2.1:16). As an (old) extension GCC accepts [0] as flexible array member, too. The declaration here is a declaration of an array with automatic storage duration and no linkage. Having nothing in the [] (and no initialiser) would make the array an incomplete type (C99 §6.7.5.2:4), which is not valid for a local variable (C99 §6.2.2:6 and §6.7:7). Also 0 as size expression clearly violates the standard: "If the expression is a constant expression, it shall have a value greater than zero." (C99 §6.7.5.2:1). A local array with length 0 has no practical purpose either. Regards Christoph