X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fgetopt.c;h=7119b621c12a695852c1c7586b153cc961d665ca;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=d09ce5a66b9a6ce30b70ab049be68e83cfb93f7f;hpb=979c05d32447bf9388479ed6ef8e5665b40e5763;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/getopt.c b/libiberty/getopt.c index d09ce5a66b..7119b621c1 100644 --- a/libiberty/getopt.c +++ b/libiberty/getopt.c @@ -3,8 +3,7 @@ "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 - Free Software Foundation, Inc. + Copyright (C) 1987-2020 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). @@ -42,6 +41,7 @@ # endif #endif +#include "ansidecl.h" #include /* Comment out all this code if we are using the GNU C Library, and are not @@ -212,8 +212,16 @@ static char *posixly_correct; /* Avoid depending on library functions or files whose names are inconsistent. */ -#ifndef getenv -extern char *getenv (); +#if HAVE_STDLIB_H && HAVE_DECL_GETENV +# include +#elif !defined(getenv) +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +extern char *getenv (const char *); +# ifdef __cplusplus +} +# endif /* __cplusplus */ #endif static char * @@ -325,7 +333,7 @@ exchange (char **argv) { /* We must extend the array. The user plays games with us and presents new arguments. */ - char *new_str = malloc (top + 1); + char *new_str = (char *) malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else @@ -389,7 +397,9 @@ exchange (char **argv) static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * -_getopt_initialize (int argc, char *const *argv, const char *optstring) +_getopt_initialize (int argc ATTRIBUTE_UNUSED, + char *const *argv ATTRIBUTE_UNUSED, + const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped