From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: bdwgc@lists.opendylan.org,
William S Fulton <wsf@fultondesigns.co.uk>,
18711@debbugs.gnu.org
Subject: bug#18711: Numerous unknown attribute '__alloc_size__' warnings when using clang
Date: Tue, 14 Oct 2014 12:09:37 +0200 [thread overview]
Message-ID: <87egubm07y.fsf@gnu.org> (raw)
In-Reply-To: <871tqbgvca.fsf@yeeloong.lan> (Mark H. Weaver's message of "Mon, 13 Oct 2014 23:53:57 -0400")
Mark H Weaver <mhw@netris.org> skribis:
> This is clearly an issue with bdwgc on clang, and possibly only on
> Apple's version of clang. Here's the relevant section of
> gc/gc_config_macros.h from bdwgc 7.4.2:
>
> #ifndef GC_ATTR_ALLOC_SIZE
> /* 'alloc_size' attribute improves __builtin_object_size correctness. */
> /* Only single-argument form of 'alloc_size' attribute is used. */
> # if defined(__GNUC__) && (__GNUC__ > 4 \
> || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 && !defined(__ICC)) \
> || __clang_major__ > 3 \
> || (__clang_major__ == 3 && __clang_minor__ >= 2))
> # define GC_ATTR_ALLOC_SIZE(argnum) __attribute__((__alloc_size__(argnum)))
> # else
> # define GC_ATTR_ALLOC_SIZE(argnum)
> # endif
> #endif
AFAIK, Clang and ICC define __GNUC__ by default, even though they don’t
implement all the features of the corresponding GCC, which may explain
why the above doesn’t work as expected.
> You can see that the bdwgc developers have made an effort to check both
> GCC and clang version numbers before using the __alloc_size__ attribute.
> The code above seems to suggest that they believed clang 3.2 or later
> supported this attribute, whereas your version of clang seems to be
> based on upstream clang 3.5. Perhaps Apple removed support for this
> attribute from their clang?
I think for Clang the right way would be to use the ‘__has_attribute’
magic macro:
http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
Ludo’.
prev parent reply other threads:[~2014-10-14 10:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-13 20:56 bug#18711: Numerous unknown attribute '__alloc_size__' warnings when using clang William S Fulton
2014-10-14 3:53 ` Mark H Weaver
2014-10-14 7:10 ` William S Fulton
2014-10-15 16:39 ` Mark H Weaver
2014-10-16 22:07 ` bug#18711: Re[2]: [Gc] " Ivan Maidanski
2014-10-14 10:09 ` Ludovic Courtès [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87egubm07y.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=18711@debbugs.gnu.org \
--cc=bdwgc@lists.opendylan.org \
--cc=mhw@netris.org \
--cc=wsf@fultondesigns.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).