From patchwork Fri Feb 1 04:06:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 157168 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp8020635jaa; Thu, 31 Jan 2019 20:06:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IYonveDwWOuxjdBkKDjw2RJ8CokOVqyRzhbtWcYYFSiu5CxLcPN3vkH84l06r2pl5Qn8JrT X-Received: by 2002:a63:5d20:: with SMTP id r32mr665819pgb.329.1548994011933; Thu, 31 Jan 2019 20:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548994011; cv=none; d=google.com; s=arc-20160816; b=JBxcPVIlStvxMzSCXF4n49GBgng8BQCgzMve0wW+6MiNIitOHUnG5dh7DbaW3UaW9u hA/Y7Vytw5z1XSZSxm6c9uDp8Rph18Z9m7K8DX89RjXObRK7otnhs2lgqTFQ41eMBXCB +O2PIiQ1mJoWRY9wU2OWlA2ZG2MCDOmn5AXSNq7deOv1fqzgkQnRjwMcfO6qFia3pYGs jcB+t6P1dFRN+aF0etEpr7XrlEmq9R0H/tq8zgocoRSos64+Z+A/7SJVKctCgEn2rOLG xwuR0ljZjirBnVXB23X+FNeEXG62X0jknZw2SizQ4GqzMv6ZCI6x9T/te8Ti7RajM80e ch0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:delivered-to; bh=hOyCN4rpAUkgooaF4s9wFQ41F9X3n43IfDVc3paPPss=; b=M3/GAnTRF0oH2jtBbSthku/AspEHXdObe6MprRFgkwLbGVdXRsqgO5rtIdHb6LMEgO 3qYOJ9ncujVtoSew0ewwOOnxwpwnfHob9BaLIYGRKxu65o4w8vSLt5mrOIVOobshU+Nz GKTaCBZgqWV5JEnATup/7fymnXIGNYi1eqQeMVqeDlFe/hMU1kEBmGAfwB86wXgaGvfX W9hOpnBPmvPKaja707lnGspWOnnjokQ1XB0K3DqgWPY2jbeJPlJLuciWP7pJXaCtUjBD 42ek3xebz995uIVVGHaLtR8KBDwW2aRI4q6xIvp2gILK4T2DWrJg28WQ93TsBnqcbNm0 9k4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=h9ErdW7X; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id b91si6424378plb.11.2019.01.31.20.06.51; Thu, 31 Jan 2019 20:06:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=h9ErdW7X; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 6275A7C3FF; Fri, 1 Feb 2019 04:06:48 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by mail.openembedded.org (Postfix) with ESMTP id 3A1367C2CC for ; Fri, 1 Feb 2019 04:06:46 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id c73so2487145pfe.13 for ; Thu, 31 Jan 2019 20:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CntbPpWMowS3uoWzNxI9LpHWuxzQpR4uNp/B/kcS2oQ=; b=h9ErdW7X19bA60+d70td69HuxXaUCoEundEWl7KgU8aCArR+g85WLUhILabGgANKM8 LfGCokZ6ZMiqBLtv7xaFEX6ZJkUwoY6TF0Ws9SP5bxNnq+wN6Cn1QTL8mY97jzwXmQkU jmto4NZfM+Z7jIsEIsjVhIDGctDdaDLbRN/o21o7n6L1kGObjWQSzgSXW4pk6yRkuUO4 VkflwFXUaOIufy8MBjaUEeQQ+3VW7dH4byi1YVV3ztzxCXZT2vmYqOcwSDVv61IhFjnF bx9CQQQNBvOL9HIu+UOFCy4+klnymvnoc+Gp4aBjKLHucBSETodrH25yk1cU8nEp2XdY KQ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CntbPpWMowS3uoWzNxI9LpHWuxzQpR4uNp/B/kcS2oQ=; b=iGhwx7L8d5rpdQMwOCIFW9+dGjl+ohLXOJdIWmQ8tJcnlPI+Mtzoz7uoUgAwdiIwJJ BKqWkzE9VSBcYnVCv//cp6CKq9UkcGgDZ2dw2qGHqgfUuzGxaCjwR0vHXT4mdhr9xYsn JQUdUj06Gm+HjuKbDOND7UtLhZciBCUvV2vjEeWlpnjpJ5NR9RDrQM6bIXPTKUdBKEHT HefgTrVd/HmNJOMw4GY88X5fbUpt67RnNsmup+f9jHqI0axNAHCclT48+rMczkaUvSjf CllvMRyvH/Bucth4nQiBggFo9zy/ldCDHMOYRYbhLUL7JGGf//m2yljM3AjZelJvyfGM ihgQ== X-Gm-Message-State: AHQUAuZoPYLpTCe2tGzHKScNp4wO+RpBSO0xG6G1eo0zIIJZjhLAt02t KRNly4+lkp6Ta/Q4A/e7tTVVKQm/KkE= X-Received: by 2002:a63:680a:: with SMTP id d10mr732548pgc.396.1548994006394; Thu, 31 Jan 2019 20:06:46 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:8500:6bc6::5276]) by smtp.gmail.com with ESMTPSA id p77sm10970083pfi.85.2019.01.31.20.06.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 20:06:45 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Date: Thu, 31 Jan 2019 20:06:38 -0800 Message-Id: <20190201040638.25250-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [OE-core] [PATCH] multilib_header: Place a #include guard to avoid infinite inclusion of headers X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org In cases where extra preprocessing tools are used such as clang-tidy e.g. and these tools are not passed the knowledge about architecture then a corner case comes where we enter into include loop for bits/wordsize.h, since this template does explicitly include bits/wordsize.h so it synthesized a guard out of file name e.g. bits/wordsize.h -> __BITS_WORDSIZE_H__ and emits the guard at beginning of file Signed-off-by: Khem Raj --- meta/classes/multilib_header.bbclass | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.20.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/classes/multilib_header.bbclass b/meta/classes/multilib_header.bbclass index e03f5b13b2..959e9cac74 100644 --- a/meta/classes/multilib_header.bbclass +++ b/meta/classes/multilib_header.bbclass @@ -18,9 +18,9 @@ oe_multilib_header() { case ${TARGET_ARCH} in mips*) case "${MIPSPKGSFX_ABI}" in "-n32") - ident=n32 + ident=n32 ;; - *) + *) ident=${SITEINFO_BITS} ;; esac @@ -33,10 +33,13 @@ oe_multilib_header() { continue fi stem=$(echo $each_header | sed 's#\.h$##') + include_guard=$(echo $each_header | tr '/.' '_' | tr '[a-z]' '[A-Z]' | sed 's/^/__/' | sed 's/$/__/') # if mips64/n32 set ident to n32 mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${ident}.h - - sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header + echo "#ifndef $include_guard" > ${D}/${includedir}/$each_header + echo "#define $include_guard" >> ${D}/${includedir}/$each_header + sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h >> ${D}/${includedir}/$each_header + echo "#endif /* $include_guard */" > ${D}/${includedir}/$each_header done }