On Tue, Jul 02, 2019 at 09:29:19PM -0500, Eric Blake wrote:
+ if (dprintf (script_fd, "case $1 in\n"
This commit is already pushed, but the use of ‘dprintf’ which I'd
never heard of until yesterday triggers a bug (in our code) on
FreeBSD.
errors.c: In function 'main':
errors.c:103:7: warning: implicit declaration of function 'dprintf'; did you mean
'vdprintf'? [-Wimplicit-function-declaration]
if (dprintf (script_fd, "case $1 in\n"
^~~~~~~
vdprintf
This function was apparently standardized in POSIX.1-2008 and the
FreeBSD man page says it exists. However:
Applications that wish to use the dprintf() function described herein
should either request a strict IEEE Std 1003.1-2008 ("POSIX.1")
environment by defining the macro _POSIX_C_SOURCE to the value 200809 or
greater, or by defining the macro _WITH_DPRINTF, prior to the inclusion
of <stdio.h>. For compatibility with GNU libc, defining either
_BSD_SOURCE or _GNU_SOURCE prior to the inclusion of <stdio.h> will also
make dprintf() available.
It was always my understanding that AC_USE_SYSTEM_EXTENSIONS would
define the right symbols, and indeed in <config.h> on FreeBSD we have:
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
The problem in fact is that we don't include <config.h> in all of the
tests uniformly. I fixed a couple of these in my FreeBSD patch
yesterday, but we really must include <config.h> everywhere.
I'll try to make a patch in a minute.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html