[PATCH] set HAVE___ATTRIBUTE__ for heimdal

Andreas Schneider asn at samba.org
Thu Mar 10 07:50:35 UTC 2016


On Tuesday 08 March 2016 11:38:07 Douglas Bagnall wrote:
> The other day I wrote:
> > For what it's worth, gcc-6 is currently broken in other ways and
> > doesn't compile Samba without spurious patches.
> 
> but I was wrong. It turns out gcc-6 was noticing actual problems,
> specifically in code like this:
> 
> #define UNREACHABLE(x)
> 
> #ifndef HAVE___ATTRIBUTE__
> #define __attribute__(x)
> #endif
> 
> void
> _hx509_abort (const char *, ...)
>      __attribute__ ((noreturn, format (printf, 1, 2)));
> 
> int
> _hx509_expr_eval(hx509_context context, hx509_env env, struct hx_expr *expr)
> {
>     switch (expr->op) {
>      /*...*/
>     default:
> 	_hx509_abort("hx509 eval expr with unknown op: %d", (int)expr->op);
> 	UNREACHABLE(return 0);
>     }
> }
> 
> where it turns out that HAVE____ATTRIBUTE__ is not defined, hence gcc
> doesn't know _hx509_abort won't return and it looks like the default
> case fails to return int. Whether older compilers were cleverer in
> working out for themselves that _hx509_abort aborted or stupider in
> not knowing when to warn, I don't know.
> 
> By the way, I found a non-existent attribute in the conf.CHECK_CODE
> block doesn't cause an error, so the previous two checks
> (HAVE_CONSTRUCTOR_ATTRIBUTE and HAVE_DESTRUCTOR_ATTRIBUTE) don't check
> that the attributes actually mean anything. In other words, all three
> checks are essentially identical.
> 
> cheers,
> Douglas

RB+

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list