gnulib can #define __USE_MINGW_ANSI_STDIO so that %z is implemented, but warnings are still generated for xasprintf (not for printf).
As far as I can tell, this is because the _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM machinery to choose the correct attribute (__gnu_printf__ or __printf__) for printf-like functions needs to be used in xvasprintf.h and hence vasnprintf.h as well as in stdio.h. I guess this applies to all printf-like functions in gnulib that ultimately use the system printf, that is, in verror.h, xprintf.h and argp.h (which depend on xvasprintf or stdio). -- https://rrt.sc3d.org