Commit 6cd5dccd by Kaveh R. Ghazi Committed by Kaveh Ghazi

Consolidate strerror handling, as well as getcwd/getwd.

        * configure.in (GCC_NEED_DECLARATIONS): Add strerror, getcwd and
        getwd.
        * acconfig.m4: Add stubs for NEED_DECLARATION_STRERROR,
        NEED_DECLARATION_GETCWD and NEED_DECLARATION_GETWD.
        * cccp.c: Remove strerror()/sys_nerr/sys_errlist decls.
        (my_strerror): Add prototype and make it static.
        * collect2.c: Likewise.
        * cpplib.c: Likewise.
        * gcc.c: Likewise, but keep `my_strerror' extern.
        * protoize.c: Likewise.
        * pexecute.c (my_strerror): Add argument to prototype.
        * system.h: Add prototypes for getcwd, getwd and strerror.  Add
        extern decls for sys_nerr and sys_errlist.  Make abort decl
        explicitly extern.
        * getpwd.c: Remove decls for getwd and getcwd.

From-SVN: r20779
parent 984e3c38
Sun Jun 28 08:57:09 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.in (GCC_NEED_DECLARATIONS): Add strerror, getcwd and
getwd.
* acconfig.m4: Add stubs for NEED_DECLARATION_STRERROR,
NEED_DECLARATION_GETCWD and NEED_DECLARATION_GETWD.
* cccp.c: Remove strerror()/sys_nerr/sys_errlist decls.
(my_strerror): Add prototype and make it static.
* collect2.c: Likewise.
* cpplib.c: Likewise.
* gcc.c: Likewise, but keep `my_strerror' extern.
* protoize.c: Likewise.
* pexecute.c (my_strerror): Add argument to prototype.
* system.h: Add prototypes for getcwd, getwd and strerror. Add
extern decls for sys_nerr and sys_errlist. Make abort decl
explicitly extern.
* getpwd.c: Remove decls for getwd and getcwd.
Sun Jun 28 02:11:16 PDT 1998 Jeff Law (law@cygnus.com)
* version.c: Bump for snapshot.
......
......@@ -55,4 +55,13 @@
/* Whether abort must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ABORT
/* Whether strerror must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRERROR
/* Whether getcwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETCWD
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
@TOP@
......@@ -138,16 +138,6 @@ static int hack_vms_include_specification ();
extern char *version_string;
extern char *update_path PROTO((char *, char *));
#ifndef VMS
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
#else /* HAVE_STRERROR */
char *strerror ();
#endif
#else /* VMS */
char *strerror (int,...);
#endif
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
HOST_WIDE_INT parse_c_expression PROTO((char *, int));
......@@ -1003,7 +993,7 @@ static int discard_comments PROTO((U_CHAR *, int, int));
static int change_newlines PROTO((U_CHAR *, int));
char *my_strerror PROTO((int));
static char *my_strerror PROTO((int));
void error PRINTF_PROTO_1((char *, ...));
static void verror PROTO((char *, va_list));
static void error_from_errno PROTO((char *));
......@@ -8873,7 +8863,7 @@ change_newlines (start, length)
/* my_strerror - return the descriptive text associated with an
`errno' code. */
char *
static char *
my_strerror (errnum)
int errnum;
{
......
......@@ -39,13 +39,6 @@ Boston, MA 02111-1307, USA. */
#include <process.h>
#endif
#ifndef HAVE_STRERROR
extern char *sys_errlist[];
extern int sys_nerr;
#else
char *strerror();
#endif
/* Obstack allocation and deallocation routines. */
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
......@@ -278,6 +271,7 @@ static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs,
static char *libexts[3] = {"a", "so", NULL}; /* possible library extentions */
#endif
static char *my_strerror PROTO((int));
static void handler PROTO((int));
static int is_ctor_dtor PROTO((char *));
static char *find_a_file PROTO((struct path_prefix *, char *));
......@@ -336,7 +330,7 @@ dup2 (oldfd, newfd)
}
#endif
char *
static char *
my_strerror (e)
int e;
{
......
......@@ -57,6 +57,15 @@
/* Whether abort must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ABORT
/* Whether strerror must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRERROR
/* Whether getcwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETCWD
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
......
......@@ -1945,7 +1945,7 @@ fi
for ac_func in malloc realloc calloc free bcopy bzero bcmp \
index rindex getenv atol sbrk abort atof
index rindex getenv atol sbrk abort atof strerror getcwd getwd
do
echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6
echo "configure:1952: checking whether $ac_func must be declared" >&5
......
......@@ -197,7 +197,7 @@ GCC_FUNC_VFPRINTF_DOPRNT
GCC_FUNC_PRINTF_PTR
GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \
index rindex getenv atol sbrk abort atof)
index rindex getenv atol sbrk abort atof strerror getcwd getwd)
AC_DECL_SYS_SIGLIST
......
......@@ -203,6 +203,7 @@ struct cpp_pending {
char *xmalloc ();
extern void cpp_hash_cleanup PARAMS ((cpp_reader *));
static char *my_strerror PROTO ((int));
static void add_import PROTO ((cpp_reader *, int, char *));
static void append_include_chain PROTO ((cpp_reader *,
struct file_name_list *,
......@@ -7599,21 +7600,10 @@ cpp_pedwarn_with_file_and_line VPROTO ((cpp_reader *pfile, char *file, int line,
va_end(ap);
}
#ifndef VMS
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
#else /* HAVE_STRERROR */
char *strerror ();
#endif
#else /* VMS */
char *strerror (int,...);
#endif
/* my_strerror - return the descriptive text associated with an
`errno' code. */
char *
static char *
my_strerror (errnum)
int errnum;
{
......
......@@ -122,13 +122,7 @@ static char dir_separator_str[] = {DIR_SEPARATOR, 0};
#endif
extern char *choose_temp_base PROTO((void));
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
#else
extern char *strerror();
#endif
extern char *my_strerror PROTO((int));
#ifndef HAVE_KILL
#define kill(p,s) raise(s)
......
......@@ -9,7 +9,6 @@
the few exceptions to the general rule here. */
#if !(defined (POSIX) || defined (USG) || defined (VMS)) || defined (HAVE_GETWD)
extern char *getwd ();
#define getcwd(buf,len) getwd(buf)
#ifdef MAXPATHLEN
#define GUESSPATHLEN (MAXPATHLEN + 1)
......@@ -17,7 +16,6 @@ extern char *getwd ();
#define GUESSPATHLEN 100
#endif
#else /* (defined (USG) || defined (VMS)) */
extern char *getcwd ();
/* We actually use this as a starting point, not a limit. */
#define GUESSPATHLEN 100
#endif /* (defined (USG) || defined (VMS)) */
......
......@@ -637,7 +637,7 @@ pfinish ()
extern int execv ();
extern int execvp ();
#ifdef IN_GCC
extern char * my_strerror();
extern char * my_strerror PROTO ((int));
#endif
int
......
......@@ -93,13 +93,6 @@ Boston, MA 02111-1307, USA. */
#include "getopt.h"
#undef getopt
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
#else
extern char *strerror();
#endif
extern char *version_string;
/* Systems which are compatible only with POSIX 1003.1-1988 (but *not*
......@@ -123,6 +116,7 @@ extern char *version_string;
extern char *getpwd ();
extern char *choose_temp_base PROTO ((void));
extern char * my_strerror PROTO ((int));
extern int pexecute PROTO ((const char *, char * const *, const char *,
const char *, char **, char **, int));
......
......@@ -202,14 +202,33 @@ extern long atol();
extern void free ();
#endif
#ifdef NEED_DECLARATION_GETCWD
extern char *getcwd ();
#endif
#ifdef NEED_DECLARATION_GETENV
extern char *getenv ();
#endif
#ifdef NEED_DECLARATION_GETWD
extern char *getwd ();
#endif
#ifdef NEED_DECLARATION_SBRK
extern char *sbrk ();
#endif
#ifdef HAVE_STRERROR
# ifdef NEED_DECLARATION_STRERROR
# ifndef strerror
extern char *strerror ();
# endif
# endif
#else /* ! HAVE_STRERROR */
extern int sys_nerr;
extern char *sys_errlist[];
#endif /* HAVE_STRERROR */
/* HAVE_VOLATILE only refers to the stage1 compiler. We also check
__STDC__ and assume gcc sets it and has volatile in stage >=2. */
#if !defined(HAVE_VOLATILE) && !defined(__STDC__) && !defined(volatile)
......@@ -229,7 +248,7 @@ extern char *sbrk ();
#ifdef USE_SYSTEM_ABORT
# ifdef NEED_DECLARATION_ABORT
void abort ();
extern void abort ();
# endif
#else
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment