From 7fc95bb0a3f244873bd8760d2259d607e9f6dd62 Mon Sep 17 00:00:00 2001 From: "Benoit D.-M. - oslandia" <64401067+benoitdm-oslandia@users.noreply.github.com> Date: Mon, 27 Jan 2025 09:48:17 +0100 Subject: [PATCH] doc: add todo about std::source_location for logMessage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Loïc Bartoletti --- python/PyQt6/core/auto_generated/qgsmessagelog.sip.in | 7 ------- python/core/auto_generated/qgsmessagelog.sip.in | 7 ------- src/core/qgsmessagelog.h | 8 ++++++++ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in b/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in index 832d9fd0ef4c..dae700f6b340 100644 --- a/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in +++ b/python/PyQt6/core/auto_generated/qgsmessagelog.sip.in @@ -34,13 +34,6 @@ window for the user. static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true, const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ); -%Docstring -Adds a ``message`` to the log instance (and creates it if necessary). - -If ``notifyUser`` is ``True``, then the message should be brought to the user's attention by various UI hints. -If it is ``False``, the message should appear in logs silently. Note that log viewer implementations may -only respect notification hints for certain message levels. -%End signals: diff --git a/python/core/auto_generated/qgsmessagelog.sip.in b/python/core/auto_generated/qgsmessagelog.sip.in index 832d9fd0ef4c..dae700f6b340 100644 --- a/python/core/auto_generated/qgsmessagelog.sip.in +++ b/python/core/auto_generated/qgsmessagelog.sip.in @@ -34,13 +34,6 @@ window for the user. static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true, const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() ); -%Docstring -Adds a ``message`` to the log instance (and creates it if necessary). - -If ``notifyUser`` is ``True``, then the message should be brought to the user's attention by various UI hints. -If it is ``False``, the message should appear in logs silently. Note that log viewer implementations may -only respect notification hints for certain message levels. -%End signals: diff --git a/src/core/qgsmessagelog.h b/src/core/qgsmessagelog.h index 4a5f81716479..f6d6057ef76d 100644 --- a/src/core/qgsmessagelog.h +++ b/src/core/qgsmessagelog.h @@ -51,6 +51,14 @@ class CORE_EXPORT QgsMessageLog : public QObject * If it is FALSE, the message should appear in logs silently. Note that log viewer implementations may * only respect notification hints for certain message levels. */ + // TODO: Update this code to use std::source_location from C++20 when transitioning to a fully C++20-compliant codebase. + // Currently, we rely on __builtin_XXX functions (e.g., __builtin_FILE(), __builtin_LINE()), + // which have been successfully tested across multiple systems (Windows, macOS, Linux, FreeBSD) + // and compilers (LLVM, GCC, MSVC). + // Note: We tested with LLVM on FreeBSD and macOS, and std::experimental::source_location is not available. + // It works fine with GNU. It also seems unavailable with MSVC. + // For now, we stick with __builtin_XXX because it is "portable" and functional across all tested environments. + // We'll switch to std::source_location once the transition to C++20 is complete. static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true, const char *file = __builtin_FILE(), const char *function = __builtin_FUNCTION(), int line = __builtin_LINE() );