Binutils Port - Infineon xc16x family.

Nick Clifton nickc@redhat.com
Fri Mar 3 15:53:00 GMT 2006


Hi Dave,

>>One confusing thing is that it is not working if use "Return NULL" in
>>both the conditions.

>   But if you remove the braces, that's the same thing as returning NULL in
> both cases, and you said that that works

Actually he said that it did not work.  That was the point.

What was actually happening was that in this (working but broken) code:

>    static const char *
>    parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
> 	    const char **strp,
> 	    int opindex ATTRIBUTE_UNUSED,
> 	    long *valuep ATTRIBUTE_UNUSED)
>    {
>      if (**strp == '#')
>        {
>          ++*strp;
>          return NULL;
>        }
>    }

if the parse failed, a non-deterministic value was being returned, which 
was probably not NULL (it was probably the value of the 'cd' argument) 
and so the code appeared to work.

That was what confused me originally.  I saw that the else.. clause had 
been commented out, assumed that the programmer's intention had been to 
return NULL in all cases and so made my change.  I did not foresee the 
fortuitous behaviour of returning a non-NULL value which indicated an 
error but which was not further examined for any meaning.

Anyway, all is well now, so I will check in the revised patch.

Cheers
   Nick



More information about the Binutils mailing list