tap: import some changes Import some changes from: http://git.efficios.com/?p=babeltrace.git;a=tree;f=tests/utils/tap;h=fa181570e8d9b79801d8a8358aca00633856994e;hb=a165a5742a2b173e59900e515caa3b37a0afb42f Most importantly, the `extern "C"` allowing the use of this file in C++. Change-Id: I796dd0e07fe89ba84db97b8735705bae7e39d43c Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Increase REUSE compliance See https://reuse.software/[REUSE] to learn more. Leaving files in `m4` not REUSE-compliant because I don't know their exact license. Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Change-Id: Ie9f8cd2a7b9c69e3f3ca8bd2e06588ed51980fbb
argpar.{c,h}: fix clang-tidy issues Fix these issues: /home/smarchi/src/argpar/argpar/argpar.h:344:9: warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses] 344 | _item = NULL; \ | ^ | ( ) argpar.c:525:34: warning: 'iter->tmp_buf.data' may be set to null if 'realloc' fails, which may result in a leak of the original buffer [bugprone-suspicious-realloc-usage] 525 | iter->tmp_buf.data = ARGPAR_REALLOC(iter->tmp_buf.data, char, iter->tmp_buf.size); | ~~~~~~~~~~~~~~~~~~ ^ argpar.c:15:56: note: expanded from macro 'ARGPAR_REALLOC' 15 | #define ARGPAR_REALLOC(_ptr, _type, _nmemb) ((_type *) realloc(_ptr, (_nmemb) * sizeof(_type))) | ^ ~~~~ Change-Id: I2e42059f8c4c744e10bdbc7c78b2628a53cd60d7 Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Add clang-tidy configuration file Copied from: https://git.lttng.org/?p=lttng-tools.git;a=blob;f=.clang-tidy;h=75f559c5d961041df8e37280ef27cb0cac8cdd96;hb=20c4b46aee1a984bc558b483826c1078f24d35e9 Then adapted to the project: - Remove `HeaderFilterRegex` - Put `ARGPAR_ASSERT` for the `AssertMacros` option - Remove `CharTypdefsToIgnore` option - Fix a . -> , typo Change-Id: I275b7fa7fbfa324ca8d948712b12d46eb885ab57 Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
configure.ac: call `AC_USE_SYSTEM_EXTENSIONS` earlier When bootstrapping, with autoconf 2.72, I see: autoreconf: running: /usr/bin/autoconf configure.ac:7: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS m4/ac_extensions.m4:38: AC_USE_SYSTEM_EXTENSIONS is expanded from... configure.ac:7: the top level Move the call to `AC_USE_SYSTEM_EXTENSIONS` earlier to avoid that. Change-Id: I836889d9816708530ddbd7c66d8e2c331eadbead Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Add clang-format config file and re-format with clang-format 15 Add a clang-format config file, copied from: http://git.efficios.com/?p=babeltrace.git;a=blob;f=.clang-format;h=cba562531157c82aefa5a16f861ef044fa5388e0;hb=a165a5742a2b173e59900e515caa3b37a0afb42f Adjust it slightly to remove the things that are only relevant in the context of babeltrace. Re-format all C files with clang-format 15. Change-Id: If80c93c139d08fafaf11a8fd8dbca23fb80d4aca Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
argpar.{c,h}: remove `ARGPAR_HIDDEN` from header file The `ARGPAR_HIDDEN` macro confuses clang-format, and it gives an ugly result. Remove it from the header file, it's not useful to have it exposed anyway. Change-Id: I7a307144017416fe890d6546eaa61890e0ce217e Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Add and use type definitions for structures and enumerations Using the `_t` suffix to avoid changing the current API because `enum argpar_item_type` has the same name as the argpar_item_type() function. Using those new type definitions everywhere to make sure they work. Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Change-Id: I87bcd2abd40ff91779b9c82b4b9b8a7afb535fb3
tests: rename `test_argpar.c` -> `test-argpar.c` Follows the convention of other EfficiOS projects (well of Babeltrace 2 at least, which I also maintain as of this date). Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Change-Id: Ib25f6e08f728969d7d6a2a9d81d1328c7d503638
Force usage of ARGPAR_ASSERT() condition when NDEBUG is defined This preventive fix is added to prevent future `-Wunused` warnings in `assert()` statement when building with NDEBUG defined. There are currently no such warning in the argpar project but there used to be one. Because the LTTng-Tools project currently (commit 4f002736e) uses an older argpar version I am seeing this warning: argpar.c: In function ‘argpar_vasprintf’: argpar.c:63:12: error: variable ‘len2’ set but not used [-Werror=unused-but-set-variable] 63 | int len1, len2; Reuse the BT2 approach to force the usage of the assertion condition even when assert() are removed by the NDEBUG define. See `BT_USE_EXPR()` macro and documentation in Babeltrace commit[0]: commit 1778c2a4134647150b199b2b57130817144446b0 Author: Philippe Proulx <eeppeliteloop@gmail.com> Date: Tue Apr 21 11:15:42 2020 -0400 lib: assign a unique ID to each pre/postcond. and report it on failure 0: https://github.com/efficios/babeltrace/commit/1778c2a4134647150b199b2b57130817144446b0 Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Change-Id: Id71f1f67013cfcf4799ef95a6830babb2dcea973