[cairo] [PATCH 3/4] test: Only use alarm() when SIGALRM is also defined

Maarten Bosmans mkbosmans at gmail.com
Tue Apr 10 11:26:11 PDT 2012


2012/4/10 Uli Schlachter <psychon at znc.in>:
> Hi,
>
> On 09.04.2012 21:33, Maarten Bosmans wrote:
>> On some platforms (mingw) the alarm() configure check succeeds, but the
>> alarm function doesn't actually work.
>> ---
>>  test/cairo-test.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/test/cairo-test.c b/test/cairo-test.c
>> index c5ef843..3f37147 100644
>> --- a/test/cairo-test.c
>> +++ b/test/cairo-test.c
>> @@ -90,7 +90,7 @@
>>  #define ARRAY_SIZE(A) (sizeof(A) / sizeof (A[0]))
>>  #endif
>>
>> -#if ! HAVE_ALARM
>> +#if ! HAVE_ALARM || ! defined(SIGALRM)
>>  #define alarm(X);
>>  #endif
>
> What exactly does "doesn't actually work" mean? If no SIGALRM is raised (in
> other words: alarm() doesn't actually work and is a no-op), then what is the
> problem that this patch solves?

I'm cross-compiling for win32. Somehow the
AC_CHECK_FUNCS([alarm])
configure check finds the alarm function and defines HAVE_ALARM, but
compilation of cairo-test.c fails with:

cairo-test.c: In function 'cairo_test_for_target':
cairo-test.c:922:5: error: implicit declaration of function 'alarm'
[-Werror=implicit-function-declaration]
cairo-test.c:922:5: warning: nested extern declaration of 'alarm'
[-Wnested-externs]

So perhaps the configure check should be tweaked, but as I have no
clue about the real origin of the problem, I though my solution was a
nice workaround. As Chris pointed out, even in without considering
this bug, it is not unreasonable to do.

Maarten


More information about the cairo mailing list