package/sexpect: fix build with GCC 14 and uClibc

GCC 14 makes implicit declaration an error by default, which breaks
build with uClibc when _GNU_SOURCE is not defined. Add a patch adding
_GNU_SOURCE for uClibc build.

Fixes:
https://autobuild.buildroot.org/results/2c284d800e59e41669a5da85ca23e2923eea7997/

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Baruch Siach 2024-11-29 11:48:06 +02:00 committed by Arnout Vandecappelle
parent 7dd56b6cd9
commit f39d38d77a

View File

@ -0,0 +1,69 @@
From 7ef4ef027c5064502bba23869aed9d1595a4e301 Mon Sep 17 00:00:00 2001
Message-ID: <7ef4ef027c5064502bba23869aed9d1595a4e301.1732873390.git.baruch@tkos.co.il>
From: Baruch Siach <baruch@tkos.co.il>
Date: Fri, 29 Nov 2024 11:36:16 +0200
Subject: [PATCH] Unconditionally define _GNU_SOURCE
uClibc also uses _GNU_SOURCE to expose glibc compatible API extensions.
But toolchain built with uClibc don't define __gnu_linux__. This leads
to implicit declaration warnings at build time. With GCC 14 these
warnings become errors by default.
For example:
.../sexpect-2.3.14/server.c: In function 'expect_exact':
.../sexpect-2.3.14/server.c:630:17: error: implicit declaration of function 'strcasestr'; did you mean 'strcasecmp'?
[-Wimplicit-function-declaration]
630 | found = strcasestr(g.expbuf, g.conn.pass.pattern);
| ^~~~~~~~~~
| strcasecmp
Define _GNU_SOURCE unconditionally to fix the build.
Upstream: https://github.com/clarkwang/sexpect/pull/40
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
main.c | 2 --
pty.c | 2 --
server.c | 2 --
3 files changed, 6 deletions(-)
diff --git a/main.c b/main.c
index 886050a887c1..2bc7c867e297 100644
--- a/main.c
+++ b/main.c
@@ -1,7 +1,5 @@
-#if defined(__gnu_linux__) || defined(__CYGWIN__)
#define _GNU_SOURCE
-#endif
#include <fcntl.h>
#include <limits.h>
diff --git a/pty.c b/pty.c
index bf4f6e99805e..f90325d87c77 100644
--- a/pty.c
+++ b/pty.c
@@ -1,7 +1,5 @@
-#if defined(__gnu_linux__) || defined(__CYGWIN__)
#define _GNU_SOURCE
-#endif
#include <string.h>
#include <stdio.h>
diff --git a/server.c b/server.c
index c7e41e0a7dc4..308852f08089 100644
--- a/server.c
+++ b/server.c
@@ -1,7 +1,5 @@
-#if defined(__gnu_linux__) || defined(__CYGWIN__)
#define _GNU_SOURCE
-#endif
#include <assert.h>
#include <fcntl.h>
--
2.45.2