[cfe-dev] Weak pointer support on 32-bit platforms
Reid Kleckner
rnk at google.com
Mon May 12 15:29:10 PDT 2014
On Mon, May 12, 2014 at 12:18 PM, Hovik Melikyan
<hovik.melikyan at gmail.com>wrote:
> On Mon, May 12, 2014 at 7:20 PM, Reid Kleckner <rnk at google.com> wrote:
> >
> > You can probably work around this with -D__GNUC__=4.
> >
> > However, why do you need -fms-compatibility if you are using MinGW?
> >
>
> Clang puts itself into MS compatibility mode when the target is e.g.
> i686-pc-win32. A better workaround for me was to use
> -fno-ms-compatibility.
>
So, you're using MinGW headers with i686-pc-win32 instead of
i686-pc-mingw32. The former target aims for MSVC compatibility and the
latter MinGW/GCC compatibility.
Using MinGW headers with -win32 is crossing the streams, and I don't
recommend doing it, unless you have a really good reason. You are probably
going to have problems linking C++ binaries or passing structs across ABI
boundaries.
> In any case, I don't think this
>
> Builder.defineMacro("__weak", "__attribute__((objc_ownership(weak)))");
>
> was a good idea, as it makes some of the most critical attributes in
> Objective C dependent on a compiler extension (__attribute__) which is
> not always available at compile time!
>
Well, Clang always provides __attribute__, so it's perfectly reasonable to
implement __weak this way. MinGW shouldn't be messing with the
implementors namespace this way.
That said, I'm in favor of making these contextual keywords. We have the
infrastructure to do it, so let's avoid the pre-processor cruftiness.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140512/db546ebd/attachment.html>
More information about the cfe-dev
mailing list