[LTP] [PATCH v1] Rewrite confstr01.c test using new LTP API

Petr Vorel pvorel@suse.cz
Thu Feb 17 09:10:04 CET 2022


Hi,

>  #define _XOPEN_SOURCE 500
> +#include <stdlib.h>
>  #include <unistd.h>
> +#include "tst_test.h"


When including headers like this we get warning due _XOPEN_SOURCE 500

rm -f -f -r confstr01  *.o *.pyc .cache.mk *.dwo .*.dwo
In file included from ../../../../include/tst_safe_net.h:15,
                 from ../../../../include/tst_test.h:100,
                 from confstr01.c:19:
../../../../include/tst_net.h:32:74: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration
   32 |                                           const char *port, const struct addrinfo *hints,

We need to load <stdlib.h> before _XOPEN_SOURCE 500.
IMHO _XOPEN_SOURCE 500 is for <unistd.h>, which defines these _CS_XBS5* definitions,
thus safe to do.

500 (X/Open 5) is for POSIX 1995. IMHO we should update (as a separate effort).
@Cyril don't we want to test POSIX 2008 (700)? Or even 2017 (not sure how to
define it?)

Kind regards,
Petr


More information about the ltp mailing list