Consolidate strerror handling, as well as getcwd/getwd.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sun, 28 Jun 1998 06:09:57 +0000 (06:09 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sun, 28 Jun 1998 06:09:57 +0000 (06:09 +0000)
        * 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

13 files changed:
gcc/ChangeLog
gcc/acconfig.h
gcc/cccp.c
gcc/collect2.c
gcc/config.in
gcc/configure
gcc/configure.in
gcc/cpplib.c
gcc/gcc.c
gcc/getpwd.c
gcc/pexecute.c
gcc/protoize.c
gcc/system.h

index a4cc390f1e0af26e6ef65166c7f361e325c4c89a..3bc9e92beeb40cbd97323faaba345d9b658105df 100644 (file)
@@ -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.
index 904b7e44750f9d7dc138f82f5224bfbe4e09b597..f2dd58209899a3bc54c5c6e90e687eb2a4d70203 100644 (file)
 
 /* 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@
index 59799de313da8081c091ef6ec9159b8a825b60a4..d717009a35de6ca889eeab3f31975d35f7e72728 100644 (file)
@@ -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));
 \f
@@ -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;
 {
index 6c4933debe3bb49263f1582ba783b520fdb8ad1a..a766bd2583441608da3f8ce791d6cff0bfc5eb79 100644 (file)
@@ -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;
 {
index f468dc87e733b54b8e95e5e829be581bc0049f48..e4e4f2eb1dea9740cf671b287530071935ad6404 100644 (file)
 /* 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
 
index b82179b54b736540f998df4c95b2e4826b233ba0..dfa8e26608331b671d56f9adb47ddd0f3d17d0db 100755 (executable)
@@ -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
index 6c704bb659f4d39792c4b00d0659b698d751e111..bdfe74a62b01575609b51d35875ec4785d9b33ee 100644 (file)
@@ -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
 
index 15cbf58ab79be528e8ee950753605765830fb0d4..5f699c8ee07d00504ddcce1654e1303640cd9d15 100644 (file)
@@ -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;
 {
index 5a752a374762d6fcd9075fcc37a389107b35ff7c..cc4af8e897a1fa25de6225614087ee291e52ded9 100644 (file)
--- 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)
index 6830c164acf12aa50841ade400092dc7eca0a125..947383ef9a4457e203081ca700ef9dd97e4bdee3 100644 (file)
@@ -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)) */
index 29148159202a930f86ac7d7e585c2e6f7cee3d0b..804f3147f7d8bb6b07988b12dad4f1de7f9bf026 100644 (file)
@@ -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
index e5048c06709ab526ea67a1b9484b191e54430c76..a85b21b3a8a870388c012d817c92aef1c3df14a6 100644 (file)
@@ -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));
index 402fa9f6d8e1e7e149003cbaf0820a55e5aa086e..79e1e279ae2a65a0f214b8cdbe83da085f7c5138 100644 (file)
@@ -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)