# HG changeset patch # User David A. Holland # Date 1373739599 14400 # Node ID a403605d3166cfcd71f5ad6ac3f543c44bafa837 # Parent 7ab3d0c09cd8ba7d4a76cab9b60ad912937754c5 Fix handling of macros in quoted strings. Add some more tests; edit CHANGES a bit. diff -r 7ab3d0c09cd8 -r a403605d3166 CHANGES --- a/CHANGES Sat Jul 13 13:54:07 2013 -0400 +++ b/CHANGES Sat Jul 13 14:19:59 2013 -0400 @@ -1,9 +1,12 @@ pending - Fix stupid build problem introduced in 0.3.1. - - Accept and ignore -m32. I thought this had already been done, but - apparently not. + - Accept and ignore -m32, which imake issues willy-nilly on a bunch + of platforms. I thought this had already been done, but apparently + not. - Don't use the functions. There are still people out there - using legacy systems that are missing them. + using legacy systems missing them. + - Sort out some more issues pertaining to handling quoted strings. + - Add some more tests. release 0.3.1 (20130709) - Don't leak memory and assert if a bad command-line option comes diff -r 7ab3d0c09cd8 -r a403605d3166 TODO --- a/TODO Sat Jul 13 13:54:07 2013 -0400 +++ b/TODO Sat Jul 13 14:19:59 2013 -0400 @@ -21,4 +21,3 @@ - "#if 0 && 1/0" should not crash; fix eval method. - an unterminated comment is reported as "no newline at end of file" (which isn't fatal by default) - - the behavior of t26 is different here and in gcc -E -traditional diff -r 7ab3d0c09cd8 -r a403605d3166 macro.c --- a/macro.c Sat Jul 13 13:54:07 2013 -0400 +++ b/macro.c Sat Jul 13 14:19:59 2013 -0400 @@ -1088,7 +1088,7 @@ x = len; } - if (x > 0) { + if (!inquote && x > 0) { expand_got_word(es, p, buf, x); buf += x; len -= x; diff -r 7ab3d0c09cd8 -r a403605d3166 tests/Makefile --- a/tests/Makefile Sat Jul 13 13:54:07 2013 -0400 +++ b/tests/Makefile Sat Jul 13 14:19:59 2013 -0400 @@ -3,7 +3,8 @@ TESTS=\ t01 t02 t03 t04 t05 t06 t07 t08 t09 t10 t11 t12 t13 t14 t15 t16 \ - t17 t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 t28 t29 t30 t31 + t17 t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 t28 t29 t30 t31 t32 \ + t33 all: run-tests .WAIT show-diffs diff -r 7ab3d0c09cd8 -r a403605d3166 tests/t26.c --- a/tests/t26.c Sat Jul 13 13:54:07 2013 -0400 +++ b/tests/t26.c Sat Jul 13 14:19:59 2013 -0400 @@ -1,2 +1,4 @@ #define FOO foo +FOO "FOO" +'FOO' diff -r 7ab3d0c09cd8 -r a403605d3166 tests/t26.good --- a/tests/t26.good Sat Jul 13 13:54:07 2013 -0400 +++ b/tests/t26.good Sat Jul 13 14:19:59 2013 -0400 @@ -1,1 +1,3 @@ -"foo" +foo +"FOO" +'FOO' diff -r 7ab3d0c09cd8 -r a403605d3166 tests/t32.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t32.c Sat Jul 13 14:19:59 2013 -0400 @@ -0,0 +1,21 @@ +#define foo(x) "x" +#define bar(x) 'x' +#define baz frob +foo(3) +bar(3) +foo(baz) +bar(baz) +"baz" +'baz' +"foo(baz)" +"bar(baz)" + +#define foo2(x) foo(x) +#define bar2(x) bar(x) +foo2(baz) +bar2(baz) + +#define foo3(x) foo2(x) +#define bar3(x) bar2(x) +foo3(baz) +bar3(baz) diff -r 7ab3d0c09cd8 -r a403605d3166 tests/t32.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t32.good Sat Jul 13 14:19:59 2013 -0400 @@ -0,0 +1,12 @@ +"3" +'3' +"baz" +'baz' +"baz" +'baz' +"foo(baz)" +"bar(baz)" +"baz" +'baz' +"baz" +'baz' diff -r 7ab3d0c09cd8 -r a403605d3166 tests/t33.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t33.c Sat Jul 13 14:19:59 2013 -0400 @@ -0,0 +1,6 @@ +/* make sure that R gets defined and doesn't end up part of a string */ +#define Q " +#define R r +#define S " +R +Q diff -r 7ab3d0c09cd8 -r a403605d3166 tests/t33.good --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/t33.good Sat Jul 13 14:19:59 2013 -0400 @@ -0,0 +1,3 @@ + +r +"