This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libiberty patch] Disable sys_errlist in strerror.c


I'm testing a patch for autoconf which causes all compiler warnings to
become failures instead of successes.  Just like configuring with -Werror,
basically.  This dies in libiberty...

Why?  Because of strerror.  The test for sys_errlist fails.  So when we
build strerror.c we don't move it out of the way, so we lose.  I can work
around this in at least two ways:
  - drop the whole idea, it's a bad one (I'm open to any reasons...)
  - This patch.  The local copy of sys_errlist is not used in this case.

OK?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-10-01  Daniel Jacobowitz  <drow@mvista.com>

	* strerror.c: Don't provide or reference sys_errlist if
	strerror is available.

Index: strerror.c
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/libiberty/strerror.c,v
retrieving revision 1.10
diff -u -p -r1.10 strerror.c
--- strerror.c	16 Oct 2001 02:50:13 -0000	1.10
+++ strerror.c	1 Oct 2003 21:59:01 -0000
@@ -7,6 +7,7 @@
 
 #include "config.h"
 
+#ifndef HAVE_STRERROR
 #ifdef HAVE_SYS_ERRLIST
 /* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
    might declare sys_errlist in a way that the compiler might consider
@@ -16,14 +17,17 @@
 #define sys_nerr sys_nerr__
 #define sys_errlist sys_errlist__
 #endif
+#endif
 
 #include <stdio.h>
 #include <errno.h>
 
+#ifndef HAVE_STRERROR
 #ifdef HAVE_SYS_ERRLIST
 #undef sys_nerr
 #undef sys_errlist
 #endif
+#endif
 
 /*  Routines imported from standard C runtime libraries. */
 
@@ -460,6 +464,7 @@ static int num_error_names = 0;
    same name, it differs from other implementations in that it is dynamically
    initialized rather than statically initialized. */
 
+#ifndef HAVE_STRERROR
 #ifndef HAVE_SYS_ERRLIST
 
 static int sys_nerr;
@@ -471,7 +476,7 @@ extern int sys_nerr;
 extern char *sys_errlist[];
 
 #endif
-
+#endif
 
 /*
 
@@ -537,6 +542,7 @@ init_error_tables ()
 	}
     }
 
+#ifndef HAVE_STRERROR
 #ifndef HAVE_SYS_ERRLIST
 
   /* Now attempt to allocate the sys_errlist table, zero it out, and then
@@ -556,6 +562,7 @@ init_error_tables ()
 	}
     }
 
+#endif
 #endif
 
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]