[openwrt/openwrt] ltq-adsl-app: Fix compilation with GCC 14
LEDE Commits
lede-commits at lists.infradead.org
Sat May 3 13:06:01 PDT 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/09b89c96cea2f48557604e12fbe10c000d676f9c
commit 09b89c96cea2f48557604e12fbe10c000d676f9c
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Fri May 2 23:42:29 2025 +0200
ltq-adsl-app: Fix compilation with GCC 14
This fixes the following compile problem:
```
checking for asm/types.h... dsl_cpe_linux.c: In function 'DSL_CPE_ThreadInit':
dsl_cpe_linux.c:779:25: error: assignment to 'DSL_CPE_Thread_t' {aka 'int'} from 'pthread_t' {aka 'struct __pthread *'} makes integer from pointer without a cast [-Wint-conversion]
779 | pThrCntrl->tid = tid;
| ^
dsl_cpe_linux.c: In function 'DSL_CPE_ThreadDelete':
dsl_cpe_linux.c:862:44: error: passing argument 1 of 'pthread_cancel' makes pointer from integer without a cast [-Wint-conversion]
862 | switch(pthread_cancel(pThrCntrl->tid))
| ~~~~~~~~~^~~~~
| |
| DSL_CPE_Thread_t {aka int}
In file included from dsl_cpe_linux.h:35:
/builder/shared-workdir/build/staging_dir/toolchain-mips_mips32_gcc-14.2.0_musl/include/pthread.h:98:20: note: expected 'pthread_t' {aka 'struct __pthread *'} but argument is of type 'DSL_CPE_Thread_t' {aka 'int'}
98 | int pthread_cancel(pthread_t);
| ^~~~~~~~~
dsl_cpe_linux.c: In function 'DSL_CPE_ThreadIdGet':
dsl_cpe_linux.c:1123:11: error: returning 'pthread_t' {aka 'struct __pthread *'} from a function with return type 'DSL_CPE_Thread_t' {aka 'int'} makes integer from pointer without a cast [-Wint-conversion]
1123 | return pthread_self();
| ^~~~~~~~~~~~~~
```
While at it, fix also some additional build warnings.
Link: https://github.com/openwrt/openwrt/pull/18688
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
package/network/config/ltq-adsl-app/Makefile | 2 +-
.../ltq-adsl-app/patches/020-gcc-14-fixes.patch | 104 +++++++++++++++++++++
2 files changed, 105 insertions(+), 1 deletion(-)
diff --git a/package/network/config/ltq-adsl-app/Makefile b/package/network/config/ltq-adsl-app/Makefile
index b96a3f71e5..3da37f884d 100644
--- a/package/network/config/ltq-adsl-app/Makefile
+++ b/package/network/config/ltq-adsl-app/Makefile
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=dsl_cpe_control_danube
PKG_VERSION:=3.24.4.4
-PKG_RELEASE:=13
+PKG_RELEASE:=14
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/dsl_cpe_control-$(PKG_VERSION)
PKG_SOURCE_URL:=@OPENWRT
diff --git a/package/network/config/ltq-adsl-app/patches/020-gcc-14-fixes.patch b/package/network/config/ltq-adsl-app/patches/020-gcc-14-fixes.patch
new file mode 100644
index 0000000000..0b6ae9e41e
--- /dev/null
+++ b/package/network/config/ltq-adsl-app/patches/020-gcc-14-fixes.patch
@@ -0,0 +1,104 @@
+ltq-adsl-app: Fix compilation with GCC 14
+
+This fixes the following compile problem:
+```
+checking for asm/types.h... dsl_cpe_linux.c: In function 'DSL_CPE_ThreadInit':
+dsl_cpe_linux.c:779:25: error: assignment to 'DSL_CPE_Thread_t' {aka 'int'} from 'pthread_t' {aka 'struct __pthread *'} makes integer from pointer without a cast [-Wint-conversion]
+ 779 | pThrCntrl->tid = tid;
+ | ^
+dsl_cpe_linux.c: In function 'DSL_CPE_ThreadDelete':
+dsl_cpe_linux.c:862:44: error: passing argument 1 of 'pthread_cancel' makes pointer from integer without a cast [-Wint-conversion]
+ 862 | switch(pthread_cancel(pThrCntrl->tid))
+ | ~~~~~~~~~^~~~~
+ | |
+ | DSL_CPE_Thread_t {aka int}
+In file included from dsl_cpe_linux.h:35:
+/builder/shared-workdir/build/staging_dir/toolchain-mips_mips32_gcc-14.2.0_musl/include/pthread.h:98:20: note: expected 'pthread_t' {aka 'struct __pthread *'} but argument is of type 'DSL_CPE_Thread_t' {aka 'int'}
+ 98 | int pthread_cancel(pthread_t);
+ | ^~~~~~~~~
+dsl_cpe_linux.c: In function 'DSL_CPE_ThreadIdGet':
+dsl_cpe_linux.c:1123:11: error: returning 'pthread_t' {aka 'struct __pthread *'} from a function with return type 'DSL_CPE_Thread_t' {aka 'int'} makes integer from pointer without a cast [-Wint-conversion]
+ 1123 | return pthread_self();
+ | ^~~~~~~~~~~~~~
+```
+
+While at it, fix also some additional build warnings.
+
+--- a/src/dsl_cpe_linux.h
++++ b/src/dsl_cpe_linux.h
+@@ -21,7 +21,7 @@
+ #include <stdlib.h>
+ #include <getopt.h>
+ #include <stdio.h> /* fdopen */
+-#include <sys/fcntl.h> /* open */
++#include <fcntl.h> /* open */
+ #include <sys/ioctl.h> /* ioctl */
+ #include <string.h> /* memset, strstr, strlen */
+ #include <stdlib.h> /* strtoul */
+@@ -233,7 +233,7 @@ typedef struct stat DSL_CPE
+ /**
+ LINUX User Thread - map the Thread ID.
+ */
+-typedef int DSL_CPE_Thread_t;
++typedef pthread_t DSL_CPE_Thread_t;
+
+ /**
+ LINUX User Thread - function type LINUX User Thread Start Routine.
+--- a/src/dsl_cpe_os_lint_map.h
++++ b/src/dsl_cpe_os_lint_map.h
+@@ -168,7 +168,7 @@ typedef struct timeval DSL_Tim
+ /**
+ LINUX User Thread - map the Thread ID.
+ */
+-typedef int DSL_CPE_Thread_t;
++typedef pthread_t DSL_CPE_Thread_t;
+
+ /**
+ LINUX User Thread - function type LINUX User Thread Start Routine.
+--- a/src/dsl_cpe_control.c
++++ b/src/dsl_cpe_control.c
+@@ -2062,7 +2062,7 @@ DSL_Error_t DSL_CPE_ScriptExecute (
+
+ /* if the line is empty or a special "#" symbol detected,
+ then go on to the next */
+- if ((sscanf (buf, "%s", &str_command) == 0) || (buf[0] == '#'))
++ if ((sscanf (buf, "%s", str_command) == 0) || (buf[0] == '#'))
+ {
+ continue;
+ }
+@@ -2075,7 +2075,7 @@ DSL_Error_t DSL_CPE_ScriptExecute (
+
+ while(*pFile__++ != '\n');
+
+- if ((sscanf (buf, "%s", &str_command) == 0) || (buf[0] == '#'))
++ if ((sscanf (buf, "%s", str_command) == 0) || (buf[0] == '#'))
+ {
+ continue;
+ }
+@@ -2269,7 +2269,7 @@ DSL_Error_t DSL_CPE_ScriptExecute (
+ {
+ meireg regrdwr;
+
+- sscanf (buf, "%s %s %s", &str_command, &op1, &op2);
++ sscanf (buf, "%s %s %s", str_command, &op1, &op2);
+ regrdwr.iAddress = strtoul (op1, DSL_NULL, 0) + MEI_SPACE_ACCESS;
+
+
+@@ -2302,7 +2302,7 @@ DSL_Error_t DSL_CPE_ScriptExecute (
+ {
+ meireg regrdwr;
+
+- sscanf (buf, "%s %s %s", &str_command, &op1, &op2);
++ sscanf (buf, "%s %s %s", str_command, &op1, &op2);
+ regrdwr.iAddress = strtoul (op1, DSL_NULL, 0) + MEI_SPACE_ACCESS;
+ if (ioctl (pContext->fd, DANUBE_MEI_CMV_READ, ®rdwr) < 0)
+ {
+@@ -3522,7 +3522,7 @@ DSL_CPE_STATIC DSL_int_t DSL_CPE_Event_
+ sprintf(sVarName, "DSL_DATARATE_%s_BC%d",
+ pEvent->data.nAccessDir == DSL_DOWNSTREAM ? "DS" : "US",
+ pEvent->data.nChannel == 0 ? 0 : pEvent->data.nChannel == 1 ? 1 : 0);
+- sprintf(sVarVal, "%lu", pEvent->data.pData->channelStatusData.ActualDataRate);
++ sprintf(sVarVal, "%u", pEvent->data.pData->channelStatusData.ActualDataRate);
+
+ if (DSL_CPE_SetEnv(sVarName, sVarVal) == DSL_SUCCESS)
+ {
More information about the lede-commits
mailing list