This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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


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


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