mdadm: Drop redundant patches and fix build with clang
PATCH v2 1/1 mdadm: Drop redundant patches and fix build with clang
Several patches were being applied unnecessarily, the purpose they served at one point has either been fixed differently, or accepted upstream.
Add a new patch to make clang's diagnostics happy
Signed-off-by Khem Raj <[email protected]>
---
V2: Keep mdadm-fix-ptest-build-errors.patch
...abs-diff-in-a-standard-compliant-way.patch | 31 ++++ .../files/0001-Disable-gcc8-warnings.patch | 152 ------------------ ...smacros.h-for-major-minor-defintions.patch | 44 ----- ...h-Undefine-dprintf-before-redefining.patch | 39 ----- ...omment-to-indicate-valid-fallthrough.patch | 124 -------------- .../mdadm/files/gcc-4.9.patch | 31 ---- meta/recipes-extended/mdadm/mdadm_4.1.bb | 19 +-- 7 files changed, 39 insertions(+), 401 deletions(-) create mode 100644 meta/recipes-extended/mdadm/files/0001-Compute-abs-diff-in-a-standard-compliant-way.patch delete mode 100644 meta/recipes-extended/mdadm/files/0001-Disable-gcc8-warnings.patch delete mode 100644 meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch delete mode 100644 meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch delete mode 100644 meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch delete mode 100644 meta/recipes-extended/mdadm/files/gcc-4.9.patch
meta/recipes-extended/mdadm/files/0001-Compute-abs-diff-in-a-standard-compliant-way.patch new file +31 -0
@@ -0,0 +1,31 @@ +From b273e892bd6aaafe448f84356abb78a6d463e784 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Fri, 7 Dec 2018 17:22:39 -0800 +Subject: [PATCH] Compute abs diff in a standard compliant way + +This make it a bit less implementation defined and silences clang +warning -Wabsolute-value + +| super-intel.c:2822:20: error: taking the absolute value of unsigned type 'unsi +gned long long' has no effect [-Werror,-Wabsolute-value] + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <[email protected]> +--- + super-intel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/super-intel.c b/super-intel.c +index 6438987..10d7218 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -2819,7 +2819,7 @@ static unsigned long long calc_component_size(struct imsm_map *map, + * 2048 blocks per each device. If the difference is higher it means + * that array size was expanded and num_data_stripes was not updated. + */ +- if ((unsigned int)abs(calc_dev_size - dev_size) > ++ if ((unsigned int)abs((int)calc_dev_size - (int)dev_size) > + (1 << SECT_PER_MB_SHIFT) * member_disks) { + component_size = dev_size / member_disks; + dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n",
meta/recipes-extended/mdadm/files/0001-Disable-gcc8-warnings.patch deleted +0 -152
152 lines not on this page · raw message
meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch deleted +0 -44
44 lines not on this page · raw message
meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch deleted +0 -39
@@ -1,39 +0,0 @@ -From b431cb4e1ed060122fa300dc0008f74080d38f73 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Mon, 9 May 2016 22:03:57 +0000 -Subject: [PATCH] mdadm.h: Undefine dprintf before redefining - -dprintf is also defined in libc see -usr/include/bits/stdio2.h, this comes into -play especially when fortify sources is enabled -and compilers like clang reports the override - -In file included from policy.c:25: -./mdadm.h:1562:9: error: 'dprintf' macro redefined [-Werror,-Wmacro-redefined] - ^ -/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/qemux86/usr/include/bits/stdio2.h:145:12: note: previous definition is here - -Signed-off-by: Khem Raj <[email protected]> -Upstream-Status: Pending ---- - mdadm.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/mdadm.h b/mdadm.h -index 387e681..bb943bf 100644 ---- a/mdadm.h -+++ b/mdadm.h -@@ -1649,11 +1649,13 @@ static inline char *to_subarray(struct mdstat_ent *ent, char *container) - } - - #ifdef DEBUG -+#undef dprintf - #define dprintf(fmt, arg...) \ - fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg) - #define dprintf_cont(fmt, arg...) \ - fprintf(stderr, fmt, ##arg) - #else -+#undef dprintf - #define dprintf(fmt, arg...) \ - ({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; }) - #define dprintf_cont(fmt, arg...) \
meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch deleted +0 -124
124 lines not on this page · raw message
meta/recipes-extended/mdadm/files/gcc-4.9.patch deleted +0 -31
@@ -1,31 +0,0 @@ -From 8804bca3de1b79a7c579783b7e3a7603f43bbb48 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Fri, 2 May 2014 16:31:17 -0700 -Subject: [PATCH] mdadm: Fix build on gcc 4.9 - -super-intel.c:5063:2: error: right-hand operand of comma expression has no effect [-Werror=unused-value] - snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH, - ^ -cc1: all warnings being treated as errors -make: *** [super-intel.o] Error 1 - -Signed-off-by: Khem Raj <[email protected]> -Upstream-Status: Pending - ---- - super-intel.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/super-intel.c b/super-intel.c -index 6438987..e726987 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -5941,7 +5941,7 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose) - spare->cache_size = mpb->cache_size; - spare->pwr_cycle_count = __cpu_to_le32(1); - -- snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH, -+ (void)snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH, - MPB_SIGNATURE MPB_VERSION_RAID0); - - for (d = super->disks; d; d = d->next) {
meta/recipes-extended/mdadm/mdadm_4.1.bb +8 -11
@@ -9,24 +9,20 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ - file://gcc-4.9.patch \ + file://run-ptest \ file://mdadm-3.3.2_x32_abi_time_t.patch \ file://mdadm-fix-ptest-build-errors.patch \ file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \ - file://run-ptest \ - file://0001-mdadm.h-Undefine-dprintf-before-redefining.patch \ - file://0001-include-sys-sysmacros.h-for-major-minor-defintions.patch \ - file://0005-Add-a-comment-to-indicate-valid-fallthrough.patch \ file://0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch \ - file://0001-Disable-gcc8-warnings.patch \ + file://0001-Compute-abs-diff-in-a-standard-compliant-way.patch \ " SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598" SRC_URI[sha256sum] = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a" -CFLAGS += "-fno-strict-aliasing" -inherit autotools-brokensep +inherit autotools-brokensep ptest + +CFLAGS_append_toolchain-clang = " -Wno-error=address-of-packed-member" -EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"' # PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h # prevents 64-bit userland from seeing this definition, instead defaulting # to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
@@ -35,6 +31,8 @@ CFLAGS_append_powerpc64 = ' -D__SANE_USERSPACE_TYPES__' CFLAGS_append_mipsarchn64 = ' -D__SANE_USERSPACE_TYPES__' CFLAGS_append_mipsarchn32 = ' -D__SANE_USERSPACE_TYPES__' +EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"' + do_compile() { # Point to right sbindir sed -i -e "s;BINDIR = /sbin;BINDIR = $base_sbindir;" -e "s;UDEVDIR = /lib;UDEVDIR = $nonarch_base_libdir;" ${S}/Makefile
@@ -46,8 +44,6 @@ do_install() { autotools_do_install } -inherit ptest - do_compile_ptest() { oe_runmake test }
@@ -62,6 +58,7 @@ do_install_ptest() { install -D -m 755 $prg ${D}${PTEST_PATH}/ done } + RDEPENDS_${PN}-ptest += "bash" RRECOMMENDS_${PN}-ptest += " \ coreutils \
Signature · 1 line
2.19.2