On Thu, Mar 8, 2018 at 4:26 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Thu, Mar 08, 2018 at 04:20:40PM -0500, Jason Merrill wrote:
>> On Thu, Mar 8, 2018 at 1:08 PM, Jakub Jelinek <ja...@redhat.com> wrote:
>> > The reporter complains that -Wformat incorrectly reports std::string* 
>> > passed
>> > to "%s" format rather than std::string, which is what the user did.
>> >
>> > This transformation of non-trivial copy init or dtor classes in ellipsis is
>> > done by convert_arg_to_ellipsis; that function does many changes and all
>> > but this one look desirable for the 
>> > -Wnonnull/-Wformat/-Wsentinel/-Wrestrict
>> > warnings.  We prepare a special argument vector in any case, so this patch
>> > just arranges to undo what convert_arg_to_ellipsis did for the classes.
>> > I think -Wnonnull shouldn't care, because when passing such a class by
>> > value, it will be non-NULL (and -Wnonnull looks only for literal NULLs
>> > anyway), -Wrestrict only cares about named arguments and -Wsentinel only
>> > cares about NULL arguments passed to ellipsis.
>>
>> I notice that convert_arg_to_ellipsis generates a pointer-typed
>> expression, whereas convert_for_arg_passing generates a reference.
>> Does correcting that inconsistency help?
>
> No (though I think it is a good idea anyway).

Perhaps then check_format_types could look through REFERENCE_TYPE,
since there are no actual expressions of reference type.

Jason

Reply via email to