anchao commented on code in PR #10978:
URL: https://github.com/apache/nuttx/pull/10978#discussion_r1365064046


##########
include/assert.h:
##########
@@ -42,60 +42,68 @@
 #undef DEBUGASSERT  /* Like ASSERT, but only if CONFIG_DEBUG_ASSERTIONS is 
defined */
 #undef DEBUGVERIFY  /* Like VERIFY, but only if CONFIG_DEBUG_ASSERTIONS is 
defined */
 
-#if !defined(CONFIG_HAVE_FILENAME) || 
!defined(CONFIG_DEBUG_ASSERTIONS_FILENAME)
+/* Macro to define the assertions file name and file line
+ * | Function         |CONFIG                            | Show name/line |
+ * | ---              | ---                              | ---            |
+ * |assert(), ASSERT()|CONFIG_ASSERTIONS_FILENAME=y      | Yes            |
+ * |assert(), ASSERT()|CONFIG_ASSERTIONS_FILENAME=n      | No             |
+ * |DEBUGASSERT()     |CONFIG_DEBUG_ASSERTIONS_FILENAME=y| Yes            |
+ * |DEBUGASSERT()     |CONFIG_DEBUG_ASSERTIONS_FILENAME=n| No             |
+ */
+
+#ifdef CONFIG_HAVE_FILENAME
+#  ifdef CONFIG_DEBUG_ASSERTIONS_FILENAME
+#    define __DEBUG_ASSERT_FILE__ __FILE__
+#    define __DEBUG_ASSERT_LINE__ __LINE__
+#  endif
+#  ifdef CONFIG_ASSERTIONS_FILENAME
+#    define __ASSERT_FILE__ __FILE__
+#    define __ASSERT_LINE__ __LINE__
+#  endif
+#endif
+
+#ifndef __DEBUG_ASSERT_FILE__
+#  define __DEBUG_ASSERT_FILE__ 0
+#  define __DEBUG_ASSERT_LINE__ 0
+#endif
+
+#ifndef __ASSERT_FILE__
 #  define __ASSERT_FILE__ 0
 #  define __ASSERT_LINE__ 0
-#else
-#  define __ASSERT_FILE__ __FILE__
-#  define __ASSERT_LINE__ __LINE__
 #endif
 
-#define PANIC() __assert(__ASSERT_FILE__, __ASSERT_LINE__, "panic")
-#define PANIC_WITH_REGS(msg, regs) _assert(__ASSERT_FILE__, \
-                                           __ASSERT_LINE__, msg, regs)
+#define PANIC() __assert(__DEBUG_ASSERT_FILE__, __DEBUG_ASSERT_LINE__, "panic")
+#define PANIC_WITH_REGS(msg, regs) _assert(__DEBUG_ASSERT_FILE__, \
+                                           __DEBUG_ASSERT_LINE__, msg, regs)

Review Comment:
   Addressed! Thank you!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to