From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Haible Newsgroups: gmane.comp.lib.gnulib.bugs,gmane.emacs.devel Subject: Re: boot-time: straighten code Date: Sun, 13 Aug 2023 15:45:23 +0200 Message-ID: <3848098.Sr9nCIn9ua@nimes> References: <4536176.VaOIPsP7d9@nimes> <5a77c0b9-8692-83bf-1aca-2f1d27122877@cs.ucla.edu> <87v8djoc6n.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12306"; mail-complaints-to="usenet@ciao.gmane.io" Cc: bug-gnulib@gnu.org, Emacs-devel@gnu.org To: Paul Eggert , Po Lu Original-X-From: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Sun Aug 13 15:45:56 2023 Return-path: Envelope-to: gnu-bug-gnulib@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qVBPo-00032C-CK for gnu-bug-gnulib@m.gmane-mx.org; Sun, 13 Aug 2023 15:45:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVBPQ-0001DY-Q3; Sun, 13 Aug 2023 09:45:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVBPO-0001CU-Id; Sun, 13 Aug 2023 09:45:30 -0400 Original-Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.23]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVBPM-0003VG-AP; Sun, 13 Aug 2023 09:45:30 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1691934323; cv=none; d=strato.com; s=strato-dkim-0002; b=ghdQG42WLNGrUuEtA6pvCWzOKwk3WmfDypjVqlf1O/F9wChY0zQTOgLcN2YRJWyMzj klfjEbzl3FuscdmLB0MP91yC4k+A5qhOz1KQ0xg14dgM5LkzWO4hU7g5vtlb7zgMycIk GBbHvCl0GDJaS+6VfCNkkLl73yH77sSw5q7IjM/7yM5Z3oRJ5j+e02lRfp3Tci2ILkff VchS7U7lxG42youvqINwnCYEjKQ290h2UziE7yG6949dcorLUkA4FH/NUC6wHOQ6Rbqp CKkcKEUAc3LNDyKUJgPylOPMN64w/bevlnzOFZ9K3cizQmRP22rUcfC+M6IiXmYAR8Ra th5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1691934323; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uTIeJSvkp4hNdB8cMlfE5S3bCjUELvA8o9OEKW+e9b4=; b=sBUV48zljt55u+iqR1SdIl94CGlQDbGJJr1kjWtGO3NKJHzaTFdmhWh26rT4N9J6e/ HW3NVyZT/1JLm62IHOvEMtuvTk4r4rsEBWZH2WpGIYCb9CKonUpNxVgGeoiO4kheNKPY aNkJeMPI0/im3InzXmXinVlty9zvCAlbCzZXtanAEaZQX0/i8ZQBlWgkMrzivCRH9zLi UYNdCslkKVm+qF6WuCRvXy8XFP3Z6EmP8NikbNtM6Y73SLDzWdM2ir8gX/oQf1u7EebN fpXCU7LPyyAhzTz4NsD55Yzz9h351LRfc/es/AurSKjnqL5XrSks6UXgzIJUEjUQYX2q beZw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1691934323; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uTIeJSvkp4hNdB8cMlfE5S3bCjUELvA8o9OEKW+e9b4=; b=YLEENm55PrZXI+8eoM8ukWduG4L/GNediAaSqC8ZTeomwtENOJSqXoTYENbVfC6LGs ZJ/0YwjXNJpyMX1deHR9pBXFXHrey0deJd1dhxlVTK3uQ7+i+18IrR6IqohOSDPiM5aH cJYipYZsdG7kD2BpoT5YxjN6P7X48hAgyMGofz/EroSorXPsKFAQuPpouiQQn/WPhIls oOMEa1FLYEB6Hv9Q8mrUeV+ztb1/96CLF550V4bifqr0KniBYws0KjnxwBxVxpUWJwM9 ZVPF74CshJnCBivzwWhUSHtXHlLv36HVnMCMAbZSgK0Y9JnPn7stZ9auaHGOgVu77fcu 7Yjw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1691934323; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uTIeJSvkp4hNdB8cMlfE5S3bCjUELvA8o9OEKW+e9b4=; b=fgA+QWf5DPPvuFUf5tBdChYTu/5MDROa8v48r3/pdYbyogdzBbul5NcqNlqTWf86VM 7cqMyE4jenWIyG3kfjCA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPF3fYsxbAVaMn7wIQE2qpZc5CC1Q==" Original-Received: from nimes.localnet by smtp.strato.de (RZmta 49.6.6 AUTH) with ESMTPSA id x129eaz7DDjNA6B (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 13 Aug 2023 15:45:23 +0200 (CEST) In-Reply-To: <87v8djoc6n.fsf@yahoo.com> Received-SPF: none client-ip=85.215.255.23; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Original-Sender: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.comp.lib.gnulib.bugs:48173 gmane.emacs.devel:308676 Archived-At: Po Lu wrote: > During the automated build of the Android port, the following errors > were encountered with the Android NDK r10b and __ANDROID_API__ set to 8 > (which is the oldest configuration Emacs supports.) > ... > boot-time.c:111:26: note: each undeclared identifier is reported only once for each function it appears in > boot-time.c:126:3: error: implicit declaration of function 'endutent' [-Werror=implicit-function-declaration] > END_UTMP_ENT (); > ^ endutent() exists in Android, already in API 8. It's just that its declaration is missing from until ca. 2015. Should be fixed through this patch. Also, it removes a declaration that was needed only for Ultrix 4.3. Gnulib dropped Ultrix support in 2018. Paul Eggert wrote: > As I understand it, the utmp/utmpx functions > are a losing cause on Android since they never return anything. If so, > it's simpler to bypass these functions on that platform. It's more future-proof to continue to use the API that they have. Who knows, they might add useful data into the UTMP_FILE at some point. (E.g. they had a broken localeconv() function for a long time; then they actually fixed it.) 2023-08-13 Bruno Haible readutmp, boot-time: Fix compilation error on old Android. Reported by Po Lu in . * lib/readutmp.c (endutent): New fallback declaration, for Android. (getutent): Remove Ultrix workaround from 2000-04-05. * lib/boot-time.c: Likewise. * m4/readutmp.m4 (gl_PREREQ_READUTMP_H): Test whether endutent is declared, not getutent. * doc/glibc-functions/endutent.texi: Mention the Android bug. diff --git a/doc/glibc-functions/endutent.texi b/doc/glibc-functions/endutent.texi index 5e12e23c44..b4f3dd397a 100644 --- a/doc/glibc-functions/endutent.texi +++ b/doc/glibc-functions/endutent.texi @@ -28,4 +28,7 @@ @item This function is missing on some platforms: macOS 11.1, FreeBSD 13.0, OpenBSD 6.7, Minix 3.1.8, mingw, MSVC 14. +@item +This function is not declared on some platforms: +Android before ca.@: 2015. @end itemize diff --git a/lib/boot-time.c b/lib/boot-time.c index d813bfa582..c359954f19 100644 --- a/lib/boot-time.c +++ b/lib/boot-time.c @@ -65,8 +65,10 @@ # define UT_USER(UT) ((UT)->ut_user) #endif -#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION && !HAVE_DECL_GETUTENT -struct utmp *getutent (void); +#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION +# if !HAVE_DECL_ENDUTENT /* Android */ +void endutent (void); +# endif #endif #if defined __linux__ || HAVE_UTMPX_H || HAVE_UTMP_H || defined __CYGWIN__ || defined _WIN32 diff --git a/lib/readutmp.c b/lib/readutmp.c index ef9f0aff43..0b7732b165 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -314,9 +314,11 @@ have_boot_time (struct utmp_alloc a) return false; } -# if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION && !HAVE_DECL_GETUTENT -struct utmp *getutent (void); +#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION +# if !HAVE_DECL_ENDUTENT /* Android */ +void endutent (void); # endif +#endif static int read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf, diff --git a/m4/readutmp.m4 b/m4/readutmp.m4 index fff8d4eb7b..9dffe981b8 100644 --- a/m4/readutmp.m4 +++ b/m4/readutmp.m4 @@ -1,4 +1,4 @@ -# readutmp.m4 serial 28 +# readutmp.m4 serial 29 dnl Copyright (C) 2002-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -55,7 +55,7 @@ AC_DEFUN_ONCE([gl_PREREQ_READUTMP_H] if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then dnl Prerequisites of lib/readutmp.h and lib/readutmp.c. AC_CHECK_FUNCS_ONCE([utmpname utmpxname]) - AC_CHECK_DECLS([getutent],,,[[ + AC_CHECK_DECLS([endutent],,,[[ /* is a prerequisite of on FreeBSD 8.0, OpenBSD 4.6. */ #include #ifdef HAVE_UTMP_H