From: Ian Campbell Subject: Re: [PATCH 06/15] libxl: permit declaration after statement Date: Wed, 7 Dec 2011 14:06:56 +0000 Message-ID: <1323266816.23681.189.camel@zakaz.uk.xensource.com> References: <1323108621-22654-1-git-send-email-ian.jackson@eu.citrix.com> <1323108621-22654-7-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1323108621-22654-7-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Mon, 2011-12-05 at 18:10 +0000, Ian Jackson wrote: > GCC and C99 allow declarations to be mixed with code. This is a good > idea because: > > * It allows variables to be more often initialised as they are > declared, thus reducing the occurrence of uninitialised variable > errors. > > * Certain alloca-like constructs (arrays allocated at runtime on the > stack) can more often be written without a spurious { } block. > Such blocks are confusing to read. > > * It makes it easier to write and use macros which declare and > initialise formulaic variables and do other function setup code, > because there is no need to worry that such macros might be > incompatible with each other or have strict ordering constraints. > > Signed-off-by: Ian Jackson I'm happy with this so far as it goes but I was wondering where the original -Wdeclaration-after-statement came from, do we actually mean "-std=c99" or something along those lines? Anyway I'm still ok with saying: Acked-by: Ian Campbell > --- > tools/libxl/Makefile | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile > index f363da2..4e0f3fb 100644 > --- a/tools/libxl/Makefile > +++ b/tools/libxl/Makefile > @@ -11,7 +11,8 @@ MINOR = 0 > XLUMAJOR = 1.0 > XLUMINOR = 0 > > -CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations > +CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \ > + -Wno-declaration-after-statement > CFLAGS += -I. -fPIC > > ifeq ($(CONFIG_Linux),y)