diff options
author | Bruno Haible <bruno@clisp.org> | 2020-11-24 01:32:51 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-11-24 01:32:51 +0100 |
commit | 387d654cabd7bc1594b1fc8d195cd9b66f820296 (patch) | |
tree | b5a55d5ac5176f4b3914b9983f6c3f491d4b950e /lib/error.h | |
parent | cb432e7d6144c99da594f1fbce8ec8fd939745a0 (diff) | |
download | gnulib-387d654cabd7bc1594b1fc8d195cd9b66f820296.tar.gz |
Use the correct printf format attribute for mingw.
Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-11/msg00133.html>.
* modules/vfprintf-posix (configure.ac): Define GNULIB_VFPRINTF_POSIX.
* modules/vprintf-posix (configure.ac): Define GNULIB_VPRINTF_POSIX.
* lib/stdio.in.h (_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD,
_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM): New macros.
(_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD): Renamed from
_GL_ATTRIBUTE_FORMAT_PRINTF. Use _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD.
(_GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM): Use
_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM.
* modules/vasnprintf (Depends-on): Add stdio.
* lib/vasnprintf.h: Include <stdio.h>.
(asnprintf, vasnprintf): Use the standard printf format attribute.
* modules/xvasprintf (Depends-on): Add stdio.
* lib/xvasprintf.h: Include <stdio.h>.
(xasprintf, xvasprintf): Use the standard printf format attribute.
* modules/xprintf (Depends-on): List stdio first.
* lib/xprintf.h (xprintf, xvprintf): Use a printf format attribute that
depends on GNULIB_VPRINTF_POSIX.
(xfprintf, xvfprintf): Use a printf format attribute that depends on
GNULIB_VFPRINTF_POSIX.
* modules/c-vasnprintf (Depends-on): Add stdio.
* lib/c-vasnprintf.h: Include <stdio.h>.
(c_vasnprintf): Use the standard printf format attribute.
* modules/c-vasprintf (Depends-on): Add stdio.
* lib/c-vasprintf.h: Include <stdio.h>.
(c_asprintf, c_vasprintf): Use the standard printf format attribute.
* modules/c-vsnprintf (Depends-on): Add stdio.
* lib/c-vsnprintf.h: Include <stdio.h>.
(c_vsnprintf): Use the standard printf format attribute.
* modules/c-snprintf (Depends-on): Add stdio.
* lib/c-snprintf.h: Include <stdio.h>.
(c_snprintf): Use the standard printf format attribute.
* modules/c-xvasprintf (Depends-on): Add stdio.
* lib/c-xvasprintf.h: Include <stdio.h>.
(c_xasprintf, c_xvasprintf): Use the standard printf format attribute.
* modules/error (Depends-on): Depend on stdio always.
* lib/error.h: Include <stdio.h>.
(_GL_ATTRIBUTE_SPEC_PRINTF): Remove macro.
(error, error_at_line): Use a printf format attribute that depends on
GNULIB_VFPRINTF_POSIX.
* lib/error.c (_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD): Renamed from
_GL_ATTRIBUTE_FORMAT_PRINTF.
* modules/verror (Depends-on): Add stdio.
* lib/verror.h: Include <stdio.h>. Don't include "error.h".
(verror, verror_at_line): Use the standard printf format attribute.
* lib/verror.c: Include "error.h".
* modules/argp (Depends-on): Add stdio.
* lib/argp.h (argp_error, __argp_error, argp_failure, __argp_failure):
Use a printf format attribute that depends on GNULIB_VFPRINTF_POSIX.
* modules/libtextstyle-optional (Depends-on): Add stdio.
* lib/textstyle.in.h (ostream_printf, ostream_vprintf): Use the standard
printf format attribute.
* tests/test-nonblocking-misc.h (dbgfprintf): Use the standard printf
format attribute.
Diffstat (limited to 'lib/error.h')
-rw-r--r-- | lib/error.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/error.h b/lib/error.h index a351606f81..6f6c90e402 100644 --- a/lib/error.h +++ b/lib/error.h @@ -19,15 +19,8 @@ #ifndef _ERROR_H #define _ERROR_H 1 -/* On mingw, the flavor of printf depends on whether the extensions module - * is in use; the check for <stdio.h> determines the witness macro. */ -#ifndef _GL_ATTRIBUTE_SPEC_PRINTF -# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU -# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__ -# else -# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__ -# endif -#endif +/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ +#include <stdio.h> #ifdef __cplusplus extern "C" { @@ -38,11 +31,21 @@ extern "C" { If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4)); +#if GNULIB_VFPRINTF_POSIX + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 4)) +#else + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 3, 4)) +#endif + ; extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6)); +#if GNULIB_VFPRINTF_POSIX + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 6)) +#else + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 5, 6)) +#endif + ; /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this |