[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r9584: Mention --enable-gcc-warnings and "make check-spaces" in HAC (in tor/trunk: . doc)



Author: nickm
Date: 2007-02-14 11:46:47 -0500 (Wed, 14 Feb 2007)
New Revision: 9584

Modified:
   tor/trunk/
   tor/trunk/doc/HACKING
Log:
 r11811@catbus:  nickm | 2007-02-14 02:51:43 -0500
 Mention --enable-gcc-warnings and "make check-spaces" in HACKING



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11811] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/doc/HACKING
===================================================================
--- tor/trunk/doc/HACKING	2007-02-14 16:46:44 UTC (rev 9583)
+++ tor/trunk/doc/HACKING	2007-02-14 16:46:47 UTC (rev 9584)
@@ -5,10 +5,33 @@
 
 1. Coding conventions
 
+1.0. Whitespace and C conformance
+
+  Invoke "make check-spaces" from time to time, so it can tell you about
+  deviations from our C whitespace style.  Generally, we use:
+    - Unix-style line endings
+    - K&R-style indentation
+    - No space before newlines
+    - A blank line at the end of each file
+    - Never more than one blank line in a row
+    - Always spaces, never tabs
+    - A space between control keywords and their corresponding paren
+      "if (x)", "while (x)", and "switch (x)", never "if(x)", "while(x)", or
+      "switch(x)".
+    - A space between anything and an open brace.
+    - No space between a function name and an opening paren. "puts(x)", not
+      "puts (x)".
+    - Function declarations at the start of the line.
+
+  We try hard to build without warnings everywhere.  In particular, if you're
+  using gcc, you should invoke the configure script with the option
+  "--enable-gcc-warnings".  This will give a bunch of extra warning flags to
+  the compiler, and help us find divergences from our preferred C style.
+
 1.1. Details
 
-  Use tor_malloc, tor_free, tor_snprintf, tor_strdup, and tor_gettimeofday
-  instead of their generic equivalents.  (They always succeed or exit.)
+  Use tor_malloc, tor_free, tor_strdup, and tor_gettimeofday instead of their
+  generic equivalents.  (They always succeed or exit.)
 
   You can get a full list of the compatibility functions that Tor provides
   by looking through src/common/util.h and src/common/compat.h.