package/ngrep: fix implicit function declaration (GCC14)

Using toolchains based on GCC14 (and newer), now turns this warning
into a systematic error (see [1]).

The build failure can be reproduced with this minimal defconfig:

BR2_x86_64=y
BR2_x86_atom=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_PACKAGE_NGREP=y
BR2_PACKAGE_LIBNET=y

[1] https://gcc.gnu.org/gcc-14/porting_to.html

Fixes: https://autobuild.buildroot.org/results/20b/20b924c5c96b3f43e381d87e59fb160ba8d3dcd0//

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
[Romain:
  - add a defconfig to reproduce the issue
  - add the minimal gcc version to reproduce the issue
]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
(cherry picked from commit 53d2ef7ec6)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Thomas Bonnefille
2025-08-02 13:37:26 +02:00
committed by Thomas Perale
parent 0ab4b8ca72
commit 334a02fb6a

View File

@@ -0,0 +1,44 @@
From 52515bae377f221b5473d9040f5f43ab1c672672 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 19 Dec 2022 11:49:06 +0100
Subject: [PATCH] Include <err.h> and "tcpkill.h" to avoid implicit function
declarations
Implicit function declarations are a historic language feature that
were removed from C in 1999.
Upstream: https://github.com/jpr5/ngrep/pull/28
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
ngrep.c | 1 +
tcpkill.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/ngrep.c b/ngrep.c
index 3df9389..b2fcceb 100644
--- a/ngrep.c
+++ b/ngrep.c
@@ -98,6 +98,7 @@
#endif
#include "ngrep.h"
+#include "tcpkill.h"
/*
diff --git a/tcpkill.c b/tcpkill.c
index 5388ec5..ac8fd2e 100644
--- a/tcpkill.c
+++ b/tcpkill.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <err.h>
#include <libnet.h>
#include <pcap.h>
--
2.50.1