All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 1/2] multilib_header: Place a #include guard to avoid infinite inclusion of headers
@ 2019-02-02 19:43 Khem Raj
  2019-02-02 19:43 ` [PATCH 2/2] llvm, mesa: Upgrade to upcoming 8.0.0 release Khem Raj
  0 siblings, 1 reply; 2+ messages in thread
From: Khem Raj @ 2019-02-02 19:43 UTC (permalink / raw)
  To: openembedded-core

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 <raj.khem@gmail.com>
---
V2:
 - No Changes, just rebased

 meta/classes/multilib_header.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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
 }
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-02 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-02 19:43 [PATCH V2 1/2] multilib_header: Place a #include guard to avoid infinite inclusion of headers Khem Raj
2019-02-02 19:43 ` [PATCH 2/2] llvm, mesa: Upgrade to upcoming 8.0.0 release Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.