[PATCH] set HAVE___ATTRIBUTE__ for heimdal
Douglas Bagnall
douglas.bagnall at catalyst.net.nz
Mon Mar 7 22:38:07 UTC 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-configure-set-HAVE___ATTRIBUTE__-for-heimdal.patch
Type: text/x-diff
Size: 1418 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160308/20b65f93/0001-configure-set-HAVE___ATTRIBUTE__-for-heimdal.diff>
More information about the samba-technical
mailing list