On Monday, August 3, 2015 at 2:19:34 AM UTC-4, Jeffrey Walton wrote:
>
> I have the following configuration option. It currently resides in trap.h. 
> It was fine in trap.h until code paths were selected based on 
> CRYPTOPP_POSIX_ASSERT.
>
> Due to responding to CRYPTOPP_POSIX_ASSERT, I think CRYPTOPP_DEBUG and 
> accompanying comments should be moved into config.h.
>
> Any thoughts, comments or objections?
>

$ cat config.h.diff 
diff --git a/config.h b/config.h
index ab1f49a..8a55a6e 100644
--- a/config.h
+++ b/config.h
@@ -53,15 +53,35 @@
...
 
+// Only one or the other, but not both
+#if (defined(DEBUG) || defined(_DEBUG)) && (defined(NDEBUG) || 
defined(_NDEBUG))
+# error Both DEBUG and NDEBUG are defined.
+#endif
+
+// CRYPTOPP_POSIX_ASSERT unconditionally disables the library assert and 
yields to
+//   Posix assert. Note that you always get an assert if CRYPTOPP_DEBUG is 
defined.
+//   If you don't want an assert, then be sure to define Posix's NDEBUG or 
_NDEBUG.
+// #define CRYPTOPP_POSIX_ASSERT 1
+
+// We recognize two build types: debug and release. If NDEBUG is defined, 
then its
+//   a Release build *without* asserts. Otherwise, its a Debug build 
*with* asserts.
+//   If the developer does not build with either NDEBUG or DEBUG, then we 
error on
+//   the side of security and stability, and presume its a Debug build.
+//   CRYPTOPP_ASSERT will alert to problems it detects, like NULL 
pointers, 0 sizes,
+//   overflow and undefined behavior.
+#if !defined(NDEBUG) && !defined(_NDEBUG)
+# define CRYPTOPP_DEBUG 1
+#endif
+
 

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to