Force usage of ARGPAR_ASSERT() condition when NDEBUG is defined
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 20 Aug 2021 18:39:02 +0000 (14:39 -0400)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 31 Aug 2021 14:00:47 +0000 (10:00 -0400)
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


No differences found
This page took 0.02261 seconds and 4 git commands to generate.