[PATCH] Fix std::strchr etc. prototypes for C++

Jakub Jelinek jakub@redhat.com
Thu Jan 29 21:38:00 GMT 2009


On Thu, Jan 29, 2009 at 11:43:27AM -0800, Benjamin Kosnik wrote:
> > Attached is also a testcase that verifies this, but we'd probably
> > need a new tcl function to check if glibc is used and has recent
> > enough headers to allow the testcase to pass.
> 
> Or you could just wrap the proposed new testcase with #ifdef
> __CORRECT_ISO_CPP_STRING_H_PROTO for now. 

I can't, because the testcase is testing compiler errors.
If I wrap it inside #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO,
the errors still won't be generated.
What we could do is:
proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
    return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
        #include <stdint.h>
        #include <wchar.h>
        #if !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
	ISO C++ correct string.h and wchar.h protos not supported.
	#else
	int i;
        #endif
    }]
}

in target-supports.exp and use
{ dg-do compile { target correct_iso_cpp_string_wchar_protos } }
in the testcase.  This is untested though.

> 
> :)
> 
> I would find that acceptable. I would like to see something checked in
> to the libstdc++ testsuites to track this.
> 
> Longer term, we may want to generalize this and flip a new _GLIBCXX_
> type define and use that in libstdc++ instead of __CORRECT_ISO_CPP_*  if
> configure probe finds the C++ includes for string.h/wchar.h has the
> corrected decls. I believe some (later sun?) other libcs also do
> something like what you've proposed for libc. It's been a while since I
> last looked.
> 
> For the moment though, let's do the expedient thing so that the
> libc/libstdc++ bits are synchronized at check-in and we can move
> forward.

Ok.

	Jakub



More information about the Gcc-patches mailing list