Skip to contentSkip to conversation

package/uqmi: fix compile error (gcc false error reporting)

PATCH In review Peter Seiderer 2 participants 2 messages Mar 5, 2023 – Mar 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/uqmi: fix compile error (gcc false error reporting)

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

---
 ...alse-error-reporting-storing-the-add.patch | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 package/uqmi/0001-uqmi-avoid-gcc-false-error-reporting-storing-the-add.patch
package/uqmi/0001-uqmi-avoid-gcc-false-error-reporting-storing-the-add.patch new file +54 -0
new file mode 100644
index 0000000000..c940925767
@@ -0,0 +1,54 @@
+From 4c2eb926efb4de24af5a3b1e8c18195198827491 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <[email protected]>
+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 <[email protected]>
+
+[Upstream: http://lists.openwrt.org/pipermail/openwrt-devel/2023-March/040633.html]
+Signed-off-by: Peter Seiderer <[email protected]>
+---
+ 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
+
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Seiderer <[email protected]> writes:

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

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

Quoted 7 lines

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

That's some fairly odd looking code, but if that is what upstream suggests..

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot