Skip to contentSkip to conversation

paho-mqtt-c: fix error with gcc-15

PATCH New [email protected] 1 participant 1 message Apr 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 paho-mqtt-c: fix error with gcc-15

From: "mark.yang" <[email protected]>

* gcc-15 uses gnu23 for c.
'bool' is a keyword.
TOPDIR/tmp/work/core2-64-oe-linux/paho-mqtt-c/1.3.14/git/src/MQTTPacket.h:31:22: error: 'bool' cannot be defined via 'typedef'
31 | typedef unsigned int bool;
| ^~~~
TOPDIR/tmp/work/core2-64-oe-linux/paho-mqtt-c/1.3.14/git/src/MQTTPacket.h:31:22: note: 'bool' is a keyword with '-std=c23' onwards TOPDIR/tmp/work/core2-64-oe-linux/paho-mqtt-c/1.3.14/git/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration

   31 | typedef unsigned int bool;
      | ^~~~~~~
---
 ...rror-due-to-bool-keyword-with-gcc-15.patch | 37 +++++++++++++++++++
 .../paho-mqtt-c/paho-mqtt-c_1.3.14.bb         |  5 ++-
 2 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c/0001-Fix-build-error-due-to-bool-keyword-with-gcc-15.patch
meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c/0001-Fix-build-error-due-to-bool-keyword-with-gcc-15.patch new file +37 -0
new file mode 100644
index 0000000000..4215f698c7
@@ -0,0 +1,37 @@
+From 02fa96d0d59211e64483273e5253ca45c4395154 Mon Sep 17 00:00:00 2001
+From: "mark.yang" <[email protected]>
+Date: Wed, 9 Apr 2025 19:05:55 +0900
+Subject: [PATCH] Fix build error due to bool keyword with gcc-15
+
+* gcc-15 uses gnu23 for c.
+  'bool' is a keyword.
+TOPDIR/tmp/work/core2-64-oe-linux/paho-mqtt-c/1.3.14/git/src/MQTTPacket.h:31:22: error: 'bool' cannot be defined via 'typedef'
+   31 | typedef unsigned int bool;
+      |                      ^~~~
+TOPDIR/tmp/work/core2-64-oe-linux/paho-mqtt-c/1.3.14/git/src/MQTTPacket.h:31:22: note: 'bool' is a keyword with '-std=c23' onwards
+TOPDIR/tmp/work/core2-64-oe-linux/paho-mqtt-c/1.3.14/git/src/MQTTPacket.h:31:1: warning: useless type name in empty declaration
+   31 | typedef unsigned int bool;
+      | ^~~~~~~
+
+Upstream-Status: Submitted [https://github.com/eclipse-paho/paho.mqtt.c/pull/1595]
+Signed-off-by: mark.yang <[email protected]>
+Signed-off-by: markyang92 <[email protected]>
+
+---
+ src/MQTTPacket.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/MQTTPacket.h b/src/MQTTPacket.h
+index fd384ae9..0c64a0f4 100644
+--- a/src/MQTTPacket.h
++++ b/src/MQTTPacket.h
+@@ -28,7 +28,9 @@
+ #include "LinkedList.h"
+ #include "Clients.h"
+ 
++#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ <= 201710L
+ typedef unsigned int bool;
++#endif
+ typedef void* (*pf)(int, unsigned char, char*, size_t);
+ 
+ #include "MQTTProperties.h"
meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.14.bb +4 -1
index 7b76f86db6..b971851b90 100644
@@ -10,7 +10,10 @@ LIC_FILES_CHKSUM = " \
     file://epl-v20;md5=d9fc0efef5228704e7f5b37f27192723 \
 "
 
-SRC_URI = "git://github.com/eclipse/paho.mqtt.c;protocol=https;branch=master"
+SRC_URI = " \
+    git://github.com/eclipse/paho.mqtt.c;protocol=https;branch=master \
+    file://0001-Fix-build-error-due-to-bool-keyword-with-gcc-15.patch \
+"
 
 SRCREV = "2150ba29d9df24ad1733c460eb099f292af84ee5"