SPRESENSE commented on issue #10416: URL: https://github.com/apache/nuttx/issues/10416#issuecomment-1767541151
@anchao > You mean CONFIG_DEBUG is actually CONFIG_NDEBUG=y right? No. It is not about `CONFIG_NDEBUG`. The NuttX assertion has two types, `assert()`(=`ASSERT()`) and `DEBUGASSERT()`. The former is used standardly by applications. The latter is used for special debugging purposes. To prevent an increase of the code size, the `DEBUGASSERT()` code can be disabled by `CONFIG_DEBUG_ASSERTIONS=n`. | Function |CONFIG | CONFIG | Show filename/line | | --- | --- | --- | --- | |assert(), ASSERT()|CONFIG_DEBUG_ASSERTIONS=n| | No(*1) | |DEBUGASSERT() |CONFIG_DEBUG_ASSERTIONS=y|CONFIG_DEBUG_ASSERTIONS_FILENAME=n| No | |DEBUGASSERT() |CONFIG_DEBUG_ASSERTIONS=y|CONFIG_DEBUG_ASSERTIONS_FILENAME=y| Yes | (*1) When the general application uses `assert()`, the filename and line are not shown. Before your commit, the filename and line were shown. This comes from the following code. https://github.com/apache/nuttx/blob/master/include/assert.h#L45-L51 For `assert()` to print the filename and line, we need to enable `CONFIG_DEBUG=y`, `CONFIG_DEBUG_ASSERTIONS=y` and `CONFIG_DEBUG_ASSERTIONS_FILENAME=y`. It causes an increase in code size since `DEBUGASSERT()` is also enabled. Essentially, since `assert()` is also used by the application, it should show the filename and line by default, as it does on other platforms. How do you think? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org