public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* getopt: ugly linker messages
@ 2003-09-18 19:56 Bryan Higgins
  2003-09-18 19:57 ` Christopher Faylor
  0 siblings, 1 reply; 24+ messages in thread
From: Bryan Higgins @ 2003-09-18 19:56 UTC (permalink / raw)
  To: cygwin

How can I suppress the linker messages

Info: resolving _opterr by linking to __imp__opterr (auto-import)
Info: resolving _optarg by linking to __imp__optarg (auto-import)
Info: resolving _optopt by linking to __imp__optopt (auto-import)
Info: resolving _optind by linking to __imp__optind (auto-import)

which now appear?
--------
Bryan Higgins, Albany, California

--
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: getopt: ugly linker messages
@ 2003-09-18 20:13 Bryan Higgins
  2003-09-18 20:18 ` Christopher Faylor
  0 siblings, 1 reply; 24+ messages in thread
From: Bryan Higgins @ 2003-09-18 20:13 UTC (permalink / raw)
  To: cygwin

On Thu, 18 Sep 2003 15:56:07 -0400, Christopher Faylor wrote:

>On Thu, Sep 18, 2003 at 12:53:22PM -0700, Bryan Higgins wrote:
>>How can I suppress the linker messages
>>
>>Info: resolving _opterr by linking to __imp__opterr (auto-import)
>>Info: resolving _optarg by linking to __imp__optarg (auto-import)
>>Info: resolving _optopt by linking to __imp__optopt (auto-import)
>>Info: resolving _optind by linking to __imp__optind (auto-import)
>>
>>which now appear?
>
>#include <getopt.h>
>
>and don't define any of the getopt variables yourself.

Since POSIX getopt is handled in unistd.h, shouldn't the magic appear there?

>there is no getopt(3)

Maybe there needs to be to document the need for getopt.h?

--
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: getopt: ugly linker messages
@ 2003-09-18 20:48 Bryan Higgins
  2003-09-18 21:46 ` Rolf Campbell
  0 siblings, 1 reply; 24+ messages in thread
From: Bryan Higgins @ 2003-09-18 20:48 UTC (permalink / raw)
  To: cygwin

Christopher Faylor wrote:

>You can use unistd.h if you want.  If you knew this already why were you
>asking the question?

From the gnu getopt(3) man page (mysteriously missing in cygwin):

       #include <unistd.h>

       int getopt(int argc, char * const argv[],
                  const char *optstring);

       extern char *optarg;
       extern int optind, opterr, optopt;

If one does this with the latest cygwin, ugly linker messages result.

--
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: getopt: ugly linker messages
@ 2003-09-19 22:14 Danny Smith
  2003-09-20  9:53 ` Corinna Vinschen
  0 siblings, 1 reply; 24+ messages in thread
From: Danny Smith @ 2003-09-19 22:14 UTC (permalink / raw)
  To: cygwin

Re: getopt: ugly linker messages
From: Corinna Vinschen <corinna-cygwin at cygwin dot com> 
To: cygwin at cygwin dot com 
Date: Fri, 19 Sep 2003 17:34:09 +0200 
Subject: Re: getopt: ugly linker messages 
References: <200309181953.h8IJrMWa017255@bolt.sonic.net> <20030918195607.GA11311@redhat.com>
<3F6A7C70.7030901@cwilson.fastmail.fm> <20030919064843.GM9981@cygbert.vinschen.de>
<3F6B0965.3050304@cwilson.fastmail.fm> <20030919151803.GE17232@redhat.com> 
Reply-to: cygwin at cygwin dot com 

--------------------------------------------------------------------------------

On Fri, Sep 19, 2003 at 11:18:03AM -0400, Christopher Faylor wrote:
> > On Fri, Sep 19, 2003 at 09:49:25AM -0400, Charles Wilson wrote:
> > >Perhaps a cygwin-special (e.g. doesn't go back to binutils CVS) patch? 
> > >In that case, it's a one-liner -- just change the default value of 
> > >link_info.pei386_auto_import to '1' instead of '-1' in pe.em (you might 
> > >also need to change the default in ldmain.c, but I don't think that's 
> > >necessary.)
> > 
> > I'm willing to do this but I have the same reservations that I think
> > you're expressing above, Chuck.  Also, the auto-import of data variables
> > is slower than a normal dllimport so I don't feel real comfortable about
> > making this the default.
> > 
> > I don't feel really strongly about this however, so if the consensus is
> > that this should be turned on, I'll make a cygwin-specific change to
> > binutils.
> 

I share Chris's opinion about the warning.  To me the auto-import
feature has always been a last resort.  Usually, I want to know about
the missing attribute in  declarations.

> No need.  It's just a bit annoying.
> 
> However, isn't that an error in binutils?  If I have
> 
>   extern int __declspec(dllimport) foo;
> 
> and 100 lines later I have a
> 
>   extern int foo;
> 
> 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.

That is done in GCC itself, noy binutils.  It is done that way to conform
to MS 'rules' about how ___declspec(dllimport) is handled.
Overriding the attribute also prevents an ICE in gcc so I believe the
behaviour is justified. There are actually testcases in the gcc
 testsuite that test whether this happens

Here's one (g++.dg/ext/dllimport2.C):

// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }

// PR c++/9738  Dllimport attribute is overriden by later definition/redeclaration

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++;
}

Danny

> 
> Corinna
> 
> 

http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search

--
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2003-09-21  8:04 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-18 19:56 getopt: ugly linker messages Bryan Higgins
2003-09-18 19:57 ` Christopher Faylor
2003-09-19  3:54   ` Charles Wilson
2003-09-19  7:03     ` Corinna Vinschen
2003-09-19 14:22       ` Charles Wilson
2003-09-19 15:20         ` Christopher Faylor
2003-09-19 15:38           ` Corinna Vinschen
2003-09-19 18:03           ` Larry Hall
2003-09-19 18:57           ` Ivan Warren
2003-09-20  1:12             ` Ivan Warren
2003-09-20 19:40               ` Ivan Warren
2003-09-20 20:52                 ` Christopher Faylor
2003-09-20 20:58                   ` Ivan Warren
2003-09-20 23:31                     ` Christopher Faylor
2003-09-21  0:02                       ` Ivan Warren
2003-09-21  0:04                         ` Christopher Faylor
2003-09-21  2:32                           ` Ivan Warren
2003-09-21  8:18                           ` PE Linker and/or runtime error when importing data from DLL (was RE: getopt: ugly linker messages) - hopefully solved Ivan Warren
2003-09-18 20:13 getopt: ugly linker messages Bryan Higgins
2003-09-18 20:18 ` Christopher Faylor
2003-09-18 20:48 Bryan Higgins
2003-09-18 21:46 ` Rolf Campbell
2003-09-19 22:14 Danny Smith
2003-09-20  9:53 ` Corinna Vinschen

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).