glib/glib/gnulib
Chun-wei Fan 72528938b7 Meson: Check for HAVE_GOOD_PRINTF
The HAVE_GOOD_PRINTF config variable determines whether we are able to
use the CRT-supplied *printf() functions directly, by determining whether
the CRT-supplied vsnprintf() and snprintf() functions support C99 well
enough.

This means, we need to build the gnulib subdir as a static lib in GLib, and use
the gnulib *printf() functions when:

-We are on Windows
-The CRT's vsnprintf() and snprintf() is not sufficiently C99-compliant.

This will fix the problem when the *printf() functions cause a CRT
abort() call on pre-2015 Visual Studio builds at least, and ensures that
the Visual Studio 2015+ builds will pass the printf tests in GLib, since
the *printf() in Visual Studio 2015/2017's CRT does not support the %n
format specifier, nor the positional parameters (which requires
different _*printf_p*() functions), as indicated by
glib/tests/test-printf.c.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:46:37 +08:00
..
asnprintf.c Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
g-gnulib.h Updated FSF's address 2014-01-31 14:31:55 +01:00
Makefile.am build: Drop nmake/MSC build system for GLib 2017-07-10 11:22:40 +01:00
meson.build Meson: Check for HAVE_GOOD_PRINTF 2017-08-17 17:46:37 +08:00
printf-args.c Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
printf-args.h Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
printf-parse.c Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
printf-parse.h Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
printf.c Make gnulib vfprintf return the number of bytes actually written 2016-01-14 15:11:08 +00:00
printf.h Updated FSF's address 2014-01-31 14:31:55 +01:00
README Fix 64bit printing for MSVC builds (#119292, Hans Breuer): 2003-11-02 00:54:02 +00:00
vasnprintf.c Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
vasnprintf.h Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
verify.h Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00
xsize.h Regenerate the vasnprintf gnulib module imported files 2017-03-09 17:18:55 +00:00

The files
 
 asnprintf.c 
 printf-args.c
 printf-args.h
 printf-parse.c
 printf-parse.h
 vasnprintf.c
 vasnprintf.h

are taken from the vasnprintf module of the GNUlib package, which can
be found at: 

 http://www.gnu.org/software/gnulib/

All files have been modified to include g-gnulib.h. 

vasnprintf.c has also been modified to include support for long long 
printing if the system printf doesn't. This code is protected by 
#ifndef HAVE_LONG_LONG_FORMAT.

Code has been added to printf-args.[ch], printf-parse.c and vasnprintf.c
to support printing of __int64 values with the I64 format modifier. This
is protected by #ifdef HAVE_INT64_AND_I64.

The files

 printf.h 
 printf.c
 g-gnulib.h

have been written by me. printf.[hc] contain implementations of the  
remaining functions in the printf family based on vasnprintf. 
g-gnulib.h is included by all source files in order to move all
exported functions to the _g_gnulib namespace, replace malloc by
g_malloc and make sure that snprintf is only used if it implements 
C99 return value semantics. 

Matthias Clasen
November 1, 2003