This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin 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: getopt: ugly linker messages


On Sat, Sep 20, 2003 at 07:32:04AM +1000, Danny Smith wrote:
> > why is then the information about the __declspec removed?  Shouldn't
> > that information be kept?  AFAIK, the "extern" storage class shouldn't
> > change any information already known about the variable in question.
> > It should complain about e.g. conflicting types but it should never
> > change what's already there.
> 
> Overriding the attribute also prevents an ICE in gcc so I believe the
> behaviour is justified. There are actually testcases in the gcc

Well... I'm not quite sure if circumventing a potential compiler bug
actually justifies a potential misbehaviour...

> void __attribute__((dllimport)) Bar(void);
> void __attribute__((dllimport)) Baz(void);
> __attribute__((dllimport)) int Biz;
> __attribute__((dllimport)) int Boz;
> 
> void Foo(void)
>   {
>     Bar();
>     Baz();
>     Biz++;	 
>     Boz++;	 
>   }
>  
> void Bar(void)
>   {			// { dg-warning "defined" }
>   }
> 
> void Baz(void);		// { dg-warning "redeclared" }
> extern int Biz;		// { dg-warning "redeclared" }
> int Boz;		// { dg-warning "defined" }
> 
> void foo()
> {
>   Biz++;
> }

The above case is imho somewhat borderline.  It defines Biz with
dllimport, but it's missing an `extern'.  What I mean is, having two
extern declarations, one with and the second without dllimport.  The
second should not touch the already existing declaration.  I don't
see why this should result in an ICE.  The other cases in the testcase
are absolutely ok, though.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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