[PATCH] Sema: Treat dllimport globals without explicit storage class as extern

Gao, Yunzhong yunzhong_gao at playstation.sony.com
Wed Feb 26 15:45:29 PST 2014


Hi Nico,

> Because redeclarations inherit the attribute. This would make the second
> line in the following snippet a declaration instead of a definition:

Thanks for clarifying. So with your patch, what is the expected compiler behaviour on the
following snippet?
__declspec(dllimport) int v;
int v;

>From your test case it seems that I will get a compile-time error "definition of dllimport data",
but when I test this out on Visual Studio 2012, I got only a warning:
warning C4273: inconsistent dll linkage

This makes me wonder whether your previous patch is breaking some compatibility.

> I do have a comprehensive set of IRGen tests but they aren't split up
> yet into incremental patches, and this first round of patches is just
> for Sema.

I take this to mean, more tests are coming? If so, it is fine with me.

- Gao.

________________________________________
From: Nico Rieck [nico.rieck at gmail.com]
Sent: Wednesday, February 26, 2014 3:22 PM
To: Gao, Yunzhong; cfe-commits
Subject: Re: [PATCH] Sema: Treat dllimport globals without explicit storage class as extern

On 26.02.2014 23:18, Gao, Yunzhong wrote:
> Why do you have to check whether the dllimport attribute is inherited?

Because redeclarations inherit the attribute. This would make the second
line in the following snippet a declaration instead of a definition:

__declspec(dllimport) int v;
int v;

> Do you have a test case that checks that the generated IR has the correct linkage?

I do have a comprehensive set of IRGen tests but they aren't split up
yet into incremental patches, and this first round of patches is just
for Sema.

-Nico






More information about the cfe-commits mailing list