public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janus Weil <janus@gcc.gnu.org>
To: Tobias Burnus <burnus@net-b.de>
Cc: gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, Fortran] gfc_notify_std cleanup
Date: Tue, 17 Jul 2012 14:45:00 -0000	[thread overview]
Message-ID: <CAKwh3qi_4Mzvtd3enmf0xa=nWzVtvqFt7rhuE4OwtEBMZne8eA@mail.gmail.com> (raw)
In-Reply-To: <500567FC.8080607@net-b.de>

Hi,

> Ditto here. Though,  I think you are in danger of exceeding the buffer - if
> not here, then further down.

admitted - the buffer length could clearly be a problem (in connection
with translation).


> Wouldn't it be simplyer to keep the error print for Warning/Error, assign
> the messages to a "const char * msg" and then pass the msg to error_print?
> That would be two calls to error_print, but would avoid buffer issues, calls
> to strcpy/strcat, and would work with i18n.

Actually I also tried something like this, but couldn't get it to work
(the biggest problem being that stuff will not show up in one line
after the locus printout).


> Okay, that won't work as one has to call error_print only once. Maybe
> something like the following will work:
>
> const char *msg, *msg2;
> char *buffer;
>   msg = _("Warning: ");
>   msg2 = _("Deleted feature:");
>   buffer = (char *) alloca (strlen (msg) + strlen (msg2)+1);
>   strcpy(buffer, msg);
>   strcat (buffer, msg2);
>   error_print (buffer, _(gmsgid), argp);
>
> where the buffer itself is not send through _().

With this you are almost back to my last version, except that you
allocate the buffer dynamically.

Cheers,
Janus

  reply	other threads:[~2012-07-17 14:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17  9:42 Janus Weil
2012-07-17 10:03 ` Tobias Burnus
2012-07-17 11:48   ` Janus Weil
2012-07-17 12:50     ` Janus Weil
2012-07-17 13:26       ` Tobias Burnus
2012-07-17 14:45         ` Janus Weil [this message]
2012-07-17 18:56           ` Mikael Morin
2012-07-17 20:00             ` Janus Weil
2012-07-17 21:55               ` Janus Weil
2012-07-17 19:25   ` Mikael Morin
2012-07-17 19:40     ` Tobias Burnus

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='CAKwh3qi_4Mzvtd3enmf0xa=nWzVtvqFt7rhuE4OwtEBMZne8eA@mail.gmail.com' \
    --to=janus@gcc.gnu.org \
    --cc=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).