glouw / ctl

The C Template Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make fails

laoshaw opened this issue · comments

downloaded 3.0 release on ubuntu 20.04 inside win10/WSL2, and run make, I got:

test_str: tests/func/test_str.cc:296: int main(): Assertion `a.capacity == b.capacity()' failed.
/bin/sh: line 1:  2654 Aborted                 ./tests/func/test_str

make just runs unit / functional tests because CTL is a header only library. Looks like gcc updated and changed how string capacity resizing works. That's fine, CTL will still work like the older version of gcc.

problem is that I did not see str.h has capacity variable at all, only vec and deq have capacity.

also the newest git removed TEST_RESERVE so this error disappears.

str.h inherits vec.h, where P is defined and T is char, like:

#define P
#define T char
#include <vec.h>

It then renames vec_char to str:
#define vec_char str

https://github.com/glouw/ctl/blob/master/ctl/str.h#L14

I suppose my point with the makefile is that it's okay if it fails on str.h as CTL was built to model the standard library of an older version of GCC. Newer GCC versions are not binary compatible, and that's totally okay - CTL still works as intended. Just remove the failing test case in test_str.cc. I guarantee it works as intended

ok. Thanks!