This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Only declare sys_errlist and sys_nerr on `linux' targets
- From: Jeff Bailey <jbailey at nisa dot net>
- To: libc-alpha at sources dot redhat dot com
- Cc: roland at frob dot com, Marcus Brinkmann <Marcus dot Brinkmann at ruhr-uni-bochum dot de>
- Date: Wed, 31 Jul 2002 10:12:13 -0700
- Subject: Only declare sys_errlist and sys_nerr on `linux' targets
stdio.h currently declares sys_errlist and sys_nerr regardless of if
the glibc you're using provides it. This causes libiberty to fail to
build on i386-gnu.
Please consider the following patch:
2002-07-31 Jeff Bailey <jbailey@gnu.org>
* libio/stdio.h: Move definition of sys_errlist and sys_nerr to
bits/sys_errlist.h. Include this file.
* sysdeps/generic/bits/sys_errlist.h: New file. This does *not*
declare sys_errlist and sys_nerr.
* sysdeps/unix/sysv/linux/bits/sys_errlist.h: New file. Provides
declarations.
* libio/Makefile: Add bits/sys_errlist.h to header list.
sysdeps/generic/bits/sys_errlist.h:
/* Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _STDIO_H
# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
#endif
/* sys_errlist and sys_nerr are deprecated. User strerror instead. */
sysdeps/unix/sysv/linux/bits/sys_errlist.h:
/* Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _STDIO_H
# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
#endif
/* These variables normally should not be used directly. The `strerror'
* function provides all the needed functionality. */
#ifdef __USE_BSD
extern int sys_nerr;
extern __const char *__const sys_errlist[];
#endif
#ifdef __USE_GNU
extern int _sys_nerr;
extern __const char *__const _sys_errlist[];
#endif
Index: libio/Makefile
===================================================================
RCS file: /cvs/glibc/libc/libio/Makefile,v
retrieving revision 1.57
diff -u -p -r1.57 Makefile
--- libio/Makefile 22 Aug 2001 18:39:25 -0000 1.57
+++ libio/Makefile 31 Jul 2002 17:00:08 -0000
@@ -21,7 +21,8 @@
#
subdir := libio
-headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h
+headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \
+ bits/sys_errlist.h
routines := \
filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
Index: libio/stdio.h
===================================================================
RCS file: /cvs/glibc/libc/libio/stdio.h,v
retrieving revision 1.70
diff -u -p -r1.70 stdio.h
--- libio/stdio.h 6 Jul 2001 04:55:31 -0000 1.70
+++ libio/stdio.h 31 Jul 2002 17:04:34 -0000
@@ -1,5 +1,5 @@
/* Define ISO C stdio on top of C++ iostreams.
- Copyright (C) 1991, 1994-1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994-1999, 2000-02 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -545,17 +545,9 @@ extern int ferror_unlocked (FILE *__stre
/* Print a message describing the meaning of the value of errno. */
extern void perror (__const char *__s) __THROW;
-/* These variables normally should not be used directly. The `strerror'
- function provides all the needed functionality. */
-#ifdef __USE_BSD
-extern int sys_nerr;
-extern __const char *__const sys_errlist[];
-#endif
-#ifdef __USE_GNU
-extern int _sys_nerr;
-extern __const char *__const _sys_errlist[];
-#endif
-
+/* Provide the declarations for sys_errlist and sys_nerr if they're
+ available on this system. */
+#include <bits/sys_errlist.h>
#ifdef __USE_POSIX
/* Return the system file descriptor for STREAM. */