Skip to contentSkip to conversation

multilib_header: Place a #include guard to avoid infinite inclusion of headers

PATCH New Khem Raj 1 participant 2 messages Feb 2, 2019

v2 of 3 New Latest is v3 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/2 multilib_header: Place a #include guard to avoid infinite inclusion of headers

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

---
V2:
- No Changes, just rebased

 meta/classes/multilib_header.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta/classes/multilib_header.bbclass +5 -2
index e03f5b13b2..2036dc8594 100644
@@ -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
 }
 
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 2/2 llvm, mesa: Upgrade to upcoming 8.0.0 release

License-Update: Copyright year updates from 2017-2019

Refresh patches to apply on new version

mesa move dep to the llvm release to 8.0
Needs to happen along with llvm upgrade always

---
V2:
- merge mesa and llvm changes together to be atomic
- Redo llvm packaging, to avoid per library split we only have static (.a) files for components
- Bump LLVM to 8.0.0 RC1

 ...ryInfo-Undefine-libc-functions-if-th.patch | 28 +++---
 ...-llvm-allow-env-override-of-exe-path.patch | 66 +++++++++++---
 meta/recipes-devtools/llvm/llvm_git.bb        | 86 ++++++++-----------
 meta/recipes-graphics/mesa/mesa.inc           |  2 +-
 4 files changed, 105 insertions(+), 77 deletions(-)
meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch +13 -15
index 209764c8ba..6dbbced7eb 100644
@@ -1,24 +1,22 @@
-From 96558c4f25d5132936014f6f2d6252cfdfdf478a Mon Sep 17 00:00:00 2001
+From 905cac8934fb17e20416a4df712a566e757471a3 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Sat, 21 May 2016 00:33:20 +0000
-Subject: [PATCH 1/2] llvm: TargetLibraryInfo: Undefine libc functions if they
- are macros
+Subject: [PATCH 1/2] llvm: TargetLibraryInfo: Undefine libc functions if they are macros
 
 musl defines some functions as macros and not inline functions
 if this is the case then make sure to undefine them
 
+Upstream-Status: Pending
 Signed-off-by: Khem Raj <[email protected]>
 ---
-Upstream-Status: Pending
-
  include/llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
 
 diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def
-index a461ed813b9..f9fd9faeee0 100644
+index 518a85ee1a0..6b4ead4efc6 100644
 --- a/include/llvm/Analysis/TargetLibraryInfo.def
 +++ b/include/llvm/Analysis/TargetLibraryInfo.def
-@@ -665,6 +665,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
+@@ -731,6 +731,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
  TLI_DEFINE_ENUM_INTERNAL(fopen)
  TLI_DEFINE_STRING_INTERNAL("fopen")
  /// FILE *fopen64(const char *filename, const char *opentype)
@@ -27,8 +25,8 @@ index a461ed813b9..f9fd9faeee0 100644
 +#endif
  TLI_DEFINE_ENUM_INTERNAL(fopen64)
  TLI_DEFINE_STRING_INTERNAL("fopen64")
- /// int fprintf(FILE *stream, const char *format, ...);
-@@ -700,6 +703,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
+ /// int fork();
+@@ -778,6 +781,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
  /// int fseeko(FILE *stream, off_t offset, int whence);
  TLI_DEFINE_ENUM_INTERNAL(fseeko)
  TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -38,7 +36,7 @@ index a461ed813b9..f9fd9faeee0 100644
  /// int fseeko64(FILE *stream, off64_t offset, int whence)
  TLI_DEFINE_ENUM_INTERNAL(fseeko64)
  TLI_DEFINE_STRING_INTERNAL("fseeko64")
-@@ -710,6 +716,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
+@@ -788,6 +794,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
  TLI_DEFINE_ENUM_INTERNAL(fstat)
  TLI_DEFINE_STRING_INTERNAL("fstat")
  /// int fstat64(int filedes, struct stat64 *buf)
@@ -48,7 +46,7 @@ index a461ed813b9..f9fd9faeee0 100644
  TLI_DEFINE_ENUM_INTERNAL(fstat64)
  TLI_DEFINE_STRING_INTERNAL("fstat64")
  /// int fstatvfs(int fildes, struct statvfs *buf);
-@@ -725,6 +734,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
+@@ -803,6 +812,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
  TLI_DEFINE_ENUM_INTERNAL(ftello)
  TLI_DEFINE_STRING_INTERNAL("ftello")
  /// off64_t ftello64(FILE *stream)
@@ -58,7 +56,7 @@ index a461ed813b9..f9fd9faeee0 100644
  TLI_DEFINE_ENUM_INTERNAL(ftello64)
  TLI_DEFINE_STRING_INTERNAL("ftello64")
  /// int ftrylockfile(FILE *file);
-@@ -845,6 +857,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
+@@ -929,6 +941,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
  TLI_DEFINE_ENUM_INTERNAL(lstat)
  TLI_DEFINE_STRING_INTERNAL("lstat")
  /// int lstat64(const char *path, struct stat64 *buf);
@@ -68,7 +66,7 @@ index a461ed813b9..f9fd9faeee0 100644
  TLI_DEFINE_ENUM_INTERNAL(lstat64)
  TLI_DEFINE_STRING_INTERNAL("lstat64")
  /// void *malloc(size_t size);
-@@ -1064,6 +1079,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
+@@ -1154,6 +1169,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
  TLI_DEFINE_ENUM_INTERNAL(stat)
  TLI_DEFINE_STRING_INTERNAL("stat")
  /// int stat64(const char *path, struct stat64 *buf);
@@ -78,7 +76,7 @@ index a461ed813b9..f9fd9faeee0 100644
  TLI_DEFINE_ENUM_INTERNAL(stat64)
  TLI_DEFINE_STRING_INTERNAL("stat64")
  /// int statvfs(const char *path, struct statvfs *buf);
-@@ -1193,6 +1211,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
+@@ -1283,6 +1301,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
  TLI_DEFINE_ENUM_INTERNAL(tmpfile)
  TLI_DEFINE_STRING_INTERNAL("tmpfile")
  /// FILE *tmpfile64(void)
@@ -89,5 +87,5 @@ index a461ed813b9..f9fd9faeee0 100644
  TLI_DEFINE_STRING_INTERNAL("tmpfile64")
  /// int toascii(int c);
 -- 
-2.16.1
+2.20.1
 
meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch +54 -12

105 lines not on this page · raw message

meta/recipes-devtools/llvm/llvm_git.bb +37 -49

133 lines not on this page · raw message

meta/recipes-graphics/mesa/mesa.inc +1 -1
index e96a12c1b9..66ed649efe 100644
@@ -105,7 +105,7 @@ GALLIUMDRIVERS_append = ",virgl"
 
 # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers
 PACKAGECONFIG[gallium]      = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
-MESA_LLVM_RELEASE ?= "6.0"
+MESA_LLVM_RELEASE ?= "8.0"
 PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \
                                ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
 export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
Signature · 1 line
2.20.1