help needed with gcc-4.4 build failure

Andrew Haley aph at redhat.com
Wed Feb 18 14:09:47 UTC 2009


Julian Sikorski wrote:
> Hi,
> 
> I am trying to make gnome-chemistry-utils ready for the mass rebuild.
> Unfortunately, there are some issues which are beyond my skills. The
> first one is the fact that some adjustments for new xulrunner are
> needed. With gcc-4.4, however, build fails even earlier:
> 
> element.cc: In function 'void ReadValue(const char*, GcuValue&)':
> element.cc:49: error: invalid conversion from 'const char*' to 'char*'
> element.cc: In function 'void ReadDimensionalValue(const char*,
> GcuDimensionalValue&)':
> element.cc:58: error: invalid conversion from 'const char*' to 'char*'
> 
> Full build log is here:
> http://belegdol.fedorapeople.org/build.log
> 
> Upstream unfortunately cannot reproduce the problem, here is his comment:
> 
> 
> Looks like the issue comes with strchr.
> 
> man strchr says:
> char *strchr(const char *s, int c);
> 
> I don't see what is wrong since the argument is a const char* string.
> 
> I can't reproduce the issue. May be the signature of strchr changed in
> glibc?
> Anyway, the above signature is not consistent since it returns a char* which
> is a substring of a const char*.

I agree, that's not your fault.  It's what the standard says it has to be.

> If this is the case, there is a need for a test in configure to find which
> signature version is available.

I don't see why.  It looks to me like you can simply do this:

static void ReadDimensionalValue (char const *source, GcuDimensionalValue &value)
{
	const char *buf, *dot;
	char *tmp;
	value.value = strtod (source, &tmp);
	buf = tmp;
	dot = strchr (source, '.');
	value.prec = (dot)? buf - dot - 1: 0;
	value.delta = (*buf == '(')? strtol (buf + 1, NULL, 10): 0;
}

Slightly weird, but it'll do.

Andrew.




More information about the fedora-devel-list mailing list