Show a patch.

GET /api/patches/26675/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26675,
    "url": "https://patchwork.libcamera.org/api/patches/26675/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26675/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260507135019.231615-1-barnabas.pocze@ideasonboard.com>",
    "date": "2026-05-07T13:50:18",
    "name": "[v1,1/2] libcamera: base: log: Remove log level check for \"Fatal\" messages",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "088cd2cb1d365bdf6c6d3f241c304e2ffe8a8095",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26675/mbox/",
    "series": [
        {
            "id": 5918,
            "url": "https://patchwork.libcamera.org/api/series/5918/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5918",
            "date": "2026-05-07T13:50:18",
            "name": "[v1,1/2] libcamera: base: log: Remove log level check for \"Fatal\" messages",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5918/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26675/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26675/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 82930BDCB5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 May 2026 13:50:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2283062FE1;\n\tThu,  7 May 2026 15:50:25 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A16862010\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 May 2026 15:50:23 +0200 (CEST)",
            "from pb-laptop.local (185.221.140.217.nat.pool.zt.hu\n\t[185.221.140.217])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F257A9CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 May 2026 15:50:18 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"WHiaXJRj\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778161819;\n\tbh=Cbz7nGOmKR6jtyclUktyqIFsQT2l1B7AgHO3NPLOyY0=;\n\th=From:To:Subject:Date:From;\n\tb=WHiaXJRjkJfxiojNCTTkBknEf8Rs40uHZoR/hhrsjmzC//LY2o+nZ6BJhI2d8CCKJ\n\tPyhNr+GX3X9KUECzjbRr/ekMq7h4egA1pOrFrIVx9u1DoX/6W8jqMC45YDNlA1v6Up\n\t29IEqM/cFj/hSc0zOfbQs8LbdtaP7sNV4UFaGIsM=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v1 1/2] libcamera: base: log: Remove log level check for\n\t\"Fatal\" messages",
        "Date": "Thu,  7 May 2026 15:50:18 +0200",
        "Message-ID": "<20260507135019.231615-1-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When a fatal log message is used, it is expected that it will be displayed\nand will in some way abort the execution. Since the log level of each\nmessage is known at compile time, the log level check can be short-circuited\nif a fatal message is intended.\n\nThis also essentially reverts 2318a2863baa (\"libcamera: base: log: Inline `LOG()` into `ASSERT()`\")\nas there is no need to inline the `_log()` calls to avoid the runtime condition.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/base/log.h | 30 +++++++++++++++++++++---------\n 1 file changed, 21 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h\nindex 0751387a4..5cb14311e 100644\n--- a/include/libcamera/base/log.h\n+++ b/include/libcamera/base/log.h\n@@ -108,10 +108,22 @@ LogMessage _log(const LogCategory &category, LogSeverity severity,\n #ifndef __DOXYGEN__\n #define _LOG_CATEGORY(name) logCategory##name\n \n-#define _LOG(cat, sev)                                                 \\\n-\tswitch (const auto &_logCategory = (cat);                      \\\n-\t\tstatic_cast<int>(_logCategory.severity() <= Log##sev)) \\\n-\tcase 1:                                                        \\\n+/* Returns `int` to avoid `-Wswitch-bool` below. */\n+template<LogSeverity Severity>\n+constexpr int isLogSeverityEnabled(const LogCategory &category)\n+{\n+\tstatic_assert(LogDebug <= Severity && Severity <= LogFatal);\n+\n+\tif constexpr (Severity < LogFatal)\n+\t\treturn static_cast<unsigned int>(category.severity()) <= Severity;\n+\telse\n+\t\treturn true;\n+}\n+\n+#define _LOG(cat, sev)                                        \\\n+\tswitch (const auto &_logCategory = (cat);             \\\n+\t\tisLogSeverityEnabled<Log##sev>(_logCategory)) \\\n+\tcase 1:                                               \\\n \t\t_log(_logCategory, Log##sev).stream()\n \n #define _LOG1(severity) \\\n@@ -130,11 +142,11 @@ LogMessage _log(const LogCategory &category, LogSeverity severity,\n #endif /* __DOXYGEN__ */\n \n #ifndef NDEBUG\n-#define ASSERT(condition) static_cast<void>(({                          \\\n-\tif (!(condition))                                               \\\n-\t\t_log(LogCategory::defaultCategory(), LogFatal).stream() \\\n-\t\t\t<< \"assertion \\\"\" #condition \"\\\" failed in \"    \\\n-\t\t\t<< __func__ << \"()\";                            \\\n+#define ASSERT(condition) static_cast<void>(({                       \\\n+\tif (!(condition))                                            \\\n+\t\tLOG(Fatal)                                           \\\n+\t\t\t<< \"assertion \\\"\" #condition \"\\\" failed in \" \\\n+\t\t\t<< __func__ << \"()\";                         \\\n }))\n #else\n #define ASSERT(condition) static_cast<void>(false && (condition))\n",
    "prefixes": [
        "v1",
        "1/2"
    ]
}