pkgsrc-Users archive

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

at-spi2-core / _XOPEN_SOURCE



On -current/amd64, at-spi2-core is failing to build for me (with HAVE_GCC=14):

../atspi/atspi-event-listener.c: In function 'should_filter_window_events':
../atspi/atspi-event-listener.c:1039:3: error: implicit declaration of function 'timersub' [-Wimplicit-function-declaration]
 1039 |   timersub (&cur_time, &window_filter_time, &elapsed_time);


This is because it sets _XOPEN_SOURCE=700 (and _GNU_SOURCE) so
<sys/featuretest.h> doesn't set _NETBSD_SOURCE, so once atspi includes
<sys/time.h>, the timersub definition is not available.

What is the "correct" solution?

In pkgsrc, define _NETBSD_SOURCE if OS = NetBSD ?


To join in the fun:

$ cat Makefile 
PROG=           timersub
CPPFLAGS+=      -D_XOPEN_SOURCE=700
CPPFLAGS+=      -D_GNU_SOURCE
CPPFLAGS+=      -D_BSD_SOURCE
CPPFLAGS+=      -D_DEFAULT_SOURCE
#CPPFLAGS+=     -D_NETBSD_SOURCE
CPPFLAGS+=      -Wno-implicit-function-declaration
MKMAN=          no
.include <bsd.prog.mk>

$ cat timersub.c 
#include <sys/time.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
        struct timeval old_time, new_time, elapsed_time;
        gettimeofday (&old_time, NULL);
        sleep(2);
        gettimeofday (&new_time, NULL);
        timersub (&new_time, &old_time, &elapsed_time);
        printf("old : %ld.%06ld\n", old_time.tv_sec, old_time.tv_usec);
        printf("new : %ld.%06ld\n", new_time.tv_sec, new_time.tv_usec);
        printf("diff: %ld.%06ld\n", elapsed_time.tv_sec, elapsed_time.tv_usec);
}


Cheers,

Patrick


Home | Main Index | Thread Index | Old Index