This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] gfc_notify_std cleanup


Hi Mikael,

>>> 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.

Also not a bad idea, but I guess I'll stick with the buffering now.


>>> 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 ;-).

Yes, of course it's better :)

Attached is a new version, which uses the dynamic allocation as
proposed by Tobias.


> Nice patch anyway.

Thanks. In case there are more comments on the patch, just keep it
coming. Otherwise I'll commit the attached version soon (once I'm done
with the tedious task of writing a ChangeLog for this baby).

As mentioned earlier, I will not include any more wording changes or
GFC_STD_* additions. Those can be done in a follow-up patch.

Cheers,
Janus

Attachment: pr51081_v4.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]