taisei: Fix build with clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2024-11-22 01:21:37 -08:00
parent 73c46b265d
commit ee89518454
2 changed files with 41 additions and 0 deletions
@@ -0,0 +1,40 @@
From 6f40a8cfbc4dd5ca4c3156338e8e35f25d4d4599 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 22 Nov 2024 01:16:25 -0800
Subject: [PATCH] util/consideredharmful: Use overloadable func attribute with
clang
When building with glibc HEAD, it has fortified headers with clang as well
and clang reports errors e.g.
| ../git/src/util/consideredharmful.h:33:7: error: redeclaration of 'strncat' must have the 'overloadable' attribute
| 33 | char* strncat();
| | ^
| /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/taisei/1.4.2/recipe-sysroot/usr/include/bits/string_fortified.h:145:8: note: previous overload of function is here
| 145 | __NTH (strncat (__fortify_clang_overload_arg (char *, __restrict, __dest),
| | ^
Upstream-Status: Submitted [https://github.com/taisei-project/taisei/pull/393]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/util/consideredharmful.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/consideredharmful.h b/src/util/consideredharmful.h
index 3fe1f047..c6771956 100644
--- a/src/util/consideredharmful.h
+++ b/src/util/consideredharmful.h
@@ -30,11 +30,11 @@ FILE* fopen();
#undef strncat
attr_deprecated("This function likely doesn't do what you expect, use strlcat")
-char* strncat();
+char* __attribute__((overloadable)) strncat();
#undef strncpy
attr_deprecated("This function likely doesn't do what you expect, use strlcpy")
-char* strncpy();
+char* __attribute__((overloadable)) strncpy();
#undef errx
attr_deprecated("Use log_fatal instead")
@@ -31,6 +31,7 @@ RDEPENDS_${PN} = "\
"
SRC_URI = "gitsm://github.com/taisei-project/taisei.git;branch=v1.4.x;protocol=https \
file://0001-util-consideredharmful-Use-overloadable-func-attribu.patch \
file://0001-Remove-strip-option-from-executable-build.patch"
SRCREV = "c098579d4fa0f004ccc204c5bc46eac3717cba28"