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]

Re: [libiberty patch] Disable sys_errlist in strerror.c


On Thu, Oct 02, 2003 at 12:15:25AM -0400, Daniel Jacobowitz wrote:
> On Wed, Oct 01, 2003 at 08:16:21PM -0400, John David Anglin wrote:
> > 2003-10-01  Daniel Jacobowitz  <drow@mvista.com>
> > 
> > 	* strerror.c: Don't provide or reference sys_errlist if
> > 	strerror is available.
> > 
> > Causes:
> > 
> > gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../gcc/libiberty/../include  -W -Wall -Wt
> > raditional -pedantic ../../gcc/libiberty/splay-tree.c -o splay-tree.o
> > if [ x"-fPIC" != x ]; then \
> >   gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../gcc/libiberty/../include  -W -Wall -Wtraditional -pedantic -fPIC ../../gcc/libiberty/strerror.c -o pic/strerror.o; \
> > else true; fi
> > ../../gcc/libiberty/strerror.c: In function `errno_max':
> > ../../gcc/libiberty/strerror.c:601: error: `sys_nerr' undeclared (first use in this function)
> > ../../gcc/libiberty/strerror.c:601: error: (Each undeclared identifier is reported only once
> > ../../gcc/libiberty/strerror.c:601: error: for each function it appears in.)
> 
> Argh!  I'm sorry; I checked sys_errlist thoroughly and not sys_nerr. 
> Thanks for reporting this.
> 
> I'm not sure what to do, let me think about it.  You have strerror but
> not sys_errlist on this system, right?

Is this patch an improvement?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

	* strerror.c: Revert last change.  Declare static sys_nerr
	and sys_errlist using different names.

Index: strerror.c
===================================================================
RCS file: /cvs/src/src/libiberty/strerror.c,v
retrieving revision 1.9
diff -u -p -r1.9 strerror.c
--- strerror.c	1 Oct 2003 23:11:45 -0000	1.9
+++ strerror.c	2 Oct 2003 04:20:16 -0000
@@ -7,7 +7,6 @@
 
 #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
@@ -17,17 +16,14 @@
 #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. */
 
@@ -464,9 +460,10 @@ 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
 
+#define sys_nerr sys_nerr__
+#define sys_errlist sys_errlist__
 static int sys_nerr;
 static const char **sys_errlist;
 
@@ -476,7 +473,6 @@ extern int sys_nerr;
 extern char *sys_errlist[];
 
 #endif
-#endif
 
 /*
 
@@ -542,7 +538,6 @@ init_error_tables ()
 	}
     }
 
-#ifndef HAVE_STRERROR
 #ifndef HAVE_SYS_ERRLIST
 
   /* Now attempt to allocate the sys_errlist table, zero it out, and then
@@ -562,7 +557,6 @@ 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]