[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strstr redefinition fix
From: |
Derek Price |
Subject: |
strstr redefinition fix |
Date: |
Thu, 15 Sep 2005 11:11:44 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
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:
2005-09-15 Derek Price <address@hidden>
* lib/strstr.h: #include string.h before possibly redefining strstr.
* m4/strstr.m4 (gl_FUNC_STRSTR): Don't define strstr here.
Regards,
Derek
--
Derek R. Price
CVS Solutions Architect
Ximbiot <http://ximbiot.com>
v: +1 717.579.6168
f: +1 717.234.3125
<mailto:address@hidden>
? strstr.h-include-string.h.diff
Index: lib/strstr.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/strstr.h,v
retrieving revision 1.3
diff -u -p -r1.3 strstr.h
--- lib/strstr.h 4 Sep 2005 05:58:56 -0000 1.3
+++ lib/strstr.h 15 Sep 2005 15:10:21 -0000
@@ -19,6 +19,12 @@
extern "C" {
#endif
+/* <string.h> may #define strstr. */
+#include <string.h>
+
+#undef strstr
+#define strstr rpl_strstr
+
/* Find the first occurrence of NEEDLE in HAYSTACK. */
extern char *strstr (const char *haystack, const char *needle);
Index: m4/strstr.m4
===================================================================
RCS file: /cvsroot/cvs/ccvs/m4/strstr.m4,v
retrieving revision 1.2
diff -u -p -r1.2 strstr.m4
--- m4/strstr.m4 4 Sep 2005 05:58:36 -0000 1.2
+++ m4/strstr.m4 15 Sep 2005 15:10:21 -0000
@@ -9,7 +9,6 @@ AC_DEFUN([gl_FUNC_STRSTR],
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
])
- strstr redefinition fix,
Derek Price <=