public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
To: Dodji Seketeli <dodji@redhat.com>, gcc <gcc@gcc.gnu.org>
Subject: Re: -Wformat-security warnings generated in gcc build
Date: Fri, 24 Jan 2014 16:19:00 -0000	[thread overview]
Message-ID: <CAJXstsD+npFDO8jhDh+7pZ8L3Mk-G74-Q-sqeHwCWUkTLDgJGg@mail.gmail.com> (raw)
In-Reply-To: <CAJXstsAJW==edLkvgXFsP1uqoBM+PTn1Lp4btwu0Ms-MyKSgeA@mail.gmail.com>

On Thu, Jan 23, 2014 at 9:09 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> On Thu, Jan 23, 2014 at 8:24 PM, Dodji Seketeli <dodji@redhat.com> wrote:
>> Prathamesh Kulkarni <bilbotheelffriend@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	other threads:[~2014-01-24 15:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 16:03 Prathamesh Kulkarni
2014-01-21 17:50 ` Jakub Jelinek
2014-01-21 17:58 ` Joseph S. Myers
2014-01-21 20:19   ` Florian Weimer
2014-01-22 15:48   ` Prathamesh Kulkarni
2014-01-22 18:05     ` Joseph S. Myers
2014-01-23 11:43       ` Dodji Seketeli
2014-01-23 13:16         ` Trevor Saunders
2014-01-23 14:54         ` Prathamesh Kulkarni
2014-01-23 15:39           ` Dodji Seketeli
2014-01-23 15:55             ` Prathamesh Kulkarni
2014-01-24 16:19               ` Prathamesh Kulkarni [this message]
2014-01-26 16:12                 ` Prathamesh Kulkarni
2014-02-01 18:00                   ` Prathamesh Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJXstsD+npFDO8jhDh+7pZ8L3Mk-G74-Q-sqeHwCWUkTLDgJGg@mail.gmail.com \
    --to=bilbotheelffriend@gmail.com \
    --cc=dodji@redhat.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).