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] Better error messages for type/rank checks


Manfred Schwarb wrote:
Perhaps cutting to some sane numbers is needed?

Or, simply leave the line wrapping to the terminal and
remove all this trimming code?

Well, the problem with the latter is that it leads to diagnostics like:


Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pellentesque enim in lorem sagittis at elementum ipsum malesuada. Duis egestas nibh at erat pharetra id sodales tortor facilisis. Cras tempor, sapien eu dapibus posuere, quam dolor suscipit ante, non iaculis elit lorem vel nunc. Suspendisse ut tempus urna. Sed nec nisl sed sapien
                             (1)

Where it is difficult to see where the location (1) actually points to. It also clutters the output quite a bit - I find it already now sometimes difficult to spot the errors and warnings in all those output lines.

On the other hand, showing the full line instead of only the trailing comment (cf. remark about the error location in previous email) helps to spot the problem. Although, that one can be also solved by using the position of the "!" as column for the error display.

As Fortran only allows 132 characters (unless special command-line options are used), the problem is less problematic than in the example above. Or as in C/C++, from which the 80 + COLUMNS environment variable were taken. In C, especially automatically generated code can have extremely long line lengths.

Regarding the limit of 80 characters: That's also used by other tools like a2ps, hence it is not completely arbitrary. Also IDE windows and terminals are often not that wide - they are rarely used in full screen width as the code lines are simply not longer. And while the length of 72 (only later: 80) dates back to punch cards, humans have problems with too long lines. Hence, newspapers are printed in columns - and line lengths of 50 to 60, maximally 75, characters are regarded as optimal. (Due to indenting and avoiding breaking statements into too many new lines, slightly longer lines are fine for programming.)

Thus, I am in favour of having some reasonable limited. Whether 80 or 132 is best, is bikeshadding. I am slightly inclined to 80, but also 132 is fine with me. Thus, if you want, you can bump the value to 132.

* * *

Ignoring the line length, I would like to see the following two improvements:

a) To use the common middle-end diagnostic system (which some special Fortran handling); that will make use profit from general improvements (cf. PR44054). In particular:
- Color output, cf. http://gcc.gnu.org/gcc-4.9/changes.html
- Show the flag which caused the warning in parentheses
- Handling of -Werror=... (I think gfortran currently only handles -Werror to turn all warnings into errors)

b) To use with %C error diagnostic, the column at the comment character or last nonwhitespace character (whatever comes first) instead of of the end of the line.

Tobias


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