From patchwork Sun Sep 11 17:00:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 114238 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4D35DB6F7C for ; Mon, 12 Sep 2011 03:00:31 +1000 (EST) Received: from localhost ([::1]:32841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nOI-00020t-MQ for incoming@patchwork.ozlabs.org; Sun, 11 Sep 2011 13:00:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nOD-00020o-RP for qemu-devel@nongnu.org; Sun, 11 Sep 2011 13:00:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2nOC-0005B3-Fr for qemu-devel@nongnu.org; Sun, 11 Sep 2011 13:00:17 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:43927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2nOC-0005Aw-BH for qemu-devel@nongnu.org; Sun, 11 Sep 2011 13:00:16 -0400 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id 6D3A17282F8C; Sun, 11 Sep 2011 19:00:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qeuTr1Nw1z+F; Sun, 11 Sep 2011 19:00:12 +0200 (CEST) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id 6502D7282F8D; Sun, 11 Sep 2011 19:00:12 +0200 (CEST) From: Stefan Weil To: qemu-devel@nongnu.org Date: Sun, 11 Sep 2011 19:00:11 +0200 Message-Id: <1315760411-26359-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 78.47.199.172 Subject: [Qemu-devel] [PATCH] Add astyle option file for code formatting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For new C code (and maybe also for existing code), a code formatter like Artistic Style is helpful because it can fix tabs, indentation and other style issues. This option file tries to set astyle options which match QEMU's coding conventions. The quality of astyle's code formatting depends on the astyle version (I got best results with newer versions) and on the code which is going to be formatted. For some code, formatting of brackets and operators does not work well. Fixing indentation and tabs always worked well for me. Signed-off-by: Stefan Weil --- scripts/astylerc | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) create mode 100644 scripts/astylerc diff --git a/scripts/astylerc b/scripts/astylerc new file mode 100644 index 0000000..dcf9e3f --- /dev/null +++ b/scripts/astylerc @@ -0,0 +1,16 @@ +# Artistic Style (astyle) options for qemu source code. + +# Usage: +# astyle --options=scripts/astylerc {source files} + +# For best results, use latest astyle from http://astyle.sourceforge.net/. + +add-brackets +align-pointer=name +convert-tabs +style=otbs +brackets=linux +indent=spaces=4 +pad-oper +pad-header +unpad-paren