From: Mikael Morin <mikael.morin@sfr.fr>
To: Janus Weil <janus@gcc.gnu.org>
Cc: Tobias Burnus <burnus@net-b.de>, 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 18:56:00 -0000 [thread overview]
Message-ID: <5005B4E7.6080804@sfr.fr> (raw)
In-Reply-To: <CAKwh3qi_4Mzvtd3enmf0xa=nWzVtvqFt7rhuE4OwtEBMZne8eA@mail.gmail.com>
Hello,
On 17/07/2012 16:44, Janus Weil wrote:
> 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).
>
Another possibility is adding an argument to error_print containing the
standard version information either as a string or as an enum; an
argument that is ignored if it has an invalid value (NULL string, ...),
typically for errors irrelevant to the standard version.
I'm fine with Tobias' suggestion too.
>
>> 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.
... which is better ;-).
Nice patch anyway.
Mikael
next prev parent reply other threads:[~2012-07-17 18:56 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
2012-07-17 18:56 ` Mikael Morin [this message]
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=5005B4E7.6080804@sfr.fr \
--to=mikael.morin@sfr.fr \
--cc=burnus@net-b.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=janus@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).