Re: Mixed line endings(DOS/Unix) in the source file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/11/13 22:06, Brian Budge wrote:
On Thu, Nov 7, 2013 at 10:44 AM, Ian Lance Taylor<iant@xxxxxxxxxx>  wrote:
GCC treats a bare \r in a program as though it were an old MacOS file,
where \r ends a line.  So I think this is simply a disagreement
between what you expect and what GCC expects.

I don't think there is any right answer here.

Ian
Correct me if I'm wrong, but I believe it's not an issue of the line
number it is complaining about, but rather that it indicates the wrong
code is at fault?  The actual error is that you're assigning a
function pointer to an integer, but with the ^M in comments, despite
stating the correct type of error, gcc indicates ".f = foo" is the
error instead of ".c = foo".

I just tested with gcc 4.8.2, and this still seems to be the case.

   Brian
The snippet you are shown is extracted from the line number. And that
was incremented whenever it encountered \r, \n or \r\n
The bug is that the error showing piece should be using the same line definition as the parser, but I'm not convinced that changing it to count \r is the right thing, as it will still confuse the user when he jumps to the reported line on its favourite
editor.
If the parser had seen \n and it finds a lonely \r I think it should emit a pedantic diagnostic and not increment the line counter (perhaps using separated counters
to avoid conditionals there).





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux