[csw-maintainers] Pinentry compilation problem

James Lee james at opencsw.org
Fri Sep 11 10:41:28 CEST 2009


On 10/09/09, 23:13:57, Maciej "(Matchek)" Blizinski <maciej at opencsw.org>
wrote regarding [csw-maintainers] Pinentry compilation problem:

> "util.c", line 57: syntax error before or at: {
> "util.c", line 57: undefined symbol: __result
> "util.c", line 57: undefined symbol: __result
> "util.c", line 57: undefined symbol: __result
> "util.c", line 57: syntax error before or at: )
> "util.c", line 58: warning: syntax error:  empty declaration
> "util.c", line 59: cannot recover from previous errors
> cc: acomp failed for util.c
> gmake[4]: *** [util.o] Error 2

> The place in the code that causes the problem is:

> #ifndef TEMP_FAILURE_RETRY
> #define TEMP_FAILURE_RETRY(expression) \
>   (
    \
>     ({ long int __result;
    \
>        do __result = (long int) (expression);
    \
>        while (__result == -1L && errno == EINTR);
    \
>        __result; }))
> #endif


It's so nasty it deserves to fail anyway but let's look at the
syntax.  It condenses to:

    answer = ( { 1; 2; } );

in the hope that answer is assigned to 2.  I'd object to it and it
isn't valid in Java either.


Try passing the lvalue to the macro and using like a void function:

#define TEMP_FAILURE_RETRY(result, expression) \
    { long int __result; \
       do __result = (long int) (expression); \
       while (__result == -1L && errno == EINTR); \
       result = __result; }
#endif



Or rewrite as a function, this might not be work depending
on the values used for expression:


long int TEMP_FAILURE_RETRY(long int (*expression)(void))
{
    long int __result;
    do __result = (long int) (expression);
    while (__result == -1L && errno == EINTR);
    return __result;
}



Clean up:

long int TEMP_FAILURE_RETRY(long int (*expression)(void))
{
    long int result;
    while ((result = (long int) (expression)) == -1L && errno == EINTR);
    return result;
}




James.



More information about the maintainers mailing list