diff mbox series

[bug#69126,1/2] gnu: Add debug-assert.

Message ID 0191a95edf076b5cd24326d49e54ce13f2bdb0d4.1707924715.git.paul@apatience.com
State New
Headers show
Series gnu: Add type-safe. | expand

Commit Message

Paul A. Patience Feb. 14, 2024, 3:36 p.m. UTC
* gnu/packages/cpp.scm (debug-assert): New variable.

Change-Id: I4cee49ea2f5b761ab72bb7b063c2ea8fd99b991c
---
 gnu/packages/cpp.scm | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

Comments

Skyler Ferris Feb. 14, 2024, 9:29 p.m. UTC | #1
Things needing attention:

`guix lint` issues a warning that the beginning of the description 
starts with a lowercase letter. IMO this is reasonable because the first 
word is the name of the project, and it is a common convention for 
project names to remain lowercased (the README in the project follows 
this convention). However I am not sure how the Guix maintainers 
consider this.

The arguments form is attached to a comment saying that there are no 
tests, but it looks like the repository does contain a test in the 
`test_package` directory with a separate CMakelists.txt file. I haven't 
spent much time with the cmake build system in Guix, would it be 
reasonable to replace the check phase with a procedure that uses the 
file in this directory? If not then it might be helpful to replace the 
comment with one explaining that, while tests exist, it is not feasible 
to run them for some specific reason.

More details:

This diff applies cleanly to commit 
ac470c516e19f194228edf9e348bdbc7fc10f97a.

The following paragraph contains notes about the confidence level of 
source integrity. These notes are provided to indicate that due 
attention has been given to this matter and to provide transparency into 
the level of confidence in the source as well as the entities trusted 
with maintaining integrity. The "optimal" level of confidence is 
use-case dependent, as is the trustability of any given entity. These 
notes are provided for transparency to the committer and any other 
interested parties and should not be interpreted as criticism of the commit.

The commit used in the source form is signed by PGP key 
5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23. The key is expired but NOT 
revoked. It is available on the Ubuntu keyserver 
(http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x5de3e0509c47ea3cf04a42d34aee18f83afdeb23) 
with several other signatures, though none that are trusted by my 
keyring. It is also available on the OpenPGP keyserver 
(https://keys.openpgp.org/vks/v1/by-fingerprint/5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23) 
but without a UID, meaning the email address was not verified. Note that 
one of the UIDs listed in the Ubuntu server is "GitHub (web-flow 
commit)", implying that the GitHub server is ultimately responsible for 
maintaining integrity.

`./pre-inst-env guix build debug-assert` succeeded on my machine, an 
x86_64 Xen guest. Additionally, the following program (based on the 
example in the README) successfully compiled and produced the expected 
output.

main.cpp
```
#include <debug_assert.hpp>

struct mymodule : debug_assert::default_handler, 
debug_assert::set_level<static_cast<unsigned int>(-1)> {};

int main(void) {
     DEBUG_ASSERT(1 +1 == 3, my_module{}, debug_assert::level<2>{});
}
```

```
$ ./pre-inst-env guix shell gcc-toolchain debug-assert -C -- g++ 
-std=c++11 main.cpp
$ ./a.out
[debug assert] main.cpp:6: Assertion '1 +1 == 3' failed.
Aborted
```

The LICENSE file provided in the source repository matches the contents 
I see at https://directory.fsf.org/wiki/License:Zlib.
Paul A. Patience Feb. 15, 2024, 2:02 p.m. UTC | #2
Hello,

Thanks for reviewing my patches.

On 2024-02-14 16:29:05-05:00, Skyler Ferris wrote:
> `guix lint` issues a warning that the beginning of the description
> starts with a lowercase letter. IMO this is reasonable because the first
> word is the name of the project, and it is a common convention for
> project names to remain lowercased (the README in the project follows
> this convention). However I am not sure how the Guix maintainers
> consider this.

I was aware of the issue, and I share your opinion.
Sometimes project authors write the project name lowercased but in a
fixed-width font, in which case I use either @samp{} or @code{}, which
guix lint does not raise an error for.
However, this author does not, so I left it as such.
For what it's worth, I counted a few hundred instances of a lowercased
project name without @samp{} or @code{} in the first line of the
description across the Guix codebase.
I will leave it to the discretion of the committer.

> The arguments form is attached to a comment saying that there are no
> tests, but it looks like the repository does contain a test in the
> `test_package` directory with a separate CMakelists.txt file. I haven't
> spent much time with the cmake build system in Guix, would it be
> reasonable to replace the check phase with a procedure that uses the
> file in this directory? If not then it might be helpful to replace the
> comment with one explaining that, while tests exist, it is not feasible
> to run them for some specific reason.

The test_package directory seems to test the installation of
debug_assert with the Conan package manager, so there is nothing to do
here.

Best regards,
Paul
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 62a1923571..2456de5002 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -38,7 +38,7 @@ 
 ;;; Copyright © 2023 Liliana Marie Prikler <liliana.prikler@gmail.com>
 ;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
-;;; Copyright © 2023 Paul A. Patience <paul@apatience.com>
+;;; Copyright © 2023-2024 Paul A. Patience <paul@apatience.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3048,3 +3048,29 @@  (define-public tl-optional
 the std::optional for C++11/14/17, with support for monadic operations added in
 C++23.")
     (license license:cc0)))
+
+(define-public debug-assert
+  ;; Newer version than last release, which was in 2018, is required for
+  ;; type_safe.
+  (let ((commit "d33781479baccf52a28e5c3c5a6da5ac59b09179")
+        (revision "0"))
+    (package
+      (name "debug-assert")
+      (version (git-version "1.3.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/foonathan/debug_assert")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0njbzx767pndpl8hq5falr4c8m0xsr6njh0943xf8xkcqq6splpz"))))
+      (build-system cmake-build-system)
+      (arguments (list #:tests? #f))    ; no tests
+      (home-page "https://github.com/foonathan/debug_assert")
+      (synopsis "Assertion macro for C++")
+      (description "debug_assert is a C++11 header-only library which provides the
+@code{DEBUG_ASSERT()} macro, which among other features can be selectively
+enabled in different parts of your code.")
+      (license license:zlib))))