This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Better error messages for type/rank checks
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: Manfred Schwarb <manfred99 at gmx dot ch>, Tobias Burnus <burnus at net-b dot de>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 31 May 2013 14:12:08 +0300
- Subject: Re: [Patch, Fortran] Better error messages for type/rank checks
- References: <CAKwh3qjTfdWCvA4+jRDiz8WmB6GHJtq1OdOecSrdBw3zUTqxnQ at mail dot gmail dot com> <51A7C4BE dot 9060509 at net-b dot de> <CAKwh3qhH+Z_ydyeFGUaHkvwwb3Je-cbbe=5FkwUDzHu1c4aw7w at mail dot gmail dot com> <51A874BC dot 4070901 at gmx dot ch> <CAKwh3qjFVUbM2QXBMRy09T77DDYP31rd+SpXBAHzADQexUAK-w at mail dot gmail dot com>
On Fri, May 31, 2013 at 1:21 PM, Janus Weil <janus@gcc.gnu.org> wrote:
> Hi Manfred,
>
>>> Attached is a small patch with an alternative implementation (borrowed
>>> from ada/terminals.c). It is not portable to all systems, but at least
>>> it does actually work on my openSUSE box. Is this something we want to
>>> have for gfortran?
>>>
>>
>> # cat >term.c <<EOF
>> #include <sys/ioctl.h>
>> #include <stdio.h>
>>
>> int main (void)
>> {
>> struct winsize w;
>> ioctl(0, TIOCGWINSZ, &w);
>>
>> printf ("lines %d\n", w.ws_row);
>> printf ("columns %d\n", w.ws_col);
>> return 0;
>> }
>> EOF
>>
>> # gcc term.c -o term
>>
>> # at now <<EOF
>> term > term1.txt
>> EOF
>> # cat term1.txt
>> lines 63152
>> columns 55767
>>
>> # at now <<EOF
>> term > term2.txt
>> EOF
>> # cat term2.txt
>> lines 24448
>> columns 22759
>>
>>
>> So this gives meaningless, varying numbers for me when
>> executing in non-interactive environment.
>
> Huh, funny. For me it works nicely. Does this also happen if you if
> gate your code by
>
> #ifdef TIOCGWINSZ
>
> as done in my patch? What operating system are you on?
Wouldn't it work to use the TIOCGWINSZ ioctl only if isatty() reports
that we're outputting to a terminal?
>
>
>> Perhaps cutting to some sane numbers is needed?
>
> Possibly.
>
>
>> Or, simply leave the line wrapping to the terminal and
>> remove all this trimming code?
>
> This is what we do with the actual error messages. I think the reason
> why the trimming is done for the source lines is that it is harder to
> follow the locus markers (i.e. "... error at (1) ...") if the source
> line is wrapped.
>
> Cheers,
> Janus
--
Janne Blomqvist