qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Add astyle option file for code formatting
@ 2011-09-11 17:00 Stefan Weil
  2011-09-16 13:07 ` Anthony Liguori
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2011-09-11 17:00 UTC (permalink / raw)
  To: qemu-devel

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 <weil@mail.berlios.de>
---
 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
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-19  8:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-11 17:00 [Qemu-devel] [PATCH] Add astyle option file for code formatting Stefan Weil
2011-09-16 13:07 ` Anthony Liguori
2011-09-16 14:31   ` Stefan Weil
2011-09-19  8:01   ` Markus Armbruster
2011-09-19  8:38     ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).