On Sat, Aug 28, 2021 at 03:47:37PM +0200, Christian Göttsche wrote:
> On Sat, 28 Aug 2021 at 15:27, Thomas Dickey <dic...@his.com> wrote:
> >
> > sure - they're conditioned on a nonstandard extension to C.
> > Debian can provide some patch which hardcodes that condition,
> > but as I recall it, there's no clean way to provide this in
> > standard C.
> >
> 
> Yes, these function attributes are GNU extensions.
> But GCC_PRINTFLIKE is defined via `__attribute__`[1], and if __GNUC__
> is not set, `__attribute__` is defined empty.
> So the attributes are only enabled if the compiler defines __GNUC__
> and then the compiler should support those.

I believe you're misreading the source-code.

The GCC_PRINTF symbol is defined if the (build-time) configure check decides
that the compiler supports the feature (i.e., while the compiler may accept
__attribute__, it may not accept a particular parameter).  Ditto for GCC_SCANF.

Configure check here:

https://github.com/ThomasDickey/my-autoconf-snapshots/blob/master/AcSplit/CF_GCC_ATTRIBUTES

Since ncurses does build and work with a far wider range of compilers than
Debian uses, it would be appropriate for Debian to use a patch to address
this issue, which sometime might be useful in upstream ncurses.
 
> [1]: 
> https://sources.debian.org/src/ncurses/6.2+20201114-4/include/curses.h.in/#L521
> [2]: 
> https://sources.debian.org/src/ncurses/6.2+20201114-4/include/curses.h.in/#L508

fwiw, I had a to-do item in this area based on my comments here
(I noticed some places where the attribute was not visible):

https://github.com/tmux/tmux/pull/2851 

-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to