]> andersk Git - splint.git/commitdiff
Added test cases for stringliteral initalization checking
authordrl7x <drl7x>
Tue, 22 Jan 2002 22:21:40 +0000 (22:21 +0000)
committerdrl7x <drl7x>
Tue, 22 Jan 2002 22:21:40 +0000 (22:21 +0000)
test/Makefile
test/Makefile.am
test/Makefile.in
test/null6.lcd
test/stringliteral.c [new file with mode: 0644]
test/stringliteral.expect [new file with mode: 0644]
test/tests2.5/newlint.lcd

index 4009f0cce775668327600f0bf23461323abe1b1b..001119e5c615489a742f592dd590506bd790eba4 100644 (file)
@@ -61,18 +61,29 @@ host_alias =
 host_triplet = i686-pc-linux-gnu
 target_alias = 
 target_triplet = i686-pc-linux-gnu
+AMTAR = ${SHELL} /net/af9/drl7x/reTmp/LCLintDev/config/missing --run tar
+AWK = gawk
 BISON = bison
 CAT = cat
 CC = gcc
 CP = cp
 CPP = gcc -E
+DEPDIR = .deps
 DIFF = diff
+EXEEXT = 
 GREP = grep
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
 LCLOBJ = $(lcl_OBJECTS)
 LEX = flex
 LN_S = ln -s
 MV = mv
+OBJEXT = o
+PACKAGE = splint
 RM = rm
+VERSION = 3.0.1.4
+am__include = include
+am__quote = 
+install_sh = /net/af9/drl7x/reTmp/LCLintDev/config/install-sh
 
 AUTOMAKE_OPTIONS = 1.5 foreign
 
@@ -114,6 +125,7 @@ UNITTESTS = \
   returned sharing shifts slovaknames \
   specclauses \
   special stack staticarray strings \
+  stringliteral \
   structassign typequals ud ulstypes union unioninit unreachable unsignedcompare \
   unused ullint utypes void widestrings
 
@@ -760,7 +772,9 @@ EXTRA_DIST = ./abst_t.lcl ./abst_t.lcs  \
                 functionmacro.expect functionmacro.c  info.c info.expect \
                 loopexec.c mergenull.c shifts.c \
                 manual.expect ./manual/Makefile \
-                ./manual/annotglobs.c  ./manual/bool.c  ./manual/bool.h  ./manual/clauses.c  ./manual/employee.h  ./manual/exposure.c  ./manual/globals.c  ./manual/ignore.c  ./manual/implicit.c  ./manual/intSet.h  ./manual/list.c  ./manual/loop.c  ./manual/macros.c  ./manual/modify.c  ./manual/mstring.c  ./manual/mstring.h  ./manual/mstringnn.c  ./manual/multiError.c  ./manual/names.c  ./manual/noeffect.c  ./manual/null.c  ./manual/only.c  ./manual/order.c  ./manual/palindrome.c  ./manual/palindrome.h  ./manual/refs.c  ./manual/returned.c  ./manual/rgb.c  ./manual/rstring.c  ./manual/rstring.h  ./manual/sample.c  ./manual/setChar.c  ./manual/setname.c  ./manual/setname.h  ./manual/special.c  ./manual/stack.c  ./manual/sumsquares.c  ./manual/switch.c  ./manual/testpal.c  ./manual/types.c  ./manual/unique.c  ./manual/usedef.c  ./manual/bounds.c
+                ./manual/annotglobs.c  ./manual/bool.c  ./manual/bool.h  ./manual/clauses.c  ./manual/employee.h  ./manual/exposure.c  ./manual/globals.c  ./manual/ignore.c  ./manual/implicit.c  ./manual/intSet.h  ./manual/list.c  ./manual/loop.c  ./manual/macros.c  ./manual/modify.c  ./manual/mstring.c  ./manual/mstring.h  ./manual/mstringnn.c  ./manual/multiError.c  ./manual/names.c  ./manual/noeffect.c  ./manual/null.c  ./manual/only.c  ./manual/order.c  ./manual/palindrome.c  ./manual/palindrome.h  ./manual/refs.c  ./manual/returned.c  ./manual/rgb.c  ./manual/rstring.c  ./manual/rstring.h  ./manual/sample.c  ./manual/setChar.c  ./manual/setname.c  ./manual/setname.h  ./manual/special.c  ./manual/stack.c  ./manual/sumsquares.c  ./manual/switch.c  ./manual/testpal.c  ./manual/types.c  ./manual/unique.c  ./manual/usedef.c  ./manual/bounds.c \
+                  arraydims.expect arraydims.c \
+                  stringliteral.expect  stringliteral.c
 
 subdir = test
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
@@ -1523,6 +1537,11 @@ stack:
 staticarray:
        -$(SPLINTR) staticarray.c -expect 3
 
+.PHONY: stringliteral
+stringliteral:
+       -$(SPLINTR) stringliteral.c +stringliteralnoroomfinalnull -expect 4
+       -$(SPLINTR) stringliteral.c -expect 3
+
 .PHONY: strings
 strings:
        -$(SPLINTR) strings.c -expect 3
index 05e68a0f7959ead7c29f08e7034197b2de8be4bc..469dd7178eb02c2577a0b8e71f3030595a04369d 100644 (file)
@@ -48,6 +48,7 @@ UNITTESTS = \
   returned sharing shifts slovaknames \
   specclauses \
   special stack staticarray strings \
+  stringliteral \
   structassign typequals ud ulstypes union unioninit unreachable unsignedcompare \
   unused ullint utypes void widestrings
 UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS))
@@ -726,6 +727,11 @@ stack:
 staticarray:
        -$(SPLINTR) staticarray.c -expect 3
 
+.PHONY: stringliteral
+stringliteral:
+       -$(SPLINTR) stringliteral.c +stringliteralnoroomfinalnull -expect 4
+       -$(SPLINTR) stringliteral.c -expect 3
+
 .PHONY: strings
 strings:
        -$(SPLINTR) strings.c -expect 3
@@ -1482,4 +1488,6 @@ EXTRA_DIST =  ./abst_t.lcl ./abst_t.lcs  \
                 functionmacro.expect functionmacro.c  info.c info.expect \
                 loopexec.c mergenull.c shifts.c \
                 manual.expect ./manual/Makefile \
-                ./manual/annotglobs.c  ./manual/bool.c  ./manual/bool.h  ./manual/clauses.c  ./manual/employee.h  ./manual/exposure.c  ./manual/globals.c  ./manual/ignore.c  ./manual/implicit.c  ./manual/intSet.h  ./manual/list.c  ./manual/loop.c  ./manual/macros.c  ./manual/modify.c  ./manual/mstring.c  ./manual/mstring.h  ./manual/mstringnn.c  ./manual/multiError.c  ./manual/names.c  ./manual/noeffect.c  ./manual/null.c  ./manual/only.c  ./manual/order.c  ./manual/palindrome.c  ./manual/palindrome.h  ./manual/refs.c  ./manual/returned.c  ./manual/rgb.c  ./manual/rstring.c  ./manual/rstring.h  ./manual/sample.c  ./manual/setChar.c  ./manual/setname.c  ./manual/setname.h  ./manual/special.c  ./manual/stack.c  ./manual/sumsquares.c  ./manual/switch.c  ./manual/testpal.c  ./manual/types.c  ./manual/unique.c  ./manual/usedef.c  ./manual/bounds.c
+                ./manual/annotglobs.c  ./manual/bool.c  ./manual/bool.h  ./manual/clauses.c  ./manual/employee.h  ./manual/exposure.c  ./manual/globals.c  ./manual/ignore.c  ./manual/implicit.c  ./manual/intSet.h  ./manual/list.c  ./manual/loop.c  ./manual/macros.c  ./manual/modify.c  ./manual/mstring.c  ./manual/mstring.h  ./manual/mstringnn.c  ./manual/multiError.c  ./manual/names.c  ./manual/noeffect.c  ./manual/null.c  ./manual/only.c  ./manual/order.c  ./manual/palindrome.c  ./manual/palindrome.h  ./manual/refs.c  ./manual/returned.c  ./manual/rgb.c  ./manual/rstring.c  ./manual/rstring.h  ./manual/sample.c  ./manual/setChar.c  ./manual/setname.c  ./manual/setname.h  ./manual/special.c  ./manual/stack.c  ./manual/sumsquares.c  ./manual/switch.c  ./manual/testpal.c  ./manual/types.c  ./manual/unique.c  ./manual/usedef.c  ./manual/bounds.c \
+                  arraydims.expect arraydims.c \
+                  stringliteral.expect  stringliteral.c
index a668c2d12c81cd89fbbc9b6b6d14415440048794..6f800101a267cd1011d81d44e4899a09b4e2d070 100644 (file)
@@ -61,18 +61,29 @@ host_alias = @host_alias@
 host_triplet = @host@
 target_alias = @target_alias@
 target_triplet = @target@
+AMTAR = @AMTAR@
+AWK = @AWK@
 BISON = @BISON@
 CAT = @CAT@
 CC = @CC@
 CP = @CP@
 CPP = @CPP@
+DEPDIR = @DEPDIR@
 DIFF = @DIFF@
+EXEEXT = @EXEEXT@
 GREP = @GREP@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LCLOBJ = @LCLOBJ@
 LEX = @LEX@
 LN_S = @LN_S@
 MV = @MV@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
 RM = @RM@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
 
 AUTOMAKE_OPTIONS = 1.5 foreign
 
@@ -114,6 +125,7 @@ UNITTESTS = \
   returned sharing shifts slovaknames \
   specclauses \
   special stack staticarray strings \
+  stringliteral \
   structassign typequals ud ulstypes union unioninit unreachable unsignedcompare \
   unused ullint utypes void widestrings
 
@@ -760,7 +772,9 @@ EXTRA_DIST = ./abst_t.lcl ./abst_t.lcs  \
                 functionmacro.expect functionmacro.c  info.c info.expect \
                 loopexec.c mergenull.c shifts.c \
                 manual.expect ./manual/Makefile \
-                ./manual/annotglobs.c  ./manual/bool.c  ./manual/bool.h  ./manual/clauses.c  ./manual/employee.h  ./manual/exposure.c  ./manual/globals.c  ./manual/ignore.c  ./manual/implicit.c  ./manual/intSet.h  ./manual/list.c  ./manual/loop.c  ./manual/macros.c  ./manual/modify.c  ./manual/mstring.c  ./manual/mstring.h  ./manual/mstringnn.c  ./manual/multiError.c  ./manual/names.c  ./manual/noeffect.c  ./manual/null.c  ./manual/only.c  ./manual/order.c  ./manual/palindrome.c  ./manual/palindrome.h  ./manual/refs.c  ./manual/returned.c  ./manual/rgb.c  ./manual/rstring.c  ./manual/rstring.h  ./manual/sample.c  ./manual/setChar.c  ./manual/setname.c  ./manual/setname.h  ./manual/special.c  ./manual/stack.c  ./manual/sumsquares.c  ./manual/switch.c  ./manual/testpal.c  ./manual/types.c  ./manual/unique.c  ./manual/usedef.c  ./manual/bounds.c
+                ./manual/annotglobs.c  ./manual/bool.c  ./manual/bool.h  ./manual/clauses.c  ./manual/employee.h  ./manual/exposure.c  ./manual/globals.c  ./manual/ignore.c  ./manual/implicit.c  ./manual/intSet.h  ./manual/list.c  ./manual/loop.c  ./manual/macros.c  ./manual/modify.c  ./manual/mstring.c  ./manual/mstring.h  ./manual/mstringnn.c  ./manual/multiError.c  ./manual/names.c  ./manual/noeffect.c  ./manual/null.c  ./manual/only.c  ./manual/order.c  ./manual/palindrome.c  ./manual/palindrome.h  ./manual/refs.c  ./manual/returned.c  ./manual/rgb.c  ./manual/rstring.c  ./manual/rstring.h  ./manual/sample.c  ./manual/setChar.c  ./manual/setname.c  ./manual/setname.h  ./manual/special.c  ./manual/stack.c  ./manual/sumsquares.c  ./manual/switch.c  ./manual/testpal.c  ./manual/types.c  ./manual/unique.c  ./manual/usedef.c  ./manual/bounds.c \
+                  arraydims.expect arraydims.c \
+                  stringliteral.expect  stringliteral.c
 
 subdir = test
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
@@ -1523,6 +1537,11 @@ stack:
 staticarray:
        -$(SPLINTR) staticarray.c -expect 3
 
+.PHONY: stringliteral
+stringliteral:
+       -$(SPLINTR) stringliteral.c +stringliteralnoroomfinalnull -expect 4
+       -$(SPLINTR) stringliteral.c -expect 3
+
 .PHONY: strings
 strings:
        -$(SPLINTR) strings.c -expect 3
index 903e8881674f4ceac0fbbc91fbe55ef9f8f9a0f8..cb73b87cd3df51c2a255c3940853207992ceddfb 100644 (file)
@@ -1,5 +1,5 @@
 ;;; Splint Library  null6.lcd
-;;Splint 3.0.1.4 --- 18 Jan 2002
+;;Splint 3.0.1.4 --- 19 Jan 2002
 ;;lib:298
 ;;ctTable
 0 u-2 19 38
diff --git a/test/stringliteral.c b/test/stringliteral.c
new file mode 100644 (file)
index 0000000..723ed92
--- /dev/null
@@ -0,0 +1,8 @@
+
+char buf[8] = "\000\000\000\000\000\000\000\000";
+char bufa[8] = "\000\000\000\000\000\000\000\001";
+char buf2[4] = "abcd";
+char buf3[4] = "ab\n";
+char buf4[4] = "\034\342\24";
+char buf5[4] = "abcdef";
+
diff --git a/test/stringliteral.expect b/test/stringliteral.expect
new file mode 100644 (file)
index 0000000..729b128
--- /dev/null
@@ -0,0 +1,22 @@
+
+stringliteral.c:2:15: String literal with 9 characters is assigned to char [8]
+    (no room for final null terminator): "\000\000\000\000\000\000\000\000"
+stringliteral.c:3:16: String literal with 9 characters is assigned to char [8]
+    (no room for null terminator): "\000\000\000\000\000\000\000\001"
+stringliteral.c:4:16: String literal with 5 characters is assigned to char [4]
+                         (no room for null terminator): "abcd"
+stringliteral.c:7:16: String literal with 7 characters (counting null
+    terminator) is assigned to char [4] (insufficient storage available):
+    "abcdef"
+
+Finished checking --- 4 code warnings, as expected
+
+stringliteral.c:3:16: String literal with 9 characters is assigned to char [8]
+    (no room for null terminator): "\000\000\000\000\000\000\000\001"
+stringliteral.c:4:16: String literal with 5 characters is assigned to char [4]
+                         (no room for null terminator): "abcd"
+stringliteral.c:7:16: String literal with 7 characters (counting null
+    terminator) is assigned to char [4] (insufficient storage available):
+    "abcdef"
+
+Finished checking --- 3 code warnings, as expected
index b2bb6efe1b0b04b65bba2143b248ce31ee870309..0a47c7945298312ff0631d0e1bedd7115b31cd2a 100644 (file)
@@ -1,5 +1,5 @@
 ;;; Splint Library  newlint.lcd
-;;Splint 3.0.1.4 --- 18 Jan 2002
+;;Splint 3.0.1.4 --- 19 Jan 2002
 ;;lib:298
 ;;ctTable
 0 u-2 19 38
This page took 0.257835 seconds and 5 git commands to generate.