summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-02-20 22:14:46 +0000
committerSam James <sam@gentoo.org>2022-02-20 23:08:37 +0000
commit057e21919e19feb2fd4d51e2bf18d3c0b4512a61 (patch)
tree0aae3548697faa5fc4064efc51c581c6d3c963f7 /dev-libs/libusb
parentsys-kernel/git-sources: Linux patch 5.17-rc5 (diff)
downloadgentoo-057e21919e19feb2fd4d51e2bf18d3c0b4512a61.tar.gz
gentoo-057e21919e19feb2fd4d51e2bf18d3c0b4512a61.tar.bz2
gentoo-057e21919e19feb2fd4d51e2bf18d3c0b4512a61.zip
dev-libs/libusb: fix build failure with -O3
Upstream patch (not yet merged, but simple enough) which works around a build failure (false positive) with -O3. Closes: https://bugs.gentoo.org/832732 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-libs/libusb')
-rw-r--r--dev-libs/libusb/files/libusb-1.0.25-fix-O3-warning.patch32
-rw-r--r--dev-libs/libusb/libusb-1.0.25.ebuild4
2 files changed, 36 insertions, 0 deletions
diff --git a/dev-libs/libusb/files/libusb-1.0.25-fix-O3-warning.patch b/dev-libs/libusb/files/libusb-1.0.25-fix-O3-warning.patch
new file mode 100644
index 000000000000..7270b057d172
--- /dev/null
+++ b/dev-libs/libusb/files/libusb-1.0.25-fix-O3-warning.patch
@@ -0,0 +1,32 @@
+https://github.com/libusb/libusb/pull/1062
+https://github.com/libusb/libusb/issues/1063
+https://bugs.gentoo.org/832732
+
+From 8bb81fe72286cdcb782c7af4f0d7ef715b2e137c Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <yegorslists@googlemail.com>
+Date: Sun, 6 Feb 2022 07:12:14 +0100
+Subject: [PATCH] linux_usbfs: fix maybe-uninitialized error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Initialize active_config to an invalid value to avoid the following
+compilation error:
+
+os/linux_usbfs.c: In function ‘op_get_configuration’:
+os/linux_usbfs.c:1452:12: error: ‘active_config’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ 1452 | *config = (uint8_t)active_config;
+
+Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
+--- a/libusb/os/linux_usbfs.c
++++ b/libusb/os/linux_usbfs.c
+@@ -1429,7 +1429,7 @@ static int op_get_configuration(struct libusb_device_handle *handle,
+ uint8_t *config)
+ {
+ struct linux_device_priv *priv = usbi_get_device_priv(handle->dev);
+- int active_config;
++ int active_config = -1; /* to please compiler */
+ int r;
+
+ if (priv->sysfs_dir) {
+
diff --git a/dev-libs/libusb/libusb-1.0.25.ebuild b/dev-libs/libusb/libusb-1.0.25.ebuild
index 328fa227b1de..71c8364d0b70 100644
--- a/dev-libs/libusb/libusb-1.0.25.ebuild
+++ b/dev-libs/libusb/libusb-1.0.25.ebuild
@@ -21,6 +21,10 @@ DEPEND="${RDEPEND}
!udev? ( virtual/os-headers )"
BDEPEND="doc? ( app-doc/doxygen )"
+PATCHES=(
+ "${FILESDIR}"/${P}-fix-O3-warning.patch
+)
+
multilib_src_configure() {
local myeconfargs=(
$(use_enable static-libs static)