PR 2767, V3 regression failure on strstr et al

Loren James Rittle rittle@latour.rsch.comm.mot.com
Tue May 22 02:23:00 GMT 2001


>On 18-May-2001, Stephen M. Webb <stephen@bregmasoft.com> wrote:
>>   #include <bits/std_cstddef.h>
>>   
>>   #pragma GCC system_header
>> + 
>> + #define memchr  glibcpp_hidden_memchr
>> + #define strchr  glibcpp_hidden_strchr
>> + #define strpbrk glibcpp_hidden_strpbrk
>> + #define strrchr glibcpp_hidden_strrchr
>> + #define strstr  glibcpp_hidden_strstr
[...include system string.h...]

The original bug report had some form of this:

#include <cstring>
using namespace std;
void f() {
strstr("aba","b");
}

However, some program might legally do this (see D.5 of ISO C++):

#include <string.h>
#include <cstring>
using namespace std;
void f() {
strstr("aba","b");
}

Unfortunately, your approach breaks in this case.  However, you do get
us farther to a solution.  Thus, I am happy your patch was applied.

Regards,
Loren



More information about the Libstdc++ mailing list