summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-30 19:52:04 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-04-27 22:50:23 +0100
commit7065ad84f00537046ff15555bb60de6a7db274aa (patch)
treee996a8c0a364d71d6ac0f40ff8bbff2265376032
parent0f2189ba309baf4b7c26443a7e53c81e979d6f62 (diff)
libcamera: internal: log: Report function on asserts
Report the function which fails an assertion as well as the actual assertion. This now reports as: [30:08:53.218816270] [226567] FATAL default request.cpp:150 assertion "d" failed in reuse() rather than: [30:11:05.271888926] [228531] FATAL default request.cpp:150 assertion "d" failed Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--include/libcamera/internal/log.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h
index be0bab3c..b66bf55b 100644
--- a/include/libcamera/internal/log.h
+++ b/include/libcamera/internal/log.h
@@ -117,9 +117,10 @@ LogMessage _log(const LogCategory *category, LogSeverity severity,
#endif /* __DOXYGEN__ */
#ifndef NDEBUG
-#define ASSERT(condition) static_cast<void>(({ \
- if (!(condition)) \
- LOG(Fatal) << "assertion \"" #condition "\" failed"; \
+#define ASSERT(condition) static_cast<void>(({ \
+ if (!(condition)) \
+ LOG(Fatal) << "assertion \"" #condition "\" failed in " \
+ << __func__ << "()"; \
}))
#else
#define ASSERT(condition) static_cast<void>(false && (condition))