From: Daniel L. <da...@ma...> - 2016-10-14 09:21:42
|
> On 13 Oct 2016, at 23:07, hp...@zy... wrote: > > On October 13, 2016 1:55:04 PM PDT, Daniel Lundqvist <da...@ma...> wrote: >> >>> On 8 Oct 2016, at 06:35, H. Peter Anvin <hp...@zy...> wrote: >>> >>> On 10/07/16 06:46, Daniel Lundqvist wrote: >>>> >>>> Unfortunately clang does not realise that 'again' will never be >> false >>>> for non-glibc. How do you want that fixed? Is it OK to just >>>> initialise f to NULL or do you prefer something else? >>>> >>> >>> Setting f to NULL is fine. >>> >>> From fd764d58a7ada29f5121e275ee6b1c050c5f219f Mon Sep 17 00:00:00 >> 2001 >>> From: Daniel Lundqvist <da...@ma...> >>> Date: Fri, 7 Oct 2016 15:41:24 +0200 >>> Subject: [PATCH] include/compiler.h: Adapt 'malloc' attributes for >> clang. >>> >>> As clang does not support alloc_size attribute, don't try to use it. >>> >>> Signed-off-by: Daniel Lundqvist <da...@ma...> >>> >>> What happens if you do, given that it defined __GNUC__ and therefore >>> claims to be compatible with gcc? >>> >>> -hpa >> >> It gives an 'unknown attribute' warning. IIRC, clang defining __GNUC__ >> does not mean 100% compatibility, rather it means gcc-like. I remember >> reading about it, but can't find a source right now. I don't know how >> viable it is to use __has_attribute, at least recent versions of both >> gcc and clang support it. > > __has_attribute() sounds promising... do we have a presence test for that? Yes, if __has_attribute is defined. Same mechanism for __has_feature. See http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute <http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute> and http://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension <http://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension> for typical usage. -- daniel |