[or-cvs] Disallow NDEBUG. It is very stupid.

Nick Mathewson nickm at seul.org
Mon Nov 29 07:22:59 UTC 2004


Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv10742/src/common

Modified Files:
	util.h 
Log Message:
Disallow NDEBUG. It is very stupid.

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- util.h	28 Nov 2004 09:05:46 -0000	1.121
+++ util.h	29 Nov 2004 07:22:57 -0000	1.122
@@ -24,7 +24,15 @@
  * calling assert() normally.
  */
 #ifdef NDEBUG
-#define tor_assert(expr) do {} while (0)
+/* Nobody should ever want to build with NDEBUG set.  99% of your asserts will
+ * be outside the critical path anyway, so it's silly to disable bugchecking
+ * throughout the entire program just because a few asserts are slowing you
+ * down.  Profile, optimize the critical path, and keep debugging on.
+ *
+ * And I'm not just saying that because some of our asserts check
+ * security-critical properties.
+ */
+#error "Sorry; we don't support building with NDEBUG."
 #else
 #define tor_assert(expr) do {                                 \
  if (!(expr)) {                                               \



More information about the tor-commits mailing list