Re: mingw-w64 and __attribute__((format(printf))) issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/6/20 5:36 AM, Liu Hao via Gcc-help wrote:
> Due to a recent change in mingw-w64 master [1], libgomp ceases to build:
> 
> ```
> ../../../gcc-git/libgomp/target.c:936:21: error: unknown conversion type
> character 'l' in format [-Werror=format=]
>   936 |         gomp_fatal ("present clause: !acc_is_present (%p, "
>       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ```
> 
> 
> On line 29 of 'libgomp/libgomp.h' from GCC 9 branch I found this declaration
> 
> ```
> extern void gomp_fatal (const char *, ...)
>         __attribute__ ((noreturn, format (printf, 1, 2)));
> ```
> 
> , which uses the `printf` attribute, but the `PRIu64` macro from
> <inttypes.h> expands to `%llu` because now GCC has `-std=gnu11` by
> default, which is only valid with `gnu_printf`.
> 
> AFAICS there are three solutions:
> 
> 1. Revert bfd33f6c0ec5e652cc9911857dd1492ece8d8383 in mingw-w64, or
> 2. Make GCC treat `format(printf)` as `format(gnu_printf)` if C11 or
>    C++11 is selected, or
> 3. Replace `format(printf)` with `format(gnu_printf)` in libgomp source.
> 
> 
> What do you think?
> 
> 
> [1]
> https://github.com/mingw-w64/mingw-w64/commit/bfd33f6c0ec5e652cc9911857dd1492ece8d8383
> 
> 

I think option #3 is the simplest approach in the short term, though I
prefer option #2.

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux