public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/2767: Problems with the new bits/std_cstring.h header
@ 2001-06-09 23:51 bkoz
0 siblings, 0 replies; 2+ messages in thread
From: bkoz @ 2001-06-09 23:51 UTC (permalink / raw)
To: bkoz, gcc-bugs, gcc-prs, schmid
Synopsis: Problems with the new bits/std_cstring.h header
State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Sat Jun 9 23:51:25 2001
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2767&database=gcc
^ permalink raw reply [flat|nested] 2+ messages in thread
* libstdc++/2767: Problems with the new bits/std_cstring.h header
@ 2001-05-07 12:36 Peter Schmid
0 siblings, 0 replies; 2+ messages in thread
From: Peter Schmid @ 2001-05-07 12:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 2767
>Category: libstdc++
>Synopsis: Problems with the new bits/std_cstring.h header
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 07 12:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Peter Schmid
>Release: 3.1 20010428 (experimental)
>Organization:
TU Darmstadt
>Environment:
System: Linux kiste 2.4.3 #35 Sat Mar 31 22:08:25 CEST 2001 i686 unknown
Architecture: i686
SuSE 7.1
Glibc 2.2
GNU ld version 2.11.90.0.4 (with BFD 2.11.90.0.4)
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77,objc
>Description:
After the lines
extern "C" const char* strchr(const char*, int);
inline char*
strchr(char* __s1, int __n)
{
return const_cast<char*>(strchr(const_cast<const char*>(__s1), __n));
}
have been added to bits/std_cstring.h, the following source code td.C does
no longer compile. The same holds true, mutatis mutandis, for strstr, strrchr,
strpbrk, and memchr. If I explicitly qualify strchr with the prefix
std:: or :: the code does compile. Though this behaviour may be legal,
it breaks a lot of code. Therefore, I kindly ask you to the fix the problem.
I destilled the code td.C from a large, ~1 Mbyte,
compilation unit from root which does compile with gcc 3.0.
>How-To-Repeat:
Source file td.C
#include<cstring> //or #include<iostream> or #include <bits/std_cstring.h>
using namespace std;
void f(const char *name)
{
strchr(name,'/');
}
Compiling td.C
g++ -v -c td.C -W -Wall -save-temps
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77,objc
Thread model: posix
gcc version 3.1 20010428 (experimental)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/cpp0 -lang-c++ -D_GNU_SOURCE -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__STDC_HOSTED__=1 -W -Wall -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ td.C td.ii
GNU CPP version 3.1 20010428 (experimental) (cpplib) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++-v3
/usr/local/include/g++-v3/i686-pc-linux-gnu
/usr/local/include/g++-v3/backward
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include
/usr/local/i686-pc-linux-gnu/include
/usr/include
End of search list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1plus -fpreprocessed td.ii -quiet -dumpbase td.C -W -Wall -version -o td.s
GNU CPP version 3.1 20010428 (experimental) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20010428 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.1 20010428 (experimental).
td.C: In function `void f(const char*)':
td.C:6: call of overloaded `strchr(const char*&, char)' is ambiguous
/usr/include/string.h:155: candidates are: char* strchr(const char*, int)
/usr/local/include/g++-v3/bits/std_cstring.h:91: char*
std::strchr(char*, int) <near match>
/usr/local/include/g++-v3/bits/std_cstring.h:88: const char*
std::strchr(const char*, int)
Preprocessed source file td.ii
# 1 "td.C"
# 1 "/usr/local/include/g++-v3/cstring" 1 3
# 1 "/usr/local/include/g++-v3/bits/std_cstring.h" 1 3
# 39 "/usr/local/include/g++-v3/bits/std_cstring.h" 3
# 1 "/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/c++config.h" 1 3
# 34 "/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/c++config.h" 3
# 1 "/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/os_defines.h" 1 3
# 37 "/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/os_defines.h" 3
# 1 "/usr/include/features.h" 1 3
# 283 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 284 "/usr/include/features.h" 2 3
# 311 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 312 "/usr/include/features.h" 2 3
# 38 "/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/os_defines.h" 2 3
# 35 "/usr/local/include/g++-v3/i686-pc-linux-gnu/bits/c++config.h" 2 3
# 40 "/usr/local/include/g++-v3/bits/std_cstring.h" 2 3
# 1 "/usr/local/include/g++-v3/bits/std_cstddef.h" 1 3
# 40 "/usr/local/include/g++-v3/bits/std_cstddef.h" 3
# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/stddef.h" 1 3
# 147 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/stddef.h" 3
typedef int ptrdiff_t;
# 199 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/stddef.h" 3
typedef unsigned int size_t;
# 41 "/usr/local/include/g++-v3/bits/std_cstddef.h" 2 3
namespace std
{
using ::ptrdiff_t;
using ::size_t;
}
# 41 "/usr/local/include/g++-v3/bits/std_cstring.h" 2 3
# 43 "/usr/local/include/g++-v3/bits/std_cstring.h" 3
# 1 "/usr/include/string.h" 1 3
# 26 "/usr/include/string.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/string.h" 2 3
extern "C" {
# 1 "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/stddef.h" 1 3
# 34 "/usr/include/string.h" 2 3
extern void *memcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) throw ();
extern void *memmove (void *__dest, __const void *__src, size_t __n)
throw ();
extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
int __c, size_t __n)
throw ();
extern void *memset (void *__s, int __c, size_t __n) throw ();
extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
throw () __attribute__ ((__pure__));
extern void *memchr (__const void *__s, int __c, size_t __n)
throw () __attribute__ ((__pure__));
extern void *rawmemchr (__const void *__s, int __c) throw () __attribute__ ((__pure__));
extern void *memrchr (__const void *__s, int __c, size_t __n)
throw () __attribute__ ((__pure__));
extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
throw ();
extern char *strncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw ();
extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
throw ();
extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
size_t __n) throw ();
extern int strcmp (__const char *__s1, __const char *__s2)
throw () __attribute__ ((__pure__));
extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
throw () __attribute__ ((__pure__));
extern int strcoll (__const char *__s1, __const char *__s2)
throw () __attribute__ ((__pure__));
extern size_t strxfrm (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw ();
# 1 "/usr/include/xlocale.h" 1 3
# 28 "/usr/include/xlocale.h" 3
typedef struct __locale_struct
{
struct locale_data *__locales[13];
const unsigned short int *__ctype_b;
const int *__ctype_tolower;
const int *__ctype_toupper;
} *__locale_t;
# 109 "/usr/include/string.h" 2 3
extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
throw () __attribute__ ((__pure__));
extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n,
__locale_t __l) throw ();
extern char *strdup (__const char *__s) throw () __attribute__ ((__malloc__));
extern char *strndup (__const char *__string, size_t __n)
throw () __attribute__ ((__malloc__));
# 155 "/usr/include/string.h" 3
extern char *strchr (__const char *__s, int __c) throw () __attribute__ ((__pure__));
extern char *strrchr (__const char *__s, int __c) throw () __attribute__ ((__pure__));
extern char *strchrnul (__const char *__s, int __c) throw () __attribute__ ((__pure__));
extern size_t strcspn (__const char *__s, __const char *__reject)
throw () __attribute__ ((__pure__));
extern size_t strspn (__const char *__s, __const char *__accept)
throw () __attribute__ ((__pure__));
extern char *strpbrk (__const char *__s, __const char *__accept)
throw () __attribute__ ((__pure__));
extern char *strstr (__const char *__haystack, __const char *__needle)
throw () __attribute__ ((__pure__));
extern char *strcasestr (__const char *__haystack, __const char *__needle)
throw () __attribute__ ((__pure__));
extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
throw ();
extern char *__strtok_r (char *__restrict __s,
__const char *__restrict __delim,
char **__restrict __save_ptr) throw ();
extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
char **__restrict __save_ptr) throw ();
extern void *memmem (__const void *__haystack, size_t __haystacklen,
__const void *__needle, size_t __needlelen)
throw () __attribute__ ((__pure__));
extern void *__mempcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) throw ();
extern void *mempcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) throw ();
extern size_t strlen (__const char *__s) throw () __attribute__ ((__pure__));
extern size_t strnlen (__const char *__string, size_t __maxlen)
throw () __attribute__ ((__pure__));
extern char *strerror (int __errnum) throw ();
extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen) throw ();
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) throw ();
extern void __bzero (void *__s, size_t __n) throw ();
extern void bcopy (__const void *__src, void *__dest, size_t __n) throw ();
extern void bzero (void *__s, size_t __n) throw ();
extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
throw () __attribute__ ((__pure__));
extern char *index (__const char *__s, int __c) throw () __attribute__ ((__pure__));
extern char *rindex (__const char *__s, int __c) throw () __attribute__ ((__pure__));
extern int __ffs (int __i) throw () __attribute__ ((const));
extern int ffs (int __i) throw () __attribute__ ((const));
extern int ffsl (long int __l) throw () __attribute__ ((const));
__extension__ extern int ffsll (long long int __ll)
throw () __attribute__ ((const));
extern int strcasecmp (__const char *__s1, __const char *__s2)
throw () __attribute__ ((__pure__));
extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
throw () __attribute__ ((__pure__));
extern int __strcasecmp_l (__const char *__s1, __const char *__s2,
__locale_t __loc) throw () __attribute__ ((__pure__));
extern int __strncasecmp_l (__const char *__s1, __const char *__s2,
size_t __n, __locale_t __loc)
throw () __attribute__ ((__pure__));
extern char *strsep (char **__restrict __stringp,
__const char *__restrict __delim) throw ();
extern int strverscmp (__const char *__s1, __const char *__s2)
throw () __attribute__ ((__pure__));
extern char *strsignal (int __sig) throw ();
extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
throw ();
extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
throw ();
extern char *__stpncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw ();
extern char *stpncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) throw ();
extern char *strfry (char *__string) throw ();
extern void *memfrob (void *__s, size_t __n) throw ();
extern char *basename (__const char *__filename) throw ();
# 365 "/usr/include/string.h" 3
}
# 44 "/usr/local/include/g++-v3/bits/std_cstring.h" 2 3
# 69 "/usr/local/include/g++-v3/bits/std_cstring.h" 3
namespace std
{
extern "C" void* memcpy(void*, const void*, size_t);
extern "C" void* memmove(void*, const void*, size_t);
extern "C" char* strcpy(char*, const char*);
extern "C" char* strncpy(char*, const char*, size_t);
extern "C" char* strcat(char*, const char*);
extern "C" char* strncat(char*, const char*, size_t);
extern "C" int memcmp(const void*, const void*, size_t);
extern "C" int strcmp(const char*, const char*);
extern "C" int strcoll(const char*, const char*);
extern "C" int strncmp(const char*, const char*, size_t);
extern "C" size_t strxfrm(char*, const char*, size_t);
extern "C" const void* memchr(const void*, int, size_t);
inline void*
memchr(void* __p, int __c, size_t __n)
{
return const_cast<void*>(memchr(const_cast<const void*>(__p), __c, __n));
}
extern "C" const char* strchr(const char*, int);
inline char*
strchr(char* __s1, int __n)
{
return const_cast<char*>(strchr(const_cast<const char*>(__s1), __n));
}
extern "C" size_t strcspn(const char*, const char*);
extern "C" const char* strpbrk(const char*, const char*);
inline char*
strpbrk(char* __s1, const char* __s2)
{
return const_cast<char*>(strpbrk(const_cast<const char*>(__s1), __s2));
}
extern "C" const char* strrchr(const char*, int);
inline char*
strrchr(char* __s1, int __n)
{
return const_cast<char*>(strrchr(const_cast<const char*>(__s1), __n));
}
extern "C" size_t strspn(const char*, const char*);
extern "C" const char* strstr(const char*, const char*);
inline char*
strstr(char* __s1, const char* __s2)
{
return const_cast<char*>(strstr(const_cast<const char*>(__s1), __s2));
}
extern "C" char* strtok(char*, const char*);
extern "C" void* memset(void*, int, size_t);
extern "C" char* strerror(int);
extern "C" size_t strlen(const char*);
}
# 3 "/usr/local/include/g++-v3/cstring" 2 3
# 2 "td.C" 2
using namespace std;
void f(const char *name)
{
strchr(name,'/');
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-06-09 23:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-09 23:51 libstdc++/2767: Problems with the new bits/std_cstring.h header bkoz
-- strict thread matches above, loose matches on Subject: below --
2001-05-07 12:36 Peter Schmid
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).