On Thu, Jan 23, 2014 at 9:09 PM, Prathamesh Kulkarni
<bilbotheelffri...@gmail.com> wrote:
> On Thu, Jan 23, 2014 at 8:24 PM, Dodji Seketeli <do...@redhat.com> wrote:
>> Prathamesh Kulkarni <bilbotheelffri...@gmail.com> writes:
>>
>>>
>>> Shall it be correct then to replace calls to error() and friends,
>>> taking only format string with no-argument specifiers
>>> to error_at_no_args() ? (similarly we shall need warning_at_no_args,
>>> pedwarn_no_args, etc.)
>>
>> I would guess so, yes.
>>
>>>>
>>>> Also, you'd need to modify cp/error.c:cp_printer in a similar way, to
>>>> issue an internal_error each time we try to access a null test->args_ptr.
>>>
>>> Shall check for text->args_ptr be required in each case label of
>>> argument specifier in pp_format()
>>> and client-specific functions like cp_printer() ?
>>
>> Yes, I think so.  Maybe you can make that a bit more maintainable by
>> creating a macro like those used to access text->args_ptr in cp_printer,
>> e.g:
>>
>>     #define next_int     va_arg (*text->args_ptr, int)
>>
>> In that macro, make the check for text->args_ptr before accessing it,
>> and then use that macro to access text->args_ptr through the function.
>>
>
> I was going through diagnostic.c, it appears that many functions in
> (error(), error_at(), warning(), etc.) share common code (mostly
> contains call to diagnostic_set_info() followed by call to
> report_diagnostic()), which I guess can be re-written in terms of
> emit_diagnostic(), however since it's variadic that's not possible. I
> wrote a v_emit_diagnostic() function, that takes same arguments as
> emit_diagnostic(), with additional va_list * at end (va_list * instead
> of va_list, so I could pass NULL for error_no_args() and friends). Is
> it correct to write these other functions (emit_diagnostic(), error(),
> inform(), etc.) in terms of v_emit_diagnostic() ?

silly mistake in warning_at(), it should be:
ret = v_emit_diagnostic (DK_WARNING, location, opt, gmsgid, &ap);

>
>
>
>
>
>> --
>>                 Dodji

Reply via email to