Mercurial > hg > octave-nkf > gnulib-hg
changeset 12451:419d4e1a3d41
fcntl-h, stdio, sys_ioctl: fix declarations
We cannot use a function-like macro to provide a link-time warning
of a variadic function during GNULIB_POSIXCHECK; at least, not
without assuming C99 variadic macros. We can, however,
use an object-like macro (as was already done for printf).
On the other hand, this patch is only a stop-gap measure to fix
an obvious bug; a more complete patch that switches from a
link-time warning (specific to GNU ld, gcc, and ELF image) to
a compile-time attribute is in the works.
* lib/stdio.in.h (dprintf): Use of link warning on a variadic
function must not take arguments.
* lib/sys_ioctl.in.h (ioctl): Likewise.
* lib/fcntl.in.h (openat): Likewise. Declare extern.
(open): Add a link warning.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 15 Dec 2009 06:51:24 -0700 |
parents | 6590c835b804 |
children | cc0faab513a7 |
files | ChangeLog lib/fcntl.in.h lib/stdio.in.h lib/sys_ioctl.in.h |
diffstat | 4 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-15 Eric Blake <ebb9@byu.net> + + fcntl-h, stdio, sys_ioctl: fix declarations + * lib/stdio.in.h (dprintf): Use of link warning on a variadic + function must not take arguments. + * lib/sys_ioctl.in.h (ioctl): Likewise. + * lib/fcntl.in.h (openat): Likewise. Declare extern. + (open): Add a link warning. + 2009-12-15 Jim Meyering <meyering@redhat.com> areadlink, areadlink-with-size: relax license to LGPLv2+ @@ -5,7 +14,7 @@ * modules/areadlink-with-size (License): Likewise. 2009-12-15 Joel E. Denny <jdenny@clemson.edu> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> *printf: Fix memory leak. * lib/fprintf.c (fprintf): Free memory allocated by vasnprintf.
--- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -61,6 +61,12 @@ # define open rpl_open extern int open (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1)); # endif +#elif defined GNULIB_POSIXCHECK +# undef open +# define open \ + (GL_LINK_WARNING ("open is not always POSIX compliant - " \ + "use gnulib module open for portability"), \ + open) #endif #if @GNULIB_OPENAT@ @@ -69,12 +75,12 @@ # define openat rpl_openat # endif # if !@HAVE_OPENAT@ || @REPLACE_OPENAT@ -int openat (int fd, char const *file, int flags, /* mode_t mode */ ...) +extern int openat (int fd, char const *file, int flags, /* mode_t mode */ ...) _GL_ARG_NONNULL ((2)); # endif #elif defined GNULIB_POSIXCHECK # undef openat -# define openat(f,u,g) \ +# define openat \ (GL_LINK_WARNING ("openat is not portable - " \ "use gnulib module openat for portability"), \ openat)
--- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -80,10 +80,10 @@ # endif #elif defined GNULIB_POSIXCHECK # undef dprintf -# define dprintf(d,f,a) \ +# define dprintf \ (GL_LINK_WARNING ("dprintf is unportable - " \ "use gnulib module dprintf for portability"), \ - dprintf (d, f, a)) + dprintf) #endif #if @GNULIB_FCLOSE@
--- a/lib/sys_ioctl.in.h +++ b/lib/sys_ioctl.in.h @@ -54,10 +54,10 @@ # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl #elif defined GNULIB_POSIXCHECK # undef ioctl -# define ioctl(f,c,a) \ +# define ioctl \ (GL_LINK_WARNING ("ioctl does not portably work on sockets - " \ "use gnulib module ioctl for portability"), \ - ioctl (f, c, a)) + ioctl) #endif