From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 740D21F47C for ; Mon, 9 Jan 2023 10:10:57 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=pPIRcHjo; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEp6p-0007cn-9b; Mon, 09 Jan 2023 05:10:27 -0500 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 1pEp6i-0007bd-Nn for bug-gnulib@gnu.org; Mon, 09 Jan 2023 05:10:22 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEp6c-000278-Q4 for bug-gnulib@gnu.org; Mon, 09 Jan 2023 05:10:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1673259010; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=QZPY9jMD1ieMqsdeKJx554ldPwSLuQ5+MM6auwK23u8=; b=pPIRcHjo5DETEIMJwhfxMCSfE8zV2BTsgN4h+mO97ABFBlOg+LR5aECuvWKUUI4Hah eF0OYi26bvrTvml+2rtpk/ov2/mXlzBpTkx3bqVSeUOGUxzKCCEQO2TxtmxHmCAU1YSF xTdE/5Saon9gI3dDcPC1yOlrzrtAcNgZaEtGTqUp3IwVTemtOhm6er9DhKZduPoelDd9 sqBfKVRhE61uLVH/zAdk3YVxzg9gIia61fIgEkd7CTv3T8rNUoKv2GcdNPg6VCdE3sL3 HaUXkC0P5njw5tXz1J370/WlSnBHBiosDL6Z8HCbO41/ekcZxsZKdJvvXtioEhYDpGgb CVyQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPFiqNy4ka8MFlN3TV16UYj/3+Sgg==" X-RZG-CLASS-ID: mo00 Received: from nimes.localnet by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id t05890z09AA9NTd (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 9 Jan 2023 11:10:09 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: gettime: Fix compilation error in C++ mode on Android Date: Mon, 09 Jan 2023 11:10:09 +0100 Message-ID: <2014450.M3retTD8dW@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.21; 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, 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+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org In a testdir on Android, I see this compilation error: clang++ -DNO_INLINE_GETPASS=1 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/data/data/com.termux/files/home/local/include -Wall -Wno-error -g -O2 -c -o test-time-c++.o ../../gltests/test-time-c++.cc In file included from ../../gltests/test-time-c++.cc:22: ../gllib/time.h:626:19: error: no member named 'timespec_get' in the global namespace _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../gllib/sched.h:264:20: note: expanded from macro '_GL_CXXALIAS_SYS' return ::func; \ ~~^ In file included from ../../gltests/test-time-c++.cc:22: ../gllib/time.h:627:19: error: use of undeclared identifier 'timespec_get'; did you mean 'gnulib::timespec_get'? _GL_CXXALIASWARN (timespec_get); ^ ../gllib/time.h:626:19: note: 'gnulib::timespec_get' declared here _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); ^ 2 errors generated. make[4]: *** [Makefile:23463: test-time-c++.o] Error 1 Here the problem is that timespec_get is only declared for a future API level: /usr/include/time.h:int timespec_get(struct timespec* __ts, int __base) __INTRODUCED_IN(29); This patch fixes the error, like in those cases where we use gl_CHECK_FUNCS_ANDROID. 2023-01-09 Bruno Haible gettime: Fix compilation error in C++ mode on Android. * m4/gettime.m4 (gl_CHECK_FUNC_TIMESPEC_GET): Also test whether timespec_get is declared. diff --git a/m4/gettime.m4 b/m4/gettime.m4 index 06f32fe26c..7e353fcd00 100644 --- a/m4/gettime.m4 +++ b/m4/gettime.m4 @@ -1,4 +1,4 @@ -# gettime.m4 serial 12 +# gettime.m4 serial 13 dnl Copyright (C) 2002, 2004-2006, 2009-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, @@ -26,17 +26,24 @@ AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET], dnl We can't use AC_CHECK_FUNC here, because timespec_get() is defined as a dnl static inline function in on MSVC 14. - AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include - struct timespec ts; - ]], - [[return timespec_get (&ts, 0);]]) - ], - [gl_cv_func_timespec_get=yes], - [gl_cv_func_timespec_get=no]) - ]) + dnl But at the same time, we need to notice a missing declaration, like + dnl gl_CHECK_FUNCS_ANDROID does. + AC_CHECK_DECL([timespec_get], , , [[#include ]]) + if test $ac_cv_have_decl_timespec_get = yes; then + AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + struct timespec ts; + ]], + [[return timespec_get (&ts, 0);]]) + ], + [gl_cv_func_timespec_get=yes], + [gl_cv_func_timespec_get=no]) + ]) + else + gl_cv_func_timespec_get=no + fi ]) AC_DEFUN([gl_GETTIME_RES],