Theo de Raadt <dera...@openbsd.org> wrote:

> sensiblehue <sensible...@firemail.cc> wrote:
> 
> > On Thu, Jun 11, 2020 at 03:08:01PM +0200, Marc Espie wrote:
> > > On Thu, Jun 11, 2020 at 04:37:34AM +0000, sensiblehue wrote:
> > > > Hello,
> > > > I was wondering why OpenBSD doesn't have a `__printflike' macro in
> > > > <sys/cdefs.h>? FreeBSD, NetBSD, and DragonflyBSD have it and it's also
> > > > available from libbsd on Linux.
> > > > Personally I think it's cleaner and just as portable if not more
> > > > portable, because some compilers don't support `__attribute__'.
> > > 
> > > 
> > > What compilers ?
> > 
> > GCC < v2.5 and non GNU C compilers, though I see now that OpenBSD
> > defines it to nothing in that case.
> 
> Ah, so it does actually work fine, unlike what you originally claimed.
> 
> 
> > To be honest I'm mostly suggesting __printflike because I want to use it
> > in my own code and still have it compile on OpenBSD without an #ifdef,
> > but it would also make software from other BSDs easier to port.
> 
> We are using the attribute mechanism directly in a way that works on
> all modern (10 years?).
> 
> Intentionally.

Let me reiterate why it is used directly.  You probably understand, but
I'm not sure you see the value.

1. If the compiler supports attributes but does not know this one, the
   code compiles, the special handling isn't done, and everything works.

2. If the compiler supports attributes but and knows it, the special handling
   is performed, and everything works.

3. If the compiler is so old that it doesn't handle unsupported attributes,
   go use a different (new) compiler.


You say you want to use an old compiler which doesn't handle unknown
attributes?

How will you cope with all the operating systems which lack the #define
you request?




Reply via email to