Jean-Marc Lasgouttes wrote:

>>>>>>"Ben" == Ben Stanley <[EMAIL PROTECTED]> writes:
>>>>>>
>
>Ben> Jean-Marc, Can you please check if the #define _POSIX_C_SOURCE
>Ben> 199506L
>
>Ben> modification would fix this problem on compaq? 
>
>It does not work. 
>
Please refresh my memory... on this platform, MAP_FAILED is defined to 
be (-1L)?
With the _POSIX_C_SOURCE define, we should get void* from mmap and 
others... so it is trying to compare void* with long.
So the only solution left is a reinterpret_cast to get around the bad 
header on that platform.

I think that the _POSIX_C_SOURCE is the right thing to do - the 
MAP_FAILED thing is a separate problem.

So what kind of patch are you looking for? Some autoconf magic to 
somehow detect a bad type for MAP_FAILED and to deal with it regardless 
of platform?

ie try to compile from configure

#define _POSIX_C_SOURCE 199506L
#include <sys/mman.h>
int main()
{
    void*p;
    return p == MAP_FAILED;
}

If that works then #define HAVE_OK_MAP_FAILED

and then at the top of lyxsum.C

#ifdef HAVE_OK_MAP_FAILED
#define CAST_MAP(x) x
#else
#define CAST_MAP(x) reinterpret_cast<void*>(x)
#endif

and in the code

    if (mm == CAST_MAP(MAP_FAILED)) {
        // fail code...
    }

Seems a lot easier to just do everywhere (because it will work everywhere)

    if (mm == reinterpret_cast<void*>(MAP_FAILED)) {
        // fail code...
    }

Thanks for the reference - I think it shows the _POSIX_C_SOURCE macro is 
the right thing to do to get the correct prototype.

Ben.



Reply via email to