From patchwork Tue Dec 11 19:26:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 153507 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp998311ljp; Tue, 11 Dec 2018 11:26:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/XwnSKWUt9oK+nKnANh99OyeaYbYdO9EAG0YJBRPhBhoF+OGnDl08hZZ1V9/qpH2YwH6swX X-Received: by 2002:a17:902:b20e:: with SMTP id t14mr17248662plr.128.1544556419515; Tue, 11 Dec 2018 11:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544556419; cv=none; d=google.com; s=arc-20160816; b=jxdRUopynk24F5v++LbGlz5k05eHzdBNWRLUkVBNKxjJeOev95MSI++D3D5u5JVje/ g9aX5Z+S58g7nR9vDyILd6Xl9t5dkux6fpbOhFfF2C+ES1FPQCb/WgmI3c6UVMWQ+UKA g7//SOb3kL7feQkoCy11zn7Lhxgaknf8m2TcOe67kkOtsPVPCzr0S5ai8Y1RRF7+847W /9KyESeCJmvfch5WG3oniWRtoHH7AbpqLRFvUfBtpqE8DdsV3GbuwXxVIWjfUY0FYxbY OJGVTBuhW7Mbj3kYlvkHU694tQYVrYImLplCiNZkLPqSqYuCWJ/BZ7r2oVhXn/KIgstI fASA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=U93LIt9NNB4o6Z1SQsN6G1j33Bh3uRpmCJvIZW1+iK4=; b=BlXReDmlEpHQjUzaGzoVEjmigGLrOg/QPgyenFUzDItg83xKGFyZjTCzttWc+RpeVa LEDIiaqH14oAPCfgktzDK+OYCHcB++LMIj6fid3NaGGHcTSK/mA+F5nCW5E3wWzHVvmo RBPDjeRflPIcakM+zMWybxGvv10JGXqiChUVt7qEzla5iNQ7HaH0l+LAIfkOhzUBxNx5 8U8dglC+GuDzQJcHAwN1+wxKywGFpM+wY0LI/ZVoVr2uXDfBSTVbo6GgG7o7ndRzOYvN a1L0AUZJ0nwXczx+f+hzxPT0bJSdaCUoEztY++tARvodu9GTSUdwHhCM6zbrVEFQOSSL 9zZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca6si13856544plb.141.2018.12.11.11.26.59; Tue, 11 Dec 2018 11:26:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbeLKT06 (ORCPT + 31 others); Tue, 11 Dec 2018 14:26:58 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55976 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726340AbeLKT0y (ORCPT ); Tue, 11 Dec 2018 14:26:54 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3878215AB; Tue, 11 Dec 2018 11:26:54 -0800 (PST) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 292D53F6A8; Tue, 11 Dec 2018 11:26:53 -0800 (PST) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Will Deacon , Alan Hayward , Szabolcs Nagy Subject: [PATCH 1/3] kbuild: install_headers.sh: Strip _UAPI from #if-defined() guards Date: Tue, 11 Dec 2018 19:26:45 +0000 Message-Id: <1544556407-19897-2-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1544556407-19897-1-git-send-email-Dave.Martin@arm.com> References: <1544556407-19897-1-git-send-email-Dave.Martin@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org install_headers.sh knows how to strip the _UAPI prefix from #ifdef/ ifndef and #define directives used to guard headers against multiple or inappropriate inclusion. Currently this does not work for guards in the "#if defined()" style, which may be needed for non-trivial cases. This patch adds similar logic so that the _UAPI prefix is also stripped from guard directives written using "#if defined()" etc. This is not completely foolproof, but will work for simple cases of using #if defined() to guard against inappropriate header inclusion. Signed-off-by: Dave Martin --- scripts/headers_install.sh | 1 + 1 file changed, 1 insertion(+) -- 2.1.4 diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index 593f8879..fe1d3fc 100755 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh @@ -38,6 +38,7 @@ do -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \ -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \ + -e ':1;s/(#(if|elif)(.*[^A-Za-z0-9_])defined\([[:space:]]*)_UAPI/\1/;t1' \ "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1 scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ > "$OUTDIR/$FILE"