aboutsummaryrefslogtreecommitdiffstats
path: root/README-maintainer
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-03 14:21:01 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-04 00:31:22 +0200
commit62bf296a9c0f5be492f0677ed111b3fa217f4c11 (patch)
treef49564b3d70a12ee4e16e84c4e4e33a2adce1133 /README-maintainer
parent92b692466f7a4dbf4e51e6a77713c029a3e18ab1 (diff)
downloadqpdf-62bf296a9c0f5be492f0677ed111b3fa217f4c11.tar.zst
Make assert handling less error-prone
Prevent my future self or other contributors from using assert in tests and then having that assert not do anything because of the NDEBUG macro.
Diffstat (limited to 'README-maintainer')
-rw-r--r--README-maintainer22
1 files changed, 17 insertions, 5 deletions
diff --git a/README-maintainer b/README-maintainer
index 2e11a11b..88e81461 100644
--- a/README-maintainer
+++ b/README-maintainer
@@ -123,11 +123,23 @@ CODING RULES
"Code Formatting" section in manual/contributing.rst for details.
See also "CODE FORMATTING" below.
-* Do not use assert in non-test code for any purpose other than as a
- sanity check during development that would be safe to remove in
- production. assert is for strong invariant checking. When developing
- and using assert for that purpose, make sure to use the Debug
- configuration since assert is disabled in other configurations.
+* Use of assert:
+
+ * Test code: #include <qpdf/assert_test.h> first.
+ * Debug code: #include <qpdf/assert_debug.h> first and use
+ qpdf_assert_debug instead of assert.
+
+ These rules are enforced by the check-assert test. This practices
+ serves to
+
+ * remind us that assert in release code disappears and so should only
+ be used for debugging; when doing so use a Debug build
+ configuration
+
+ * protect us from using assert in test code without explicitly
+ removing the NDEBUG definition, since that would cause the assert
+ not to actually be testing anything in non-Debug build
+ configurations.
* In a source file, include the header file that declares the source
class first followed by a blank line. If a config file is needed