{"id":19059,"url":"https://patchwork.libcamera.org/api/1.1/patches/19059/?format=json","web_url":"https://patchwork.libcamera.org/patch/19059/","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":"<20230919133943.32035-1-laurent.pinchart@ideasonboard.com>","date":"2023-09-19T13:39:43","name":"[libcamera-devel] meson: Simplify check for _FORTIFY_SOURCE","commit_ref":"1d616141420d1f51e5999d758e3e0cc721a46290","pull_url":null,"state":"accepted","archived":false,"hash":"24fb3be39af863bd96435c790e6d79a2c0bfa81b","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/19059/mbox/","series":[{"id":4032,"url":"https://patchwork.libcamera.org/api/1.1/series/4032/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4032","date":"2023-09-19T13:39:43","name":"[libcamera-devel] meson: Simplify check for _FORTIFY_SOURCE","version":1,"mbox":"https://patchwork.libcamera.org/series/4032/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19059/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19059/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 6DF73C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Sep 2023 13:39:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C515861DE9;\n\tTue, 19 Sep 2023 15:39:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 59F2C61DE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Sep 2023 15:39:31 +0200 (CEST)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EA3A9BB2;\n\tTue, 19 Sep 2023 15:37:54 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695130772;\n\tbh=WI68LWN9mTTayG8DJzCdoND8Gfky1LXPXpknrGL/Tig=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=zaXQxKdXYiT2VpNU/Is7kCOs+pxR0tQ1Vh6azXLEo4VM2+T6QnWNf9r1ESuhtcIVN\n\tkoRc6jtqnAqQgB0kQU4T8Ms2bAV9RWWxxWgBMXlXc/NUjdbbgX/rIp6rkf1ne/vwEk\n\tTLHN0ysfwYfXwCeE1PB54zqSG5Ye4q72n4uNPjtYINBwUiczEYsp4iA6h84HBfnMu9\n\tlLtYmgzk+Xye9VvAwtc2GSpLpXp0cHox4iYgL+c3m5FLp6LuJ3w/7Z0lF5A+k1Lfky\n\tHqnydAT9R2GZEcW8GgEdwOAzG280OV1skvQhKWODSZhk0oIAhpi4g9Z8Wavua/ej+X\n\ttVfw0FhpaSf+A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1695130675;\n\tbh=WI68LWN9mTTayG8DJzCdoND8Gfky1LXPXpknrGL/Tig=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=jKIez08Iq7UC9bpo6+u9D4b6Z/f25+imZAEURIuG0osZ551P/YINxydAZahRmY5qF\n\tXu6sOqvksUSauNmE/U8wuwov0ZNYEhEjLKChWokMVVcuyrZfJtd5oo0AC7VLwP/XdK\n\tLk9DWLHzvcpYRqNUXiHH8fb8NMLBY8HqDxGVhmsU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"jKIez08I\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 19 Sep 2023 16:39:43 +0300","Message-ID":"<20230919133943.32035-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.41.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] meson: Simplify check for _FORTIFY_SOURCE","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>","Cc":"George Burgess IV <gbiv@google.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use the compiler.get_define() function to get the value of\n_FORTIFY_SOURCE instead of iterating over the cpp_args. This simplies\nthe code, but also guarantees to return the actual value of\n_FORTIFY_SOURCE, even if defined through other means than through the\nmeson cpp_args.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n meson.build | 14 +++-----------\n 1 file changed, 3 insertions(+), 11 deletions(-)\n\n\nbase-commit: 9c5eb9237cf6ae170086f0d4d87a025aa052cc9f","diff":"diff --git a/meson.build b/meson.build\nindex 2e8342630332..e9a1c7e360ce 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -104,17 +104,9 @@ if cc.get_id() == 'clang'\n     # result in macro redefinition errors if the user already has a setting for\n     # `-D_FORTIFY_SOURCE`. Do not enable FORTIFY in either of those cases.\n     if get_option('optimization') != '0'\n-        has_fortify_define = false\n-        # Assume that if the user requests a FORTIFY level in cpp_args, they\n-        # do the same for c_args.\n-        foreach flag : get_option('cpp_args')\n-            if flag == '-U_FORTIFY_SOURCE'\n-                has_fortify_define = false\n-            elif flag.startswith('-D_FORTIFY_SOURCE=')\n-                has_fortify_define = true\n-            endif\n-        endforeach\n-        if not has_fortify_define\n+        fortify = cc.get_define('_FORTIFY_SOURCE')\n+        if fortify == ''\n+            message('Adding _FORTIFY_SOURCE')\n             common_arguments += [\n                 '-D_FORTIFY_SOURCE=2',\n             ]\n","prefixes":["libcamera-devel"]}