buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [git commit branch/2022.11.x] package/uqmi: fix compile error (gcc false error reporting)
@ 2023-03-17  8:34 Peter Korsgaard
  0 siblings, 0 replies; only message in thread
From: Peter Korsgaard @ 2023-03-17  8:34 UTC (permalink / raw)
  To: buildroot

[-- Attachment #1: Type: text/plain, Size: 3207 bytes --]

commit: https://git.buildroot.net/buildroot/commit/?id=377d8d632838a19140d1cc370b09a7d119b337e7
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2022.11.x

Add upstream suggested patch ([1]) to avoid gcc false error reporting.

Fixes:

  - http://autobuild.buildroot.net/results/ce9e2074bb8486d1ee25232b985d47475faefd63

  dev.c:217:23: error: storing the address of local variable 'complete' in '*req.complete' [-Werror=dangling-pointer=]
    217 |         req->complete = &complete;
        |         ~~~~~~~~~~~~~~^~~~~~~~~~~

[1] http://lists.openwrt.org/pipermail/openwrt-devel/2023-March/040633.html

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit b3cf07d8db2ae0283bbac7e4a06f363c7bc39e58)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 ...gcc-false-error-reporting-storing-the-add.patch | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/package/uqmi/0001-uqmi-avoid-gcc-false-error-reporting-storing-the-add.patch b/package/uqmi/0001-uqmi-avoid-gcc-false-error-reporting-storing-the-add.patch
new file mode 100644
index 0000000000..c940925767
--- /dev/null
+++ b/package/uqmi/0001-uqmi-avoid-gcc-false-error-reporting-storing-the-add.patch
@@ -0,0 +1,54 @@
+From 4c2eb926efb4de24af5a3b1e8c18195198827491 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Sun, 5 Mar 2023 22:08:13 +0100
+Subject: [PATCH] uqmi: avoid gcc false error reporting (storing the address of
+ local variable 'complete' in '*req.complete')
+
+Avoid gcc false error reporting (req->complete is later reset to NULL
+in case of use of local complete):
+
+  dev.c:217:23: error: storing the address of local variable 'complete' in '*req.complete' [-Werror=dangling-pointer=]
+    217 |         req->complete = &complete;
+        |         ~~~~~~~~~~~~~~^~~~~~~~~~~
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+
+[Upstream: http://lists.openwrt.org/pipermail/openwrt-devel/2023-March/040633.html]
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ dev.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/dev.c b/dev.c
+index bd10207..b8ac273 100644
+--- a/dev.c
++++ b/dev.c
+@@ -203,6 +203,15 @@ void qmi_request_cancel(struct qmi_dev *qmi, struct qmi_request *req)
+ 	__qmi_request_complete(qmi, req, NULL);
+ }
+ 
++/* avoid gcc false error reporting:
++ *   dev.c:217:23: error: storing the address of local variable ‘complete’ in ‘*req.complete’ [-Werror=dangling-pointer=]
++ *     217 |         req->complete = &complete;
++ *         |         ~~~~~~~~~~~~~~^~~~~~~~~~~
++ */
++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wdangling-pointer"
++#endif
+ int qmi_request_wait(struct qmi_dev *qmi, struct qmi_request *req)
+ {
+ 	bool complete = false;
+@@ -231,6 +240,9 @@ int qmi_request_wait(struct qmi_dev *qmi, struct qmi_request *req)
+ 
+ 	return req->ret;
+ }
++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
++#pragma GCC diagnostic pop
++#endif
+ 
+ struct qmi_connect_request {
+ 	struct qmi_request req;
+-- 
+2.39.2
+

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-17  8:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  8:34 [Buildroot] [git commit branch/2022.11.x] package/uqmi: fix compile error (gcc false error reporting) Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).