[PATCH C/C++] Fix some diagnostics problems

Shujing Zhao pearly.zhao@oracle.com
Thu Jun 10 07:07:00 GMT 2010


On 06/09/2010 08:55 PM, Jason Merrill wrote:
> On 06/09/2010 04:13 AM, Shujing Zhao wrote:
>> On 06/09/2010 03:06 AM, Jason Merrill wrote:
>>>
>>>> + case ICR_DEFAULT_ARGUMENT:
>>>> + error ("cannot convert %qT to %qT in default argument",
>>>> + rhstype, type);
>>>> + case ICR_ARGPASS:
>>>> + error ("cannot convert %qT to %qT in argument passing",
>>>> + rhstype, type);
>>>> + break;
>>>
>>> These cases are unreachable, as they are covered by the previous if
>>> (fndecl) test. Either remove the if (fndecl) message and use
>>> parmnum/fndecl in these cases, or just use gcc_unreachable() in these
>>> cases.
>>
>> At the test case testsuite/g++.old-deja/g++.mike/p10769b.C, the 'fndecl'
>> is NULL, while the errtype is ICR_ARGPASS (argument passing).
> 
> Ah, of course, when you're calling a function pointer you don't have a 
> declaration.  Is parmnum still set?

Jason, the pramnum isn't set too. Since if function pointer is passed, the bad 
conversion maybe still exist. The above cases still need be kept to error. 
Consider this status, the warning for a format attribute are changed to depend 
the value of (fndecl).
All the others are changed as your comment.
Retested on i686-pc-linux-gnu and no regression.
Is it ok?

Thanks
Pearly

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ChangeLog2
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100610/0e79c031/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: part2.patch
Type: text/x-patch
Size: 19258 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100610/0e79c031/attachment.bin>


More information about the Gcc-patches mailing list