Patch Detail
Show a patch.
GET /api/patches/11128/?format=api
{ "id": 11128, "url": "https://patchwork.libcamera.org/api/patches/11128/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11128/", "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": "<20210204035951.23751-1-laurent.pinchart@ideasonboard.com>", "date": "2021-02-04T03:59:50", "name": "[libcamera-devel,1/2] libcamera: Add macro to conditionally use [[nodiscard]]", "commit_ref": "6dfa2040820d44584a1c5430f42dfc9b1ea56c9a", "pull_url": null, "state": "accepted", "archived": false, "hash": "d4ff114d0b249823b0c3f6fb6ece68bf452d9be3", "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/11128/mbox/", "series": [ { "id": 1648, "url": "https://patchwork.libcamera.org/api/series/1648/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1648", "date": "2021-02-04T03:59:50", "name": "[libcamera-devel,1/2] libcamera: Add macro to conditionally use [[nodiscard]]", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1648/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11128/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11128/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 2C054BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 4 Feb 2021 04:00:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D866613F8;\n\tThu, 4 Feb 2021 05:00:18 +0100 (CET)", "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 23A5E613DA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Feb 2021 05:00:17 +0100 (CET)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9B1155A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Feb 2021 05:00:16 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nRHx/Xuv\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1612411216;\n\tbh=JKkU5tDdpjA+IoDcO3tP0tc2j9O4b4X99oYhJ30Vyf4=;\n\th=From:To:Subject:Date:From;\n\tb=nRHx/XuvRiGWAMNon9oTbbkZq3BsVF50H9iw0NAZhwO6Lam+/UFtoLbTJ3EpAkh2C\n\tPwLgshv+wCVkZSRDJCfANyMw9kRlKj3W07lZurP0UeQlIDZejMjqc38muzaM4e9Py+\n\tfnfkcezZC5DrjbQZssroDIO3g3b0ITVa+9UrvkR8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 4 Feb 2021 05:59:50 +0200", "Message-Id": "<20210204035951.23751-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.28.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: Add macro to conditionally\n\tuse [[nodiscard]]", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The [[nodiscard]] attribute has been added to C++17. It can thus be used\ninside libcamera, but would prevent applications compiled for C++14 to\nuse libcamera if the attribute was used in public headers.\n\nTo offer this feature when the application is compiled with a\nrecent-enough C++ version, as well as for compiling libcamera itself,\nadd a __nodiscard macro that expands as [[nodiscard]] when using C++17\nor newer.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/compiler.h | 16 ++++++++++++++++\n include/libcamera/meson.build | 1 +\n 2 files changed, 17 insertions(+)\n create mode 100644 include/libcamera/compiler.h", "diff": "diff --git a/include/libcamera/compiler.h b/include/libcamera/compiler.h\nnew file mode 100644\nindex 000000000000..dc56dbb8b792\n--- /dev/null\n+++ b/include/libcamera/compiler.h\n@@ -0,0 +1,16 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021, Google Inc.\n+ *\n+ * compiler.h - Compiler support\n+ */\n+#ifndef __LIBCAMERA_COMPILER_H__\n+#define __LIBCAMERA_COMPILER_H__\n+\n+#if __cplusplus >= 201703L\n+#define __nodiscard\t\t[[nodiscard]]\n+#else\n+#define __nodiscard\n+#endif\n+\n+#endif /* __LIBCAMERA_COMPILER_H__ */\ndiff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex cf2935f1ee95..13e9eeb6d6ad 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -5,6 +5,7 @@ libcamera_public_headers = files([\n 'buffer.h',\n 'camera.h',\n 'camera_manager.h',\n+ 'compiler.h',\n 'controls.h',\n 'extensible.h',\n 'file_descriptor.h',\n", "prefixes": [ "libcamera-devel", "1/2" ] }