bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: m4-1.4.7: inconsistency in src/m4.h


From: Martin Koeppe
Subject: Re: m4-1.4.7: inconsistency in src/m4.h
Date: Fri, 13 Oct 2006 23:36:45 +0200 (CEST)


On Fri, 13 Oct 2006 address@hidden wrote:

Martin Koeppe wrote:

in src/m4.h I found, that the test for _POSIX_VERSION should only be
made, after unistd.h has been included. Otherwise the test should be
omitted, as _POSIX_VERSION gets #defined in <unistd.h>.

Thanks for the report. Which platform was this on? Did the test suite still pass in spite of this? The goal of that check is to find if any one of a number of macros is defined, in order that the rest of the code can assume Unix semantics and define the __unix__ m4 macro. If that macro still ended up defined on your platform, then the test suite will pass, and I don't need to worry about this. But if it caused a testsuite failure, then I am more than willing to rearrange the code slightly.

The test suite failed, that's why I looked into it. The platform is Interix 3.5 aka Services for Unix. But that's not the point.

If I just wanted it to compile, I could use CPPFLAGS=-Dunix or such, but I think, if there is already a test for _POSIX_VERSION, then there should be cases where this test is successful. Interix's <unistd.h> has _POSIX_VERSION, so that should be evaluated then. On my Linux, _POSIX_VERSION is also #defined in <unistd.h>, so it seems to be in a standard location. So why not include it, before the test is done?

The problem was on src/builtin.c. The very first #include is "m4.h", and there the only #include before the test is "config.h", so no chance for <unistd.h> I think.

On other platforms the compiler may #define unix or such itself, so the test succeeds. Indeed if I would use the MS compiler, this would be the case according to docs, but with gcc, it apparently isn't.

By the way, M4 can include <unistd.h> blindly, thanks to gnulib
portability code (and in fact, already does so, via "unistd--.h").  There
is no need to check for HAVE_UNISTD_H, only to rearrange the
gnulib header inclusion to occur prior to the platform macro detection
section.

Ok, that's up to you. I didn't look that deep into it.

Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]