[PATCH] util/attr.h: use HAVE___ATTRIBUTE__, not __GNUC__ comparisons
uri at samba.org
Wed Mar 23 04:50:44 UTC 2016
On 03/23/2016 04:51 AM, Douglas Bagnall wrote:
> Version 2, with additions.
>> #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
>> #define _NORETURN_ __attribute__ ((noreturn))
>> #define _NORETURN_
>> which would have done the wrong thing for 4.0. With version 5, GCC
>> switched to 1-based minor versions, but as gcc-6 has not been
>> released, I still have a minor version of zero.
> The first time I had "#if HAVE___ATTRIBUTE__" instead of
> "#ifdef HAVE___ATTRIBUTE__". Oops.
> This also has patches for a few other places doing the same kind of
> thing. There are some interesting variations that might need a close
> Andrew has RB+ed the first one.
RB+ me - not pushing yet b/c others with perspective on different
compilers and platforms may want to comment on infrastructure changes.
One minor thing I might have done differently - if we've come to rely on
HAVE__ATTRIBUTES__, perhaps the test in wscript should be modified to
make sure that this hypothetical non-GNU compiler which supports
__attribute__ also supports the GNU semantics that it ignores attributes
it does not recognize - put some non-existing attribute in the test
code. But that's too theoretical - if the build breaks for some compiler
after this change then we can modify the test.
More information about the samba-technical