bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glibc 2.2 / fileutils 4.0.33 memrchr.c portability problem (Solaris 7)


From: Paul Eggert
Subject: glibc 2.2 / fileutils 4.0.33 memrchr.c portability problem (Solaris 7)
Date: Fri, 1 Dec 2000 18:36:18 -0800 (PST)

I ran into the following portability bug with glibc 2.2 memrchr.c
while compiling GNU fileutils test version 4.0.33, which has a
copy of glibc memrchr.c:

   gcc -DLIBDIR=\"/tmp/prefix/lib\" -DHAVE_CONFIG_H -I.. -I../../lib -I../intl  
  -g -O -Wall -c -o memrchr.o `test -f ../../lib/memrchr.c || echo 
'../../lib/'`../../lib/memrchr.c
   In file included from ../../lib/memrchr.c:27:
   ../config.h:1002: warning: `_FILE_OFFSET_BITS' redefined
   /usr/include/sys/feature_tests.h:96: warning: this is the location of the 
previous definition

The problem is that memrchr.c includes <config.h> after including
<stdlib.h>.  Fileutils config.h defines _FILE_OFFSET_BITS for
large-file mode, but symbols like these must be defined before any
system include file is included.

Here is a patch, relative to the memrchr.c included in fileutils:

2000-12-01  Paul Eggert  <address@hidden>

        * lib/memrchr.c: Include <config.h> before any system include file.

===================================================================
RCS file: memrchr.c,v
retrieving revision 4.0.33.0
retrieving revision 4.0.33.1
diff -pu -r4.0.33.0 -r4.0.33.1
--- memrchr.c   2000/10/21 10:27:57     4.0.33.0
+++ memrchr.c   2000/12/02 02:29:57     4.0.33.1
@@ -21,12 +21,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <stdlib.h>
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #undef __ptr_t
 #if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
 # define __ptr_t void *



reply via email to

[Prev in Thread] Current Thread [Next in Thread]