Show a patch.

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

{
    "id": 17563,
    "url": "https://patchwork.libcamera.org/api/patches/17563/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17563/",
    "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": "<20221009044440.21499-3-laurent.pinchart@ideasonboard.com>",
    "date": "2022-10-09T04:44:40",
    "name": "[libcamera-devel,2/2] libcamera: base: utils: Drop defopt",
    "commit_ref": "e0e54965df015b954d75ebe945221372f2dffb80",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e4cd2207a402a3d54d34edbbb89d2208520bbf01",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17563/mbox/",
    "series": [
        {
            "id": 3543,
            "url": "https://patchwork.libcamera.org/api/series/3543/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3543",
            "date": "2022-10-09T04:44:38",
            "name": "libcamera: Fix compilation with gcc 8.3.0",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3543/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17563/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17563/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 DC8A2C327C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  9 Oct 2022 04:44:52 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34F1162D50;\n\tSun,  9 Oct 2022 06:44:52 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E19CA62D49\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  9 Oct 2022 06:44:49 +0200 (CEST)",
            "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 48D499C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  9 Oct 2022 06:44:49 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665290692;\n\tbh=Y1wygcPwghVzW4K6saB4YoVPipBJTeHDFj0IBQZn83k=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=cM4u3TBxnQlY9p/SpQ81XqDR9aenbBVl+u/svCSeFt6dyCLm2PaYtvcPVZb+A/3r2\n\tKKBqKy2lJgur8Eh95lsU0jy4SyAdP/QzGTjkEpaKzmDyxfkSueGPGx5q9UvJn6FMoo\n\tyxX4fltqUQ0CgDbbNJLQfwW222/rbC71iMsbVDu5dktCY7hTO6KgkMbB2PMNjdiU4U\n\tVFdZx+UGDXpzpegb2UGt/fUvux0lXhfJCzq5+fqsfb40JsiEVl/tA7c51k6t+MK+rU\n\tIxInzuDKxD7qgtjyhVPAObduz5D4HH9sKz5cpmjugYpB8ZS4bTCtqEIeGojf732Vgl\n\tKnDTqAbFERfyQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1665290689;\n\tbh=Y1wygcPwghVzW4K6saB4YoVPipBJTeHDFj0IBQZn83k=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=mcZUYp9zUgq0VPFcdakQ0kTb3EsIrjiv3TVqgT+aAgyFdSoY3souTrS7M59sIGRAQ\n\tyQGOZnkEf5iP8Sm0eEkkchvwD6PrOBKOQWd4ln/uVmzUAX0O1fVPi4FakgDLWcQNhR\n\t0kNQdz62RNYgEyxAKFch0xjGp9X5RKwfR9WINBAw="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"mcZUYp9z\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun,  9 Oct 2022 07:44:40 +0300",
        "Message-Id": "<20221009044440.21499-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "In-Reply-To": "<20221009044440.21499-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20221009044440.21499-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] libcamera: base: utils: Drop defopt",
        "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>",
        "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "utils::defopt causes compilation issues on gcc 8.0.0 to gcc 8.3.0,\nlikely due to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521\nthat was fixed in gcc 8.4.0. gcc 8.3.0 may be considered old (libcamera\nrequires gcc-8 or newer), but it is shipped by Debian 10 that has LTS\nsupport until mid-2024.\n\nAs no workaround has been found to fix compilation on gcc 8.3.0 while\nstill retaining the functionality of utils::defopt, remove it from the\nlibcamera base library. This change could be reverted once support for\ngcc-8 will be dropped.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/base/utils.h | 14 ---------\n src/libcamera/base/utils.cpp   | 21 --------------\n test/utils.cpp                 | 53 ----------------------------------\n 3 files changed, 88 deletions(-)",
    "diff": "diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\nindex ed88b7163770..eb7bcdf4c173 100644\n--- a/include/libcamera/base/utils.h\n+++ b/include/libcamera/base/utils.h\n@@ -367,20 +367,6 @@ decltype(auto) abs_diff(const T &a, const T &b)\n \t\treturn a - b;\n }\n \n-namespace details {\n-\n-struct defopt_t {\n-\ttemplate<typename T>\n-\toperator T() const\n-\t{\n-\t\treturn T{};\n-\t}\n-};\n-\n-} /* namespace details */\n-\n-constexpr details::defopt_t defopt;\n-\n } /* namespace utils */\n \n #ifndef __DOXYGEN__\ndiff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp\nindex 9cd6cb197243..6a307940448e 100644\n--- a/src/libcamera/base/utils.cpp\n+++ b/src/libcamera/base/utils.cpp\n@@ -463,27 +463,6 @@ std::string toAscii(const std::string &str)\n  * \\a b\n  */\n \n-/**\n- * \\var defopt\n- * \\brief Constant used with std::optional::value_or() to create a\n- * default-constructed object\n- *\n- * The std::optional<T>::value_or(U &&default_value) function returns the\n- * contained value if available, or \\a default_value if the std::optional has no\n- * value. If the desired default value is a default-constructed T, the obvious\n- * option is to call std::optional<T>::value_or(T{}). This approach has two\n- * drawbacks:\n- *\n- * * The \\a default_value T{} is constructed even if the std::optional instance\n- *   has a value, which impacts efficiency.\n- * * The T{} default constructor needs to be spelled out explicitly in the\n- *   value_or() call, leading to long lines if the type is complex.\n- *\n- * The defopt variable solves these issues by providing a value that can be\n- * passed to std::optional<T>::value_or() and get implicitly converted to a\n- * default-constructed T.\n- */\n-\n } /* namespace utils */\n \n #ifndef __DOXYGEN__\ndiff --git a/test/utils.cpp b/test/utils.cpp\nindex 58b5a59dd17d..fc56e14ee734 100644\n--- a/test/utils.cpp\n+++ b/test/utils.cpp\n@@ -170,55 +170,6 @@ protected:\n \t\treturn TestPass;\n \t}\n \n-\tint testDefopt()\n-\t{\n-\t\tstatic bool defaultConstructed = false;\n-\n-\t\tstruct ValueType {\n-\t\t\tValueType()\n-\t\t\t\t: value_(-1)\n-\t\t\t{\n-\t\t\t\tdefaultConstructed = true;\n-\t\t\t}\n-\n-\t\t\tValueType(int value)\n-\t\t\t\t: value_(value)\n-\t\t\t{\n-\t\t\t}\n-\n-\t\t\tint value_;\n-\t\t};\n-\n-\t\t/*\n-\t\t * Test that utils::defopt doesn't cause default-construction\n-\t\t * of a ValueType instance when value_or(utils::defopt) is\n-\t\t * called on a std::optional that has a value.\n-\t\t */\n-\t\tstd::optional<ValueType> opt = ValueType(0);\n-\t\tValueType value = opt.value_or(utils::defopt);\n-\n-\t\tif (defaultConstructed || value.value_ != 0) {\n-\t\t\tstd::cerr << \"utils::defopt didn't prevent default construction\"\n-\t\t\t\t  << std::endl;\n-\t\t\treturn TestFail;\n-\t\t}\n-\n-\t\t/*\n-\t\t * Then test that the ValueType is correctly default-constructed\n-\t\t * when the std::optional has no value.\n-\t\t */\n-\t\topt = std::nullopt;\n-\t\tvalue = opt.value_or(utils::defopt);\n-\n-\t\tif (!defaultConstructed || value.value_ != -1) {\n-\t\t\tstd::cerr << \"utils::defopt didn't cause default construction\"\n-\t\t\t\t  << std::endl;\n-\t\t\treturn TestFail;\n-\t\t}\n-\n-\t\treturn TestPass;\n-\t}\n-\n \tint run()\n \t{\n \t\t/* utils::hex() test. */\n@@ -339,10 +290,6 @@ protected:\n \t\tif (testDuration() != TestPass)\n \t\t\treturn TestFail;\n \n-\t\t/* utils::defopt test. */\n-\t\tif (testDefopt() != TestPass)\n-\t\t\treturn TestFail;\n-\n \t\treturn TestPass;\n \t}\n };\n",
    "prefixes": [
        "libcamera-devel",
        "2/2"
    ]
}