This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] gfc_notify_std cleanup
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