Thanks for the pointers.

I'm slowly crawling my way to addressing the remaining MinGW-w64 poratbility
issues.
Neither -std=gnu99, -std=c99 or -D__USE_MINGW_ANSI_STDIO=1 seem to leave
MinGW happy with %lld & co (even with the latest build on MinGW-w64), so I'm
pretty much resigned to patching the remaining files individually.
I see you posted some comments on the bug list as well. Hopefully a future
version of the compiler will address this.

Now, before I submit further patches, I would like to know if you are OK
with a patch that goes like this, to address some of the warnings I get with
size_t values:

size_t value;
...
printf("value = " ZU "\n", (unsigned) value);

The change would be to add a casting of a size_t to unsigned in printf.
I don't think it should break much of anything, since we're still telling
printf to expect a size_t, but without the unsigned cast, MinGW-w64 does not
accept it.

Also,

2009/10/15 David Brownell <[email protected]>

> Another thing to try:  update the format specifiers in the
> headers (src/helper/{command,log}.h) to say "gnu_printf"
> instead of "printf".  Maybe that will work without changing
> so much code for the "%lld", "%zd", and "%jd" issues.
>

This seems to address some of the issue indeed.
I'm planning to go with something like this:

#ifdef IS_MINGW
extern void log_printf(enum log_levels level, const char *file, int line,
    const char *function, const char *format, ...)
    __attribute__ ((format (gnu_printf, 5, 6)));
extern void log_printf_lf(enum log_levels level, const char *file, int line,
    const char *function, const char *format, ...)
    __attribute__ ((format (gnu_printf, 5, 6)));
#else
extern void log_printf(enum log_levels level, const char *file, int line,
    const char *function, const char *format, ...)
    __attribute__ ((format (printf, 5, 6)));
extern void log_printf_lf(enum log_levels level, const char *file, int line,
    const char *function, const char *format, ...)
    __attribute__ ((format (printf, 5, 6)));
#endif

Or do you reckon we should safely be able to use gnu_printf for all
platforms and remove the need for an ifdef?

Regards,
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to