Derek Price wrote:
> The new strstr module is causing a redefinition warnings from many files
> and then strstr.c fails to compile thus on an Alpha Linux 2.2.20 system
> running gcc 2.95.4:
>
> gcc -DHAVE_CONFIG_H -I. -I/home/users/d/de/derekrprice/cvs-nightly/lib -I..
>   -Ino/include  -g -O2 -c
> /home/users/d/de/derekrprice/cvs-nightly/lib/strstr.c In file included from
> /usr/include/string.h:360,
>                  from
> /home/users/d/de/derekrprice/cvs-nightly/lib/mbchar.h:149, from
> /home/users/d/de/derekrprice/cvs-nightly/lib/mbuiter.h:101, from
> /home/users/d/de/derekrprice/cvs-nightly/lib/strstr.c:29:
> /usr/include/bits/string2.h:1068: warning: `strstr' redefined
> ../config.h:1235: warning: this is the location of the previous definition
> /home/users/d/de/derekrprice/cvs-nightly/lib/strstr.c:34: parse error
> before `__extension__'
> /home/users/d/de/derekrprice/cvs-nightly/lib/strstr.c:46: parse error
> before `.'
>
>
> ...and so on.  It looks like a pretty straightforward case of the strstr
> definintion in string.h overwriting the one required by the strstr
> module.  The attached untested patch should fix this:

Thanks. I applied the appended patch, very similar to yours. (But move
the #include outside the   extern "C" { ... }.)

Bruno


Index: m4/strstr.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/strstr.m4,v
retrieving revision 1.4
diff -c -3 -r1.4 strstr.m4
*** m4/strstr.m4        17 Aug 2005 14:05:33 -0000      1.4
--- m4/strstr.m4        15 Sep 2005 16:25:13 -0000
***************
*** 1,4 ****
! # strstr.m4 serial 3
  dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strstr.m4 serial 4
  dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,15 ****
    dnl No known system has a strstr() function that works correctly in
    dnl multibyte locales. Therefore we use our version always.
    AC_LIBOBJ(strstr)
-   AC_DEFINE(strstr, rpl_strstr, [Define to rpl_strstr always.])
    gl_PREREQ_STRSTR
  ])
  
--- 9,14 ----
Index: lib/strstr.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strstr.h,v
retrieving revision 1.5
diff -c -3 -r1.5 strstr.h
*** lib/strstr.h        17 Aug 2005 14:05:33 -0000      1.5
--- lib/strstr.h        15 Sep 2005 16:25:13 -0000
***************
*** 15,23 ****
--- 15,33 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
+ 
+ /* Include string.h: on glibc systems, it contains a macro definition of
+    strstr() that would collide with our definition if included afterwards.  */
+ #include <string.h>
+ 
  #ifdef __cplusplus
  extern "C" {
  #endif
+ 
+ /* No known system has a strstr() function that works correctly in
+    multibyte locales. Therefore we use our version always.  */
+ #undef strstr
+ #define strstr rpl_strstr
  
  /* Find the first occurrence of NEEDLE in HAYSTACK.  */
  extern char *strstr (const char *haystack, const char *needle);



_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to