]> andersk Git - splint.git/commitdiff
Added chararrylit test case.
authorevans1629 <evans1629>
Fri, 5 Jul 2002 17:28:19 +0000 (17:28 +0000)
committerevans1629 <evans1629>
Fri, 5 Jul 2002 17:28:19 +0000 (17:28 +0000)
src/cpplib.c
test/Makefile.am
test/chararraylit.c [new file with mode: 0644]
test/chararraylit.expect [new file with mode: 0644]

index b9aa4ee1d94c9f7e03181e84f83d1810d75962d3..0e562d00e2da4bd42944126ea4039e2a107cffc8 100644 (file)
@@ -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 (&macro_mark, pfile); 
 
                while (cppBuffer_isMacro (CPPBUFFER (pfile)))
index abe2d7167d61aef6a7c013b15fac6242902e3a9f..41892ecb6b4cb06f13efa1c82923884caae2bfba 100644 (file)
@@ -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 (file)
index 0000000..057a42f
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
This page took 0.075128 seconds and 5 git commands to generate.