From patchwork Fri Feb 1 05:17:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 157171 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp8071267jaa; Thu, 31 Jan 2019 21:17:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7CgTsaNc0brOIVxX+2ZpoWL49FqTsfSF6V8yXE3COyDpsOxf+C7Jh9P0ForNgBdIk5pIZR X-Received: by 2002:a62:8dd9:: with SMTP id p86mr37351640pfk.143.1548998252048; Thu, 31 Jan 2019 21:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548998252; cv=none; d=google.com; s=arc-20160816; b=NZouJ2KdEQjtAzkljEPHZrWdY1oqznK6922+RfC1UWsq634CoKzzSHkARhKhI5zmeg xFz1lIh2t3v5v8d2ZAtjg0rlDiCDStrpEeyfahNTNqI1T9ZWeZpKEn85bHYmRf3I03I1 CqVkMlCzZSuz23xWu0hdohJKLgBwBE0ZLIc3kdGaKCZlJF8aKA3vwFt1lqLCh4sT8W0B FCREH8bTSi9Ld3rE7OvhZyN7zDauDx9HZfXrINfGO05+zaT3d+W2KkHY/psCd05wkpy5 TrL/Ge6fBBYLt1M6gbYP9pu1hxLY4sKvztvBQ1Yzw6cNYiucC0b/OXsK8Fuj6CRAXDM4 T/Aw== 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=FaR119jAdGD4QGHRMDpV5WFN8B/6Hk/IY6gld7g/VZk=; b=yPqd45Dxj+qcRVMFoA5NYVQ+ZOp4K4uLRfqgkhjMpp4ZZNDVxqb0ZsdsQPGIAmK44I SU7LSfJO/uGoZ+IgSzdsAGnIwBUt6PZCrwpe5L5BzND7h6KZAQ/DSIxPf4otHp+ySZrG 2PaJnbh0ZQfUaPdEihLJIjWuyo19WPscjHiKLzWvAkxq2HrThiA4rBdbHwcHSdPFGYQ+ /qQx99Eo4+6fAvrby5B6WXQrDbpwdQ+H/0OOaqKtSZS+fir38+T5wKoTMlrKU4opJtnM qJIC+9pbkJYwnVZ7BrHPs54BguNPndeK1vV7ziMOLhsJn8e05+LbbKtCbQ3eP2Dm9GVG fUJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=UzJOsVGw; 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 o10si6304869pgg.373.2019.01.31.21.17.30; Thu, 31 Jan 2019 21:17:32 -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=UzJOsVGw; 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 D0EE97C4AD; Fri, 1 Feb 2019 05:17:25 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by mail.openembedded.org (Postfix) with ESMTP id B85457C238 for ; Fri, 1 Feb 2019 05:17:23 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id c123so2605493pfb.0 for ; Thu, 31 Jan 2019 21:17:25 -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=IePCzmVUeo/wi2j41zVs0Ff1sRnPrznliGdOYvAenwM=; b=UzJOsVGw9x+/7gnlIWmQi8vCDuLejVX6gwHegwoh50/KMvuUv7B3HkLudTHvCYWGFE 9w3dwL0XkuiSISgsZkkH+E655z49UfSzl64yQmjThghobSAJKOmppT0779xJ+bn6Td8O Ji4UJX3HEA56zprjU787P1tJaAFUq1iQmgogpyS7SNmvFETm1LBVwAyX1Y6fZNUTSNdg Emc3H4iuB5gwDMoBtFrl3KEyequGlwhw7uEdalVF9dsjtmolzdQnRFP8MBx9OJbKItZo rn9BGOoKuii1d/nmvvceQS9FDGPJupi6F+ZGZ3fCJe2JqqCWUzAZ+HILPqv84JkIkk77 CURg== 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=IePCzmVUeo/wi2j41zVs0Ff1sRnPrznliGdOYvAenwM=; b=r88f7YgcRGSaPmIZlubS2S+c40w3kl3DFronGxcGSAth+aJCqNTgEq4tLlZzZ7lr6J DiHfP5I4uJ7fVuLFHXq9YqYVR8FMa/ucsCGxSKobpNC8lSBbDaLHN4WBPaTfGVPJCMHb EPaYaFxV9bXaeRq/x1mLA8bZMg8i2i98DCBPSX/TW76rF3a17R+TkHFb8FFuZ1gKk00s RgkmUDc4EzpxYQy6yiVETi7UymbODn0x+2riNuLm+UABFcCUkP2JXTov6KRHNzcUT7YZ b8vjwGw0PEOLkXe4p5G9vKelCFjw0jLJw1Q64GhyV1p/pskBow4FDfB+1SWijaguPaIo UiIw== X-Gm-Message-State: AJcUukfeTD3w7vXAfPxEdZPjdkukv01C8QczbhfSuaw68rjmuQzu3Ecx Xbyrcnokj3BgDNdJbMLIEYBFPKaO X-Received: by 2002:a62:b15:: with SMTP id t21mr39248480pfi.136.1548998244060; Thu, 31 Jan 2019 21:17:24 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:8500:6bc6::5276]) by smtp.gmail.com with ESMTPSA id z7sm8809076pga.6.2019.01.31.21.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 21:17:23 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Date: Thu, 31 Jan 2019 21:17:16 -0800 Message-Id: <20190201051716.41462-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [OE-core] [PATCH V3] 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 -> __OE_BITS_WORDSIZE_H__ and emits the guard at beginning of file Signed-off-by: Khem Raj --- v2: Drop space changes, not needed, and fix a typo > to >> v3: Prepend `OE` to include guard to make it not conflict with other headers meta/classes/multilib_header.bbclass | 7 +++++-- 1 file changed, 5 insertions(+), 2 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..2036dc8594 100644 --- a/meta/classes/multilib_header.bbclass +++ b/meta/classes/multilib_header.bbclass @@ -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/^/__OE_/' | 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 }