[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Infinite recusion in test-timespec_getres.exe
From: |
Paul Eggert |
Subject: |
Re: Infinite recusion in test-timespec_getres.exe |
Date: |
Fri, 31 Dec 2021 10:23:53 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 |
On 12/31/21 04:56, Gisle Vanem wrote:
Paul Eggert wrote:
On 12/30/21 07:48, Gisle Vanem wrote:
-#elif defined HAVE_TIMESPEC_GETRES
+#elif defined HAVE_TIMESPEC_GETRES && HAVE_TIMESPEC_GETRES
This change has an effect only if there's the equivalent of '#define
HAVE_TIMESPEC_GETRES 0' somewhere.
Since 'time.in.h' says:
# if ! @HAVE_TIMESPEC_GETRES@
_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
..
it makes sense to me this should be replaced with a '0' or '1'.
That would make sense, but it's not how it works. Although the shell
variable and Makefile macro (which is what @HAVE_TIMESPEC_GETRES@
expands to) is either 0 or 1, the C preprocessor macro of the same name
is either 1 or undefined. This is like most other HAVE_ symbols, e.g.,
HAVE_OPENAT.
Or you mean it should be replaced with
defined HAVE_TIMESPEC_GETRES ?
I don't see why anything needs replacing.
Perhaps you configured or built with the compiler option
'-DHAVE_TIMESPEC_GETRES=0'? If so, don't do that. On the other hand, if
'./gnulib-tool --test timespec_getres' caused the stack overflow you
mentioned, without any special compiler options, we need to figure out
how the HAVE_TIMESPEC_GETRES preprocessor macro was incorrectly #defined
to 0.
I fail to understand how the value of 'HAVE_TIMESPEC_GETRES'
is used by m4 etc.
gnulib-tool creates Makefile snippets that use HAVE_TIMESPEC_GETRES. The
'time' module replaces @HAVE_TIMESPEC_GETRES@ with
$(HAVE_TIMESPEC_GETRES) in these snippets. When you then run
'configure', it replaces @HAVE_TIMESPEC_GETRES@ with
$(HAVE_TIMESPEC_GETRES) in those snippets, and it also defines the
Makefile HAVE_TIMESPEC_GETRES macro to be 1 or 0 in the generated
Makefiles. 'configure' also arranges for '#define HAVE_TIMESPEC_GETRES
1', or just a comment, to appear in config.h.
$ git grep HAVE_TIMESPEC_GETRES
lib/gettime-res.c:#elif defined HAVE_TIMESPEC_GETRES
lib/time.in.h:# if ! @HAVE_TIMESPEC_GETRES@
m4/time_h.m4: HAVE_TIMESPEC_GETRES=1;
AC_SUBST([HAVE_TIMESPEC_GETRES])
m4/timespec_getres.m4: HAVE_TIMESPEC_GETRES=0
modules/time: -e
's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \
modules/timespec_getres:gettime-res [test $HAVE_TIMESPEC_GETRES = 0]
modules/timespec_getres:if test $HAVE_TIMESPEC_GETRES = 0; then