Collin Funk <collin.fu...@gmail.com> writes:

> If I remember correctly, this code would warn on previous versions of
> GCC. But on GCC 14 it is an error by default.

Forgot to attach the patch.

Collin

>From 7029d554682583586d56deefb60af7a1aae233ef Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 4 Mar 2025 21:45:58 -0800
Subject: [PATCH] getaddrinfo: Fix AI_NUMERICSERV configure check on GCC 14
 (regr. 2025-02-12).

* m4/getaddrinfo.m4 (gl_GETADDRINFO): Define a pointer to pass to
getaddrinfo where it allocates and stores the result.
---
 ChangeLog         | 6 ++++++
 m4/getaddrinfo.m4 | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a76b923957..13b99e0b1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-03-04  Collin Funk  <collin.fu...@gmail.com>
+
+	getaddrinfo: Fix AI_NUMERICSERV configure check on GCC 14 (regr. 2025-02-12).
+	* m4/getaddrinfo.m4 (gl_GETADDRINFO): Define a pointer to pass to
+	getaddrinfo where it allocates and stores the result.
+
 2025-03-03  Bruno Haible  <br...@clisp.org>
 
 	doc: Update publication recipe.
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index 5207f0565f..2931d526cd 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -1,5 +1,5 @@
 # getaddrinfo.m4
-# serial 37
+# serial 38
 dnl Copyright (C) 2004-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -108,7 +108,7 @@ AC_DEFUN([gl_GETADDRINFO]
 #include <string.h>
             ]], [[
               struct addrinfo hints;
-              struct addrinfo ai;
+              struct addrinfo *ai;
               memset (&hints, 0, sizeof (hints));
               hints.ai_flags = AI_NUMERICSERV;
               return getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME;
-- 
2.48.1

Reply via email to