{"id":9372,"url":"https://patchwork.libcamera.org/api/1.1/patches/9372/?format=json","web_url":"https://patchwork.libcamera.org/patch/9372/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200822200454.21718-1-laurent.pinchart@ideasonboard.com>","date":"2020-08-22T20:04:54","name":"[libcamera-devel,v1.1,1/5] meson: Switch to C++17","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"8e24057d062688422deddc693d2904b8b55a8fc8","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9372/mbox/","series":[{"id":1236,"url":"https://patchwork.libcamera.org/api/1.1/series/1236/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1236","date":"2020-08-22T20:04:54","name":"[libcamera-devel,v1.1,1/5] meson: Switch to C++17","version":1,"mbox":"https://patchwork.libcamera.org/series/1236/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9372/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9372/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 4E754BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 22 Aug 2020 20:05:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BF879626DB;\n\tSat, 22 Aug 2020 22:05:17 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CDF761EA0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 22 Aug 2020 22:05:16 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ACA2629E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 22 Aug 2020 22:05:15 +0200 (CEST)"],"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=\"ECKSTAWC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598126715;\n\tbh=LV0PC2vjP2bm4mlu2haMklg6jsDQ3ACTy1KSfV85WJE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ECKSTAWCPEKZx2KQCN9kOjtYa6k7w7biISJPC92Crs/1soTCCpydWjohRrRlGqn/1\n\t8e2w/G2wcE5YY/2mNI7FfxK5dcRSS0jxyX+LzbRWQr30AT35o7dWpjE2WgoCDYDGuG\n\tIpENv+gy+Lnqulfb5Pp5t6CbFq9ohBDOktj8Pubo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 22 Aug 2020 23:04:54 +0300","Message-Id":"<20200822200454.21718-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200822200037.20892-2-laurent.pinchart@ideasonboard.com>","References":"<20200822200037.20892-2-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v1.1 1/5] meson: Switch to C++17","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":"Due to popular request, move from C++14 to C++17. This will allow\ndropping some custom constructs (such as a custom utils::clamp),\nbenefiting from new language features, and dropping gcc 5 and 6 from the\ncompilation tests.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Update documentation\n- Print an error message when detecting a too old compiler\n---\n Documentation/coding-style.rst |  5 ++---\n meson.build                    | 29 ++++++++++++++++++-----------\n 2 files changed, 20 insertions(+), 14 deletions(-)","diff":"diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst\nindex 7acba37b8de8..7c56a1b70014 100644\n--- a/Documentation/coding-style.rst\n+++ b/Documentation/coding-style.rst\n@@ -88,13 +88,12 @@ headers, and with double quotes for other libcamera headers.\n C++ Specific Rules\n ------------------\n \n-The code shall be implemented in C++14, with the following caveats:\n+The code shall be implemented in C++17, with the following caveats:\n \n * Type inference (auto and decltype) shall be used with caution, to avoid\n   drifting towards an untyped language.\n * The explicit, override and final specifiers are to be used where applicable.\n-* General-purpose smart pointers (std::unique_ptr) deprecate std::auto_ptr.\n-  Smart pointers, as well as shared pointers and weak pointers, shall not be\n+* Smart pointers, as well as shared pointers and weak pointers, shall not be\n   overused.\n * Classes are encouraged to define move constructors and assignment operators\n   where applicable, and generally make use of the features offered by rvalue\ndiff --git a/meson.build b/meson.build\nindex ec54e68f3635..cf2636d97100 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -6,7 +6,7 @@ project('libcamera', 'c', 'cpp',\n     default_options : [\n         'werror=true',\n         'warning_level=2',\n-        'cpp_std=c++14',\n+        'cpp_std=c++17',\n     ],\n     license : 'LGPL 2.1+')\n \n@@ -62,6 +62,23 @@ if cc.get_id() == 'clang'\n     endif\n endif\n \n+if cc.get_id() == 'gcc'\n+    if cc.version().version_compare('<7')\n+        error('gcc version is too old, libcamera requires 7.0 or newer')\n+    endif\n+\n+    # gcc 7.1 introduced processor-specific ABI breakages related to parameter\n+    # passing on ARM platforms. This generates a large number of messages\n+    # during compilation with gcc >=7.1 until gcc 9. Silence them.\n+    if (host_machine.cpu_family() == 'arm' and\n+        cc.version().version_compare('>=7.1') and\n+        cc.version().version_compare('<9'))\n+        cpp_arguments += [\n+            '-Wno-psabi',\n+        ]\n+    endif\n+endif\n+\n # We use C99 designated initializers for arrays as C++ has no equivalent\n # feature. Both gcc and clang support this extension, but recent\n # versions of clang generate a warning that needs to be disabled.\n@@ -71,16 +88,6 @@ if cc.has_argument('-Wno-c99-designator')\n     ]\n endif\n \n-# gcc 7.1 introduced processor-specific ABI breakages related to parameter\n-# passing on ARM platforms. This generates a large number of messages during\n-# compilation with gcc >=7.1 until gcc 9. Silence them.\n-if (host_machine.cpu_family() == 'arm' and cc.get_id() == 'gcc' and\n-    cc.version().version_compare('>=7.1') and cc.version().version_compare('<9'))\n-    cpp_arguments += [\n-        '-Wno-psabi',\n-    ]\n-endif\n-\n c_arguments += common_arguments\n cpp_arguments += common_arguments\n \n","prefixes":["libcamera-devel","v1.1","1/5"]}