You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled onto an interesting bug related to the use of asserts() and the -DNDEBUG compiler flag. I have been experimenting with using CMake to build Cligen (you can find that attempt here: https://github.com/theonemcdonald/cligen/tree/cmake).
The CMake default CFLAGS for each build type are as follows:
The failure case can be readily observed by compiling Cligen with -DNDEBUG and running the cligen_hello test application. In this case, typing hello<tab><tab><tab>... causes Cligen to just keep repeating the hello keyword:
building without -DNDEBUG yields the correct behavior:
The issue appears to be related to an assert() call having undesired side-effects.
After consulting with Olof, we determined this to be a likely culprit that should be explored further:
cligen_match.c:239:18: warning: variable 'levels' is uninitialized when used here [-Wuninitialized]
if (level >= levels)
^~~~~~
cligen_match.c:236:15: note: initialize the variable 'levels' to silence this warning
int levels;
^
= 0
The text was updated successfully, but these errors were encountered:
I stumbled onto an interesting bug related to the use of
asserts()
and the-DNDEBUG
compiler flag. I have been experimenting with using CMake to build Cligen (you can find that attempt here: https://github.com/theonemcdonald/cligen/tree/cmake).The CMake default CFLAGS for each build type are as follows:
The failure case can be readily observed by compiling Cligen with
-DNDEBUG
and running thecligen_hello
test application. In this case, typinghello<tab><tab><tab>...
causes Cligen to just keep repeating thehello
keyword:building without
-DNDEBUG
yields the correct behavior:The issue appears to be related to an
assert()
call having undesired side-effects.After consulting with Olof, we determined this to be a likely culprit that should be explored further:
cligen/cligen_match.c
Line 238 in 9e6f5ad
The text was updated successfully, but these errors were encountered: