# HG changeset patch # User David A. Holland # Date 1364741228 14400 # Node ID f8507e5ed84ceaa48dcd4252c4a13cf1ae37d366 # Parent 161edab0d361163026dd6925afe1798a1a209946 Recognize directive lines only when the # is exactly in column 0. This is the traditional behavior and Joerg's convinced me it's important to retain it. diff -r 161edab0d361 -r f8507e5ed84c directive.c --- a/directive.c Sun Mar 31 02:18:24 2013 -0400 +++ b/directive.c Sun Mar 31 10:47:08 2013 -0400 @@ -571,12 +571,11 @@ p->column += acomm; } - /* check if we have a directive line */ - skip = strspn(line + acomm, ws); - if (acomm == 0 && line[skip] == '#') { + /* check if we have a directive line (# exactly in column 0) */ + if (acomm == 0 && line[0] == '#') { char ch; - skip = skip + 1 + strspn(line + skip + 1, ws); + skip = 1 + strspn(line + 1, ws); assert(skip <= text); p->column += skip; assert(line[len] == '\0'); diff -r 161edab0d361 -r f8507e5ed84c tests/Makefile --- a/tests/Makefile Sun Mar 31 02:18:24 2013 -0400 +++ b/tests/Makefile Sun Mar 31 10:47:08 2013 -0400 @@ -3,7 +3,7 @@ TESTS=\ t01 t02 t03 t04 t05 t06 t07 t08 t09 t10 t11 t12 t13 t14 t15 t16 \ - t17 t18 t19 t20 + t17 t18 t19 t20 t21 all: run-tests .WAIT show-diffs diff -r 161edab0d361 -r f8507e5ed84c tests/t21.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t21.c Sun Mar 31 10:47:08 2013 -0400 @@ -0,0 +1,3 @@ +# define FOO BAR + #undef FOO /* would be wrong */ +FOO diff -r 161edab0d361 -r f8507e5ed84c tests/t21.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t21.good Sun Mar 31 10:47:08 2013 -0400 @@ -0,0 +1,2 @@ + #undef BAR +BAR