Patch Detail
Show a patch.
GET /api/1.1/patches/9674/?format=api
{ "id": 9674, "url": "https://patchwork.libcamera.org/api/1.1/patches/9674/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9674/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200920173447.10064-1-laurent.pinchart@ideasonboard.com>", "date": "2020-09-20T17:34:47", "name": "[libcamera-devel] Documentation: Adjust guidelines regarding math.h header", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8d210554c592478c25fb55f6c34f4a2d83eb02b4", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9674/mbox/", "series": [ { "id": 1300, "url": "https://patchwork.libcamera.org/api/1.1/series/1300/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1300", "date": "2020-09-20T17:34:47", "name": "[libcamera-devel] Documentation: Adjust guidelines regarding math.h header", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1300/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9674/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9674/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 141B5C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 20 Sep 2020 17:35:26 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 986F662FBF;\n\tSun, 20 Sep 2020 19:35:25 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5DAE962E65\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 20 Sep 2020 19:35:23 +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 D0EAC2D7;\n\tSun, 20 Sep 2020 19:35:22 +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=\"rGqYO5q1\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600623323;\n\tbh=mGWKYAUOUhb9R5hPBlWA+kxWJrhVepOAcGRrhACVHMc=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=rGqYO5q1zCIIlvugTqmwbIJB/dZAJYIf+KOM5ZZFc4Fdv0AcnUladMA2yfO7FNKBR\n\t+Iw5hcX8YpL+FvUeQIccuBAGw7hW7+0Yc58/OEjAQc8BeFxwT1uYRRejtMqg6CjyBh\n\tmG6zqv3EJFmKe1uoclAQtcF0E+NqVcHXSPf1SrOw=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 20 Sep 2020 20:34:47 +0300", "Message-Id": "<20200920173447.10064-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH] Documentation: Adjust guidelines\n\tregarding math.h header", "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": "While libcamera prefers usage of the C standard library headers (xxx.h)\nover the C++ version (cxxx), we make an exception for cmath as the\noverloaded versions of the math functions are convenient. Document this,\nand adjust checkstyle.py accordingly.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/coding-style.rst | 14 +++++++++++---\n utils/checkstyle.py | 6 +++---\n 2 files changed, 14 insertions(+), 6 deletions(-)\n\nJacopo, this originates from a discussion in the review of \"[PATCH]\nlibcamera: ipu3: Fix compilation issues with gcc5\". I haven't assigned\nthe authorship to you as you didn't provide a formal patch with an SoB\nline. Please let me know if I should (and give me your SoB in that\ncase). Otherwise, a review is always appreciated :-)", "diff": "diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst\nindex 7c56a1b70014..d467a5a1b1ad 100644\n--- a/Documentation/coding-style.rst\n+++ b/Documentation/coding-style.rst\n@@ -195,9 +195,17 @@ them, defines C compatibility headers. The former have a name of the form\n <cxxx> while the later are named <xxx.h>. The C++ headers declare names in the\n std namespace, and may declare the same names in the global namespace. The C\n compatibility headers declare names in the global namespace, and may declare\n-the same names in the std namespace. Usage of the C compatibility headers is\n-strongly preferred. Code shall not rely on the optional declaration of names in\n-the global or std namespace.\n+the same names in the std namespace. Code shall not rely on the optional\n+declaration of names in the global or std namespace.\n+\n+Usage of the C compatibility headers is preferred, except for the math.h header.\n+Where math.h defines separate functions for different argument types (e.g.\n+abs(int), labs(long int), fabs(double) and fabsf(float)) and requires the\n+developer to pick the right function, cmath defines overloaded functions\n+(std::abs(int), std::abs(long int), std::abs(double) and std::abs(float) and let\n+the compiler select the right function. This avoids potential errors such as\n+calling abs(int) with a float argument, performing an unwanted implicit integer\n+conversion. For this reason, cmath is preferred over math.h.\n \n \n Documentation\ndiff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex b594a19aed5b..d5dc26c0f666 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -244,9 +244,9 @@ class IncludeChecker(StyleChecker):\n patterns = ('*.cpp', '*.h')\n \n headers = ('assert', 'ctype', 'errno', 'fenv', 'float', 'inttypes',\n- 'limits', 'locale', 'math', 'setjmp', 'signal', 'stdarg',\n- 'stddef', 'stdint', 'stdio', 'stdlib', 'string', 'time', 'uchar',\n- 'wchar', 'wctype')\n+ 'limits', 'locale', 'setjmp', 'signal', 'stdarg', 'stddef',\n+ 'stdint', 'stdio', 'stdlib', 'string', 'time', 'uchar', 'wchar',\n+ 'wctype')\n include_regex = re.compile('^#include <c([a-z]*)>')\n \n def __init__(self, content):\n", "prefixes": [ "libcamera-devel" ] }