From: evans1629 Date: Fri, 5 Jul 2002 17:28:19 +0000 (+0000) Subject: Added chararrylit test case. X-Git-Tag: splint-3_1_0~105 X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/commitdiff_plain/755ee3f628072613d1e4b8e07f85c09169c6a0d1 Added chararrylit test case. --- diff --git a/src/cpplib.c b/src/cpplib.c index b9aa4ee..0e562d0 100644 --- a/src/cpplib.c +++ b/src/cpplib.c @@ -6510,6 +6510,12 @@ get_next: DPRINTF (("Arglist macro!")); + /* + ** evans 2002-07-03: Moved this here (from below). + ** This bug caused necessary whitespace to be lost + ** when parsing parameterized macros without parameters. + */ + parseSetMark (¯o_mark, pfile); while (cppBuffer_isMacro (CPPBUFFER (pfile))) diff --git a/test/Makefile.am b/test/Makefile.am index abe2d71..41892ec 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -40,7 +40,7 @@ SPLINTRNEST = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint UNITTESTS = \ help \ abstptr abstract alias alttypes ansireserved argorder \ - args arraydims arrayinit arraylit blocks break cases cast charlit clauses commentchar compdestroy \ + args arraydims arrayinit arraylit blocks break cases cast chararraylit charlit clauses commentchar compdestroy \ compoundliterals compoundstmt constannot controldepth csyntax czechnames czechoslovaknames deadparam \ decl divzero enum enumtag exports external fields flags forbody format freearray \ funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \ @@ -265,6 +265,10 @@ cast: -$(SPLINTR) cast -accessmodule -expect 20 -$(SPLINTRN) cast2.c +checks -exportlocal -exportheader -expect 3 +.PHONY: chararraylit +chararraylit: + -$(SPLINTR) chararraylit.c -expect 2 + ### Two addition errors detected with 2.5 with -numliteral. .PHONY: charlit @@ -1052,6 +1056,7 @@ EXTRA_DIST = ./abst_t.lcl ./abst_t.lcs \ ./cases2.c \ ./cast.c \ ./cast2.c \ + ./chararraylit.c \ ./charlit.c \ ./clauses.c \ ./clauses2.c \ @@ -1371,6 +1376,7 @@ EXTRA_DIST = ./abst_t.lcl ./abst_t.lcs \ buffertest.expect \ cases.expect \ cast.expect \ + chararraylit.expect \ charlit.expect \ clauses.expect \ commentchar.expect \ diff --git a/test/chararraylit.c b/test/chararraylit.c new file mode 100644 index 0000000..057a42f --- /dev/null +++ b/test/chararraylit.c @@ -0,0 +1,14 @@ +/* +** Character arrays can be initialized using string literals (without becoming observers). +*/ + +void f (void) +{ + char s0[] = "abc"; + char s1[3] = "abc"; /* warning about no room for nullterminator */ + char *p = "abc"; + + *s0 = 'b'; /* okay */ + s1[1] = 'd'; /* okay */ + *p = 'c'; /* error */ +} diff --git a/test/chararraylit.expect b/test/chararraylit.expect new file mode 100644 index 0000000..e69de29