Skip to contentSkip to conversation

srcpos: drop special handling of tab

PATCH Applied Julia Lawall 2 participants 2 messages Jan 22, 2018 – Jan 23, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 srcpos: drop special handling of tab

Align column number with those reported by gcc. Thus, do not make a tab count as 8 spaces.

---

This replaces the patch about correcting column numbers. That one should be dropped. This one, with the starting column as column 1 and no expansion of tabs, follows the strategy of gcc.

julia

 srcpos.c | 5 -----
 1 file changed, 5 deletions(-)
srcpos.c +0 -5
index 9d38459..cb6ed0e 100644
@@ -209,8 +209,6 @@ struct srcpos srcpos_empty = {
 	.file = NULL,
 };
 
-#define TAB_SIZE      8
-
 void srcpos_update(struct srcpos *pos, const char *text, int len)
 {
 	int i;
@@ -224,9 +222,6 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
 		if (text[i] == '\n') {
 			current_srcfile->lineno++;
 			current_srcfile->colno = 1;
-		} else if (text[i] == '\t') {
-			current_srcfile->colno =
-				ALIGN(current_srcfile->colno, TAB_SIZE);
 		} else {
 			current_srcfile->colno++;
 		}
Signature · 1 line
2.7.4
Applied
#1 lore raw
Quoted 9 lines · Julia Lawall

Align column number with those reported by gcc. Thus, do not make a tab count as 8 spaces.

---

This replaces the patch about correcting column numbers. That one should be dropped. This one, with the starting column as column 1 and no expansion of tabs, follows the strategy of gcc.

Applied, thanks.

Quoted 29 lines

julia

 srcpos.c | 5 -----
 1 file changed, 5 deletions(-)
srcpos.c +0 -5
index 9d38459..cb6ed0e 100644
@@ -209,8 +209,6 @@ struct srcpos srcpos_empty = {
 	.file = NULL,
 };
 
-#define TAB_SIZE      8
-
 void srcpos_update(struct srcpos *pos, const char *text, int len)
 {
 	int i;
@@ -224,9 +222,6 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
 		if (text[i] == '\n') {
 			current_srcfile->lineno++;
 			current_srcfile->colno = 1;
-		} else if (text[i] == '\t') {
-			current_srcfile->colno =
-				ALIGN(current_srcfile->colno, TAB_SIZE);
 		} else {
 			current_srcfile->colno++;
 		}
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson