[Patch, Fortran] PR 69495: unused-label warning does not tell which flag triggered it

Manfred Schwarb manfred99@gmx.ch
Wed Feb 3 21:47:00 GMT 2016


Am 03.02.2016 um 19:18 schrieb Janus Weil:
> Hi,
>
> 2016-02-03 10:21 GMT+01:00 Manfred Schwarb <manfred99@gmx.ch>:
>>> here is a diagnostics patch, which makes sure that the responsible
>>> flag is printed in several warning messages (for which this was still
>>> missing).
>>>
>>
>>     if (source_size < result_size)
>> -    gfc_warning (0, "Intrinsic TRANSFER at %L has partly undefined result:
>> "
>> -                "source size %ld < result size %ld", &source->where,
>> -                (long) source_size, (long) result_size);
>> +    gfc_warning (OPT_Wsurprising, "Intrinsic TRANSFER at %L has partly "
>> +                "undefined result: source size %ld < result size %ld",
>> +                &source->where, (long) source_size, (long) result_size);
>>
>> Breaking apart of these strings will probably hamper translation.
>
> thanks for the comment, I was not aware that this is a problem (in
> fact I'm rather ignorant of the translation process as a whole). I was
> just trying to comply with the GNU coding standards by avoiding
> overlong lines.
>
> So, I assume the problem is that the strings are being broken
> *differently* than before, right? (Obviously the were broken already
> ...) I guess I will just move the start of the warning message to a
> new line in order to avoid this.
>

There are 2 things with translation, and there is a third issue:
- As you noticed, breaking things differently means translation has to be
   done again.
- Normally, each string is translated independently, and depending on the
   language there may be lack of context (e.g. adjectives get different suffixes
   depending on the noun).
- grep'ability: you got such an error message, then you want to look for the
   corresponding code and do a grep for e.g. "partly undefined result".
   GOTCHA!

So IMHO strings should be left intact, irrespective of some arbitrary 80 char limits.
Other projects, e.g. the linux kernel, do deliberately violate the 80 char limit
if it is needed, and do not always break strings. I do not know how it is handled
in the GCC project, but I guess common sense is always a good recipe.

Of course it is no problem to split at natural boundaries, e.g. at ":", ";" or "."
characters.

Cheers,
Manfred


> Btw, if anyone notices any further cases where the flag is missing in
> the warning message, please let me know. (I haven't searched through
> the whole gfortran code for more such cases and I'm not planning on
> doing so, but I'll be happy to include further cases in the patch if
> pointed out to me ...)
>
> Also I guess I should mention Manuel and Dominique in the Changelog
> (for their supportive comments in the PR).
>
> Cheers,
> Janus
>



More information about the Fortran mailing list