summaryrefslogtreecommitdiff
path: root/doc/HACKING
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-14 16:46:47 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-14 16:46:47 +0000
commit9e7e9e1bfefc6e3bac02cd230fcad48272ba4109 (patch)
tree9f21eb01e2ad421ec2a5706672443c099763e02b /doc/HACKING
parent2a22f62d83f69378a1b07d037991575f590934b1 (diff)
downloadtor-9e7e9e1bfefc6e3bac02cd230fcad48272ba4109.tar.gz
tor-9e7e9e1bfefc6e3bac02cd230fcad48272ba4109.zip
r11811@catbus: nickm | 2007-02-14 02:51:43 -0500
Mention --enable-gcc-warnings and "make check-spaces" in HACKING svn:r9584
Diffstat (limited to 'doc/HACKING')
-rw-r--r--doc/HACKING27
1 files changed, 25 insertions, 2 deletions
diff --git a/doc/HACKING b/doc/HACKING
index 82d6443a2d..50f1a583dd 100644
--- a/doc/HACKING
+++ b/doc/HACKING
@@ -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.