{"id":2640,"url":"https://patchwork.libcamera.org/api/1.1/patches/2640/?format=json","web_url":"https://patchwork.libcamera.org/patch/2640/","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":"<20200114001531.27129-1-laurent.pinchart@ideasonboard.com>","date":"2020-01-14T00:15:30","name":"[libcamera-devel,1/2] meson.build: Switch to C++14","commit_ref":"9a61a134669c2240100fd1ccadaf974f86fe4655","pull_url":null,"state":"accepted","archived":false,"hash":"3ceb42feca6917f107bb91272a648ca9cf7f9253","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/2640/mbox/","series":[{"id":620,"url":"https://patchwork.libcamera.org/api/1.1/series/620/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=620","date":"2020-01-14T00:15:30","name":"[libcamera-devel,1/2] meson.build: Switch to C++14","version":1,"mbox":"https://patchwork.libcamera.org/series/620/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2640/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2640/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 0272060702\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jan 2020 01:15:47 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc108967-cmbg20-2-0-cust420.5-4.cable.virginm.net [81.101.7.165])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7923530E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jan 2020 01:15:47 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578960947;\n\tbh=wceF9cUB3SziXZwvMyXPXfMjMv+J4WHIo1MXAibWKXs=;\n\th=From:To:Subject:Date:From;\n\tb=KisGdOLqhlgcKF55xIsd+eBwgKUdY0e8TnjkMQVT1TwAJTvusQoHuUBIKmC/7uTFA\n\tm6w+HE5ESCnobKq0bNT25HZ8fSvRl1PsJ4dEsLOca6zR2wMvqdeENv4PAjuHjpe4qi\n\tqxezoZWU1I2/BkE3PvgQepU1xxecDgXeGTidkerc=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 14 Jan 2020 02:15:30 +0200","Message-Id":"<20200114001531.27129-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.24.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/2] meson.build: Switch to C++14","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>","X-List-Received-Date":"Tue, 14 Jan 2020 00:15:48 -0000"},"content":"C++14 is a minor release that doesn't introduce major new concepts or\nparadigms compared to C++11, but brings two useful changes for us:\n\n- std::make_unique allows dropping our custom implementation in utils.\n- Functions returning constexpr are not assumed to be const anymore,\n  which is needed to create a standard-conformant span implementation.\n\nAll the g++ and clang++ versions we support and test (g++-5 onwards and\nclang++6 onwards) support C++14. However, due to a defect in the\noriginal C++14 specification, solved in N4387 ([1]), compilation would\nfail on g++-5 due to the use of std::map::emplace() with a non-copyable\nvalue type. It turns out we can easily fix it by switching to the\nexplicit piecewise emplace() overload.\n\nThere is thus really nothing holding back the switch. Let's do it, and\nupdate the coding style accordingly.\n\n[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/coding-style.rst | 23 +++++++++--------------\n meson.build                    |  2 +-\n src/ipa/rkisp1/rkisp1.cpp      |  4 +++-\n 3 files changed, 13 insertions(+), 16 deletions(-)","diff":"diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst\nindex 9939c7b1e86d..bbc1f2fb18c6 100644\n--- a/Documentation/coding-style.rst\n+++ b/Documentation/coding-style.rst\n@@ -86,22 +86,17 @@ headers, and with double quotes for other libcamera headers.\n C++ Specific Rules\n ------------------\n \n-The code shall be implemented in C++03, extended with the following\n-C++-11-specific features:\n-\n-* Initializer lists\n-* Type inference (auto and decltype)\n-  Type inference shall be used with caution, to avoid drifting towards an\n-  untyped language.\n-* Range-based for loop\n-* Lambda functions\n-* Explicit overrides and final\n-* Null pointer constant\n-* General-purpose smart pointers (std::unique_ptr), deprecating std::auto_ptr.\n+The code shall be implemented in C++14, 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   overused.\n-* Variadic class and function templates\n-* rvalue references, move constructor and move assignment\n+* Classes are encouraged to define move constructors and assignment operators\n+  where applicable, and generally make use of the features offered by rvalue\n+  references.\n \n Object Ownership\n ~~~~~~~~~~~~~~~~\ndiff --git a/meson.build b/meson.build\nindex 634488589a46..37cf4d665f7b 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -4,7 +4,7 @@ project('libcamera', 'c', 'cpp',\n     default_options : [\n         'werror=true',\n         'warning_level=2',\n-        'cpp_std=c++11',\n+        'cpp_std=c++14',\n     ],\n     license : 'LGPL 2.1+')\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 74b2922004be..a8dd1645d3e8 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -104,7 +104,9 @@ void IPARkISP1::configure(const std::map<unsigned int, IPAStream> &streamConfig,\n void IPARkISP1::mapBuffers(const std::vector<IPABuffer> &buffers)\n {\n \tfor (const IPABuffer &buffer : buffers) {\n-\t\tauto elem = buffers_.emplace(buffer.id, buffer.planes);\n+\t\tauto elem = buffers_.emplace(std::piecewise_construct,\n+\t\t\t\t\t     std::forward_as_tuple(buffer.id),\n+\t\t\t\t\t     std::forward_as_tuple(buffer.planes));\n \t\tconst FrameBuffer &fb = elem.first->second;\n \n \t\t/*\n","prefixes":["libcamera-devel","1/2"]}