public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* getopt.h getopt() decl broken for many targets
@ 2005-03-25 17:12 Aaron W. LaFramboise
  2005-03-26 17:27 ` Ian Lance Taylor
  2005-03-29 16:42 ` Nick Clifton
  0 siblings, 2 replies; 5+ messages in thread
From: Aaron W. LaFramboise @ 2005-03-25 17:12 UTC (permalink / raw)
  To: binutils, gcc; +Cc: Danny Smith

Targets, such as Windows, that don't have getopt() will probably have
get the following error when compiling binutils.

gcc -DHAVE_CONFIG_H -I.
-I/aaronwl/cs/compilers/binutils/src/cvs/src/binutils -I. -D_GNU_SOURCE
-I. -I/aaronwl/cs/compilers/binutils/src/cvs/src/binutils -I../bfd
-I/aaronwl/cs/compilers/binutils/src/cvs/src/binutils/../bfd
-I/aaronwl/cs/compilers/binutils/src/cvs/src/binutils/../include
-D__USE_MINGW_FSEEK
-I/aaronwl/cs/compilers/binutils/src/cvs/src/binutils/../intl -I../intl
-DLOCALEDIR="\"/aaronwl/cs/env/mingw-head/20040323/share/locale\""
-Dbin_dummy_emulation=bin_vanilla_emulation   -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c
/aaronwl/cs/compilers/binutils/src/cvs/src/binutils/strings.c
In file included from
/aaronwl/cs/compilers/binutils/src/cvs/src/binutils/strings.c:65:
/aaronwl/cs/compilers/binutils/src/cvs/src/binutils/../include/getopt.h:116:
warning: function declaration isn't a prototype
make[4]: *** [strings.o] Error 1

This is due to this code:

#if !HAVE_DECL_GETOPT
#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
/* Many other libraries have conflicting prototypes for getopt, with
   differences in the consts, in unistd.h.  To avoid compilation
   errors, only prototype getopt for the GNU C library.  */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else
#ifndef __cplusplus
extern int getopt ();
#endif /* __cplusplus */
#endif
#endif /* !HAVE_DECL_GETOPT */

Is the situation described in this comment still true?  Would it be
possible to turn this whitelist into a blacklist?

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

* Re: getopt.h getopt() decl broken for many targets
  2005-03-25 17:12 getopt.h getopt() decl broken for many targets Aaron W. LaFramboise
@ 2005-03-26 17:27 ` Ian Lance Taylor
  2005-03-29 16:42 ` Nick Clifton
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2005-03-26 17:27 UTC (permalink / raw)
  To: Aaron W. LaFramboise; +Cc: binutils, gcc, Danny Smith

"Aaron W. LaFramboise" <aaron98wiridge9@aaronwl.com> writes:

> This is due to this code:
> 
> #if !HAVE_DECL_GETOPT
> #if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
> /* Many other libraries have conflicting prototypes for getopt, with
>    differences in the consts, in unistd.h.  To avoid compilation
>    errors, only prototype getopt for the GNU C library.  */
> extern int getopt (int argc, char *const *argv, const char *shortopts);
> #else
> #ifndef __cplusplus
> extern int getopt ();
> #endif /* __cplusplus */
> #endif
> #endif /* !HAVE_DECL_GETOPT */
> 
> Is the situation described in this comment still true?  Would it be
> possible to turn this whitelist into a blacklist?

Yes, the comment is still true enough that I don't think we should
change it.  Instead, copy the gcc configure code which sets
HAVE_DECL_GETOPT to the binutils.  In fact, I think Nick already did
this, although I don't know whether he checked it in yet.

Ian

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

* Re: getopt.h getopt() decl broken for many targets
  2005-03-25 17:12 getopt.h getopt() decl broken for many targets Aaron W. LaFramboise
  2005-03-26 17:27 ` Ian Lance Taylor
@ 2005-03-29 16:42 ` Nick Clifton
  2005-03-29 17:45   ` Ian Lance Taylor
  1 sibling, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2005-03-29 16:42 UTC (permalink / raw)
  To: Aaron W. LaFramboise; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]

Hi Aaron,

> Targets, such as Windows, that don't have getopt() will probably have
> get the following error when compiling binutils.

> /aaronwl/cs/compilers/binutils/src/cvs/src/binutils/../include/getopt.h:116:
> warning: function declaration isn't a prototype

> Is the situation described in this comment still true?  Would it be
> possible to turn this whitelist into a blacklist?

If your build-time environment does provide a prototype for getopt() 
which is compatible with the one in include/getopt.h then you may find 
that the attached two patches help.  The first one fixes the configure 
system in the binutils/ subdirectory so that it checks for a working 
getopt() prototype.  (You will need to regenerate the configure files 
after applying the patch).  The second patch fixes the sources for 
addr2line.c so that the config.h file is included before bfd.h so that 
it can pick up the definition of HAVE_DECL_GETOPT which should now be in 
config.h.

Note - this issue is being discussed on a thread on the 
bug-binutils@gnu.org mailing list started by Vladimir Merzliakov. 
Unfortunately it appears that this list is not being archived at the 
moment so I cannot give you a URL to follow.

Cheers
   Nick



[-- Attachment #2: addr2line.c.patch --]
[-- Type: text/plain, Size: 534 bytes --]

Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 addr2line.c
*** binutils/addr2line.c	15 Jun 2004 01:19:13 -0000	1.21
--- binutils/addr2line.c	29 Mar 2005 15:33:56 -0000
***************
*** 29,34 ****
--- 29,35 ----
     both forms write results to stdout, the second form reads addresses
     to be converted from stdin.  */
  
+ #include "config.h"
  #include <string.h>
  
  #include "bfd.h"

[-- Attachment #3: binutils.config.patch.supplimental.bz2 --]
[-- Type: application/x-bzip2, Size: 2396 bytes --]

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

* Re: getopt.h getopt() decl broken for many targets
  2005-03-29 16:42 ` Nick Clifton
@ 2005-03-29 17:45   ` Ian Lance Taylor
  2005-03-29 19:17     ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2005-03-29 17:45 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Aaron W. LaFramboise, binutils

Nick Clifton <nickc@redhat.com> writes:

> Note - this issue is being discussed on a thread on the
> bug-binutils@gnu.org mailing list started by Vladimir
> Merzliakov. Unfortunately it appears that this list is not being
> archived at the moment so I cannot give you a URL to follow.

bug-binutils is archived here:
    http://lists.gnu.org/archive/html/bug-binutils/

Ian

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

* Re: getopt.h getopt() decl broken for many targets
  2005-03-29 17:45   ` Ian Lance Taylor
@ 2005-03-29 19:17     ` Nick Clifton
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2005-03-29 19:17 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Aaron W. LaFramboise, binutils

Hi Guys,

 > Ian Lance Taylor wrote:
> bug-binutils is archived here:
>     http://lists.gnu.org/archive/html/bug-binutils/

Thanks Ian!

In which case the thread that is talking about the getopt() prototype in 
getopt.h starts here:

   http://lists.gnu.org/archive/html/bug-binutils/2005-03/msg00054.html

Cheers
   Nick

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

end of thread, other threads:[~2005-03-29 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-25 17:12 getopt.h getopt() decl broken for many targets Aaron W. LaFramboise
2005-03-26 17:27 ` Ian Lance Taylor
2005-03-29 16:42 ` Nick Clifton
2005-03-29 17:45   ` Ian Lance Taylor
2005-03-29 19:17     ` Nick Clifton

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