This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unreviewed cygwin/mingw dllimport patch for PRs 5287. 7910, 11021


 --- Christopher Faylor <cgf@redhat.com> wrote: > On Wed, Jul 02, 2003 at 11:25:23PM -0400, Jason
Merrill wrote:
> >On Thu, 3 Jul 2003 07:02:24 +1000 (EST), Danny Smith <danny_r_smith_2001@yahoo.co.nz> wrote:
> >
> >>  --- Jason Merrill <jason@...> wrote: > On Thu, 12 Jun 2003 08:20:42 +1000 (EST), Danny Smith
> >> <danny_r_smith_2001@...> wrote:
> >>> 
> >>> > My reason for the test for TREE_STATIC of dllimport'd variables in this:
> >>> >
> >>> > if (is_attribute_p ("dllimport", name)) 
> >>> >     &&TREE_CODE (node) == VAR_DECL)
> >>> >   {
> >>> >     if (!TREE_STATIC (node))
> >>> >      /* This is needed for declarations of variables within functions */
> >>> >       TREE_PUBLIC (node) = 1; 
> >>> >     DECL_EXTERNAL (node) = 1;
> >>> >   }
> >>> >
> >>> > /* This is for all dllimport/export'd symbols */
> >>> > if (! TREE_PUBLIC (node))
> >>> >    error ("external linkage required")
> >>> >
> >>> >
> >>> > is to allow this, by setting TREE_PUBLIC as well DECL_EXTERNAL:
> >>> >
> >>> > void foo()
> >>> > {
> >>> >   __attribute__((dllimport))
> >>> >   int foovar;     // OK,  implicit "extern" 
> >>> >   foovar++;
> >>> > }
> >>> 
> >>> That's horrible.  That should be an error; foovar is an automatic variable.
> >>> Does VC++ allow this?
> >>
> >> VC++ explicitly documents this as supported. 
> >>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/html/_pluslang_definitions_and_declarations.asp
> >
> >So it does.  Evidently dllimport overrides the implicit 'auto'.  I still
> >think that's horrible, but I suppose we ought to support it.  I suppose
> >that what's going on is that in VC++ dllimport implies the keyword
> >'extern', so you can use it wherever 'extern' is valid.
> >
> >So I guess this is OK.
> 
> I agree that this is absolutely horrible but if we are supporting the
> MSVC brain damage, I guess we have no choice.
> Please check in, Danny, trunk and branch.
> 

Okay just to be clear.  In light of Jason's original comment I revised the patch
removing the virtual method part, but also streamlining the code somewhat, following
Jason's advice on the static const initialization part, and hopefully making the 
error messages less ambiguous. 

http://gcc.gnu.org/ml/gcc-patches/2003-06/msg01681.html

Is approval for the revised patch?  If so, should I add back in the the virtual method
part and testcase or submit that separately along with the MI-thunk patch, as originally requested
by Jason?

Danny

> Then have some champagne.  How long has this patch been percolating?  Years?
> 
> cgf 

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]