summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1998-06-28 06:09:57 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1998-06-28 06:09:57 +0000
commitccb1060c39fb90efde197a2d322c82da20dda886 (patch)
tree6f091a195512741bb4eb68f404e752087fb5691e
parent0e74463ec5d54a90d2f45693c436db6a49dadca5 (diff)
downloadgcc-ccb1060c39fb90efde197a2d322c82da20dda886.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20779 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog27
-rw-r--r--gcc/acconfig.h9
-rw-r--r--gcc/cccp.c14
-rw-r--r--gcc/collect2.c10
-rw-r--r--gcc/config.in9
-rwxr-xr-xgcc/configure2
-rw-r--r--gcc/configure.in2
-rw-r--r--gcc/cpplib.c14
-rw-r--r--gcc/gcc.c8
-rw-r--r--gcc/getpwd.c2
-rw-r--r--gcc/pexecute.c2
-rw-r--r--gcc/protoize.c8
-rw-r--r--gcc/system.h21
13 files changed, 76 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a4cc390f1e0..3bc9e92beeb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,30 @@
+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.
diff --git a/gcc/acconfig.h b/gcc/acconfig.h
index 904b7e44750..f2dd5820989 100644
--- a/gcc/acconfig.h
+++ b/gcc/acconfig.h
@@ -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@
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 59799de313d..d717009a35d 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -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;
{
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 6c4933debe3..a766bd25834 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -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;
{
diff --git a/gcc/config.in b/gcc/config.in
index f468dc87e73..e4e4f2eb1de 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -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
diff --git a/gcc/configure b/gcc/configure
index b82179b54b7..dfa8e266083 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -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
diff --git a/gcc/configure.in b/gcc/configure.in
index 6c704bb659f..bdfe74a62b0 100644
--- a/gcc/configure.in
+++ b/gcc/configure.in
@@ -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
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 15cbf58ab79..5f699c8ee07 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -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;
{
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 5a752a37476..cc4af8e897a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -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)
diff --git a/gcc/getpwd.c b/gcc/getpwd.c
index 6830c164acf..947383ef9a4 100644
--- a/gcc/getpwd.c
+++ b/gcc/getpwd.c
@@ -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)) */
diff --git a/gcc/pexecute.c b/gcc/pexecute.c
index 29148159202..804f3147f7d 100644
--- a/gcc/pexecute.c
+++ b/gcc/pexecute.c
@@ -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
diff --git a/gcc/protoize.c b/gcc/protoize.c
index e5048c06709..a85b21b3a8a 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -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));
diff --git a/gcc/system.h b/gcc/system.h
index 402fa9f6d8e..79e1e279ae2 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -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)