cpplib: adjust column counter for tabs

Zack Weinberg zack@wolery.cumb.org
Mon May 15 11:17:00 GMT 2000


On Mon, May 15, 2000 at 08:52:37PM +0900, Neil Booth wrote:
> This patch adjusts reported column numbers for tabs, with a tab
> counting as 8 spaces.

That's not quite correct.  The effect of a tab is to move right one
space unconditionally, then continue right until the column number is
divisible by some value.  That value is normally 8, but needs to be
adjustable by command-line option - some people insist on 4-space
tabs, for example.  I'd suggest -ftabstop=<N> for the option name.

> It misses tabs embedded in strings and block comments, but I don't
> believe they're worth catching
> 
> 1) because of the overhead it would incur, and
> 2) anyone who embeds tabs there deserves to get incorrect column
> counts anyway

That seems fair at least as a first approximation, if we get bug
reports we can revisit.

Tabs *do* appear in block comments when you have a multiline comment
that has been indented to line up with running code.  There usually
isn't anything else on those lines so it doesn't matter.

zw


More information about the Gcc-patches mailing list