From a469ccf0fcb67590e2954255f5dcc885d5689e60 Mon Sep 17 00:00:00 2001 From: evans1629 Date: Sun, 14 Oct 2001 16:28:43 +0000 Subject: [PATCH] Fixed test suite (temporarily) to run nested test cases --- src/Makefile | 9 ++ src/Makefile.am | 9 ++ src/Makefile.in | 9 ++ src/context.c | 11 +- src/cscanner.l | 2 + test/Makefile | 113 ++++++------------ test/Makefile.am | 118 +++++++------------ test/Makefile.in | 113 ++++++------------ test/bufferTest/test6.c | 7 -- test/buffertest.expect | 22 ++++ test/{bufferTest/test4.c => buffertest1.c} | 15 ++- test/db1.expect | 43 +------ test/db1/Makefile | 8 +- test/db1/bool.lcs | 2 +- test/db1/bool.lh | 2 +- test/db1/dbase.lcs | 2 +- test/db1/dbase.lh | 2 +- test/db1/employee.lcs | 2 +- test/db1/employee.lh | 2 +- test/db1/empset.lcs | 2 +- test/db1/empset.lh | 2 +- test/db1/erc.lcs | 2 +- test/db1/erc.lh | 2 +- test/db1/eref.lcs | 2 +- test/db1/eref.lh | 2 +- test/db1/ereftab.lcs | 2 +- test/db1/ereftab.lh | 2 +- test/db2.expect | 51 +-------- test/db2/Makefile | 6 +- test/db2/dbase.lcs | 2 +- test/db2/dbase.lh | 2 +- test/db2/employee.lcs | 2 +- test/db2/employee.lh | 2 +- test/db2/empset.lcs | 2 +- test/db2/empset.lh | 2 +- test/db2/erc.lcs | 2 +- test/db2/erc.lh | 2 +- test/db2/eref.lcs | 2 +- test/db2/eref.lh | 2 +- test/db2/ereftab.lcs | 2 +- test/db2/ereftab.lh | 2 +- test/db3/Makefile | 4 +- test/db3/bool.lcs | 2 +- test/db3/bool.lh | 2 +- test/db3/check.lcs | 2 +- test/db3/check.lh | 2 +- test/db3/dbase.lcs | 2 +- test/db3/dbase.lh | 2 +- test/db3/employee.lcs | 2 +- test/db3/employee.lh | 2 +- test/db3/empset.lcs | 2 +- test/db3/empset.lh | 2 +- test/db3/erc.lcs | 2 +- test/db3/erc.lh | 2 +- test/db3/eref.lcs | 2 +- test/db3/eref.lh | 2 +- test/db3/ereftab.lcs | 2 +- test/db3/ereftab.lh | 2 +- test/for.expect | 2 +- test/for/Makefile | 8 ++ test/globalbufferannotation/Makefile | 7 ++ test/maxset/Makefile | 7 ++ test/mergestate/Makefile | 9 ++ test/moreBufferTests.expect | 2 +- test/moreBufferTests/Makefile | 7 ++ test/simplebufferConstraintTests.expect | 2 +- test/simplebufferConstraintTests/.lclintrc | 2 - test/simplebufferConstraintTests/Makefile | 8 ++ test/sizeof.c | 9 ++ test/sizeof.expect | 9 ++ test/strchr.out | 7 ++ test/strchr/Makefile | 8 ++ test/temp/Makefile | 6 + test/tests2.2.out | 84 ++++++++++++++ test/tests2.2/bool.lcs | 2 +- test/tests2.2a.out | 120 +++++++++++++++++++ test/tests2.4.out | 127 +++++++++++++++++++++ test/tests2.4/Makefile | 25 ++-- test/tests2.4/subdir/main.lcs | 2 +- test/tests2.5.out | 53 +++++++++ test/tests2.5/newlint.lcd | 2 +- 81 files changed, 737 insertions(+), 395 deletions(-) delete mode 100644 test/bufferTest/test6.c create mode 100644 test/buffertest.expect rename test/{bufferTest/test4.c => buffertest1.c} (62%) create mode 100644 test/for/Makefile create mode 100644 test/globalbufferannotation/Makefile create mode 100644 test/maxset/Makefile create mode 100644 test/mergestate/Makefile create mode 100644 test/moreBufferTests/Makefile delete mode 100644 test/simplebufferConstraintTests/.lclintrc create mode 100644 test/simplebufferConstraintTests/Makefile create mode 100644 test/sizeof.c create mode 100644 test/sizeof.expect create mode 100644 test/strchr/Makefile create mode 100644 test/temp/Makefile diff --git a/src/Makefile b/src/Makefile index ca4bd0f..f150958 100644 --- a/src/Makefile +++ b/src/Makefile @@ -867,6 +867,15 @@ Headers/flag_codes.gen: flags.def nocheck: $(MAKE) CHECK=0 +.PHONY: test +test: + cd ../; ${MAKE} check + +### Automake generates wrong tags +.PHONY: etags +etags: + maketags + lintnew: ./lclint -f lclint.lclintrc $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(ALLSRC) $(LCLSRC) -dump lclint \ +forcehints -misplacedsharequal +showsourceloc -unrecogcomments \ diff --git a/src/Makefile.am b/src/Makefile.am index 4664976..55faba9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -185,6 +185,15 @@ CHECKS = $(subst .c,.check,$(lclint_SOURCES)) nocheck: $(MAKE) CHECK=0 +.PHONY: test +test: + cd ../; ${MAKE} check + +### Automake generates wrong tags +.PHONY: etags +etags: + maketags + lintnew: ./lclint -f lclint.lclintrc $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(ALLSRC) $(LCLSRC) -dump lclint \ +forcehints -misplacedsharequal +showsourceloc -unrecogcomments \ diff --git a/src/Makefile.in b/src/Makefile.in index 8285256..3465a08 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -867,6 +867,15 @@ Headers/flag_codes.gen: flags.def nocheck: $(MAKE) CHECK=0 +.PHONY: test +test: + cd ../; ${MAKE} check + +### Automake generates wrong tags +.PHONY: etags +etags: + maketags + lintnew: ./lclint -f lclint.lclintrc $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(ALLSRC) $(LCLSRC) -dump lclint \ +forcehints -misplacedsharequal +showsourceloc -unrecogcomments \ diff --git a/src/context.c b/src/context.c index b56ab4b..86b6af9 100644 --- a/src/context.c +++ b/src/context.c @@ -4432,8 +4432,15 @@ void context_checkGlobalScope (void) { if (gc.kind != CX_GLOBAL) { - llcontbug (message ("Not in global scope as expected: %q", context_unparse ())); - context_quietExitScopes (); + if (context_inMacro ()) + { + ; /* evans 2001-10-14: Okay to be in a macro here! */ + } + else + { + llcontbug (message ("Not in global scope as expected: %q", context_unparse ())); + context_quietExitScopes (); + } } } diff --git a/src/cscanner.l b/src/cscanner.l index 6930ccd..0050a7c 100644 --- a/src/cscanner.l +++ b/src/cscanner.l @@ -504,6 +504,8 @@ L'(\\.|[^\\'])+' { setTokLengthT (mstring_length (yytext)); if (processMacro ()) { + DPRINTF (("Here we are: %s", context_unparse ())); + if (context_inIterDef ()) { RETURN_TOK (LLMACROITER); diff --git a/test/Makefile b/test/Makefile index 8ddb190..ec85ce0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -87,6 +87,11 @@ AUTOMAKE_OPTIONS = 1.5 foreign DIFFFLAGS = -u LCLINT = $(top_builddir)/bin/lclint$(EXEEXT) + +### This is horrible! Can't we make top_builddir absolute? +LCLINTNEST = ../$(top_builddir)/bin/lclint$(EXEEXT) + +LCLINTPNEST = @$(LCLINTNEST) LCLINTP = @$(LCLINT) # Make sure .lclintrc files are not used so test results do not @@ -94,15 +99,23 @@ LCLINTP = @$(LCLINT) LCLINTRN = $(LCLINTP) -nof -hints -booltype "bool" LCLINTR = $(LCLINTRN) -exportlocal +debugfcnconstraint +LCLINTRNNEST = $(LCLINTPNEST) -nof -hints -booltype "bool" +LCLINTRNEST = $(LCLINTRNNEST) -exportlocal +debugfcnconstraint + ### ### !!! ### These tests have been temporarily removed because of problems with the new build process: -### fileio tainted mergestate metastate help sizeoftest bufferTest \ +### fileio tainted mergestate metastate \ ### tests2.2 tests2.2a tests2.4 tests2.5 -### simplebufferConstraintTests moreBufferTests globalbufferannotation \ +### ### maxset strchr for UNITTESTS = \ + help \ + fileio tainted mergestate metastate sizeof buffertest \ + tests2.2 tests2.2a tests2.4 tests2.5 \ + simplebufferConstraintTests moreBufferTests globalbufferannotation \ + maxset strchr for \ abstptr abstract alias alttypes ansireserved argorder \ args blocks break cases cast charlit clauses commentchar compdestroy \ constannot controldepth csyntax czechnames czechoslovaknames deadparam \ @@ -127,21 +140,15 @@ QUICKTESTS = db3 CLEANOUTPUT = $(GREP) -v "LCLint 3." | $(GREP) -v "$(LCLINT)" | $(GREP) -v "^make.*\[[1-9]*\]:" -#!!!! -# @echo "" -# @echo "Integration tests:" -# @echo "" -# @for TEST in $(INTEGTESTS); do \ -# echo "Checking $$TEST..."; \ -# $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ -# $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ -# echo "*** FAIL ***"; \ -# done +### Rules for tests start here ### ### Bugs fixed and new features since version 2.1b ### -SUBDIRTESTS = metastate mergestate tainted fileio warnuse ensuresclauses tests2.2 tests2.4 tests2.5 db1 db2 db3 +SUBDIRTESTS = metastate mergestate tainted fileio warnuse ensuresclauses \ + simplebufferConstraintTests moreBufferTests globalbufferannotation \ + maxset strchr for \ +tests2.2 tests2.2a tests2.4 tests2.5 db1 db2 db3 subdir = test mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h @@ -269,7 +276,7 @@ version: .PHONY: help help: -@$(LCLINTP) - -@LARCH_PATH=/dev/null $(LCLINTP) empty.lcl + -@LARCH_PATH=/dev/null; $(LCLINT) empty.lcl -@$(LCLINTP) -help -@$(LCLINTP) -asdf -@$(LCLINTP) +boolint +boolint @@ -329,6 +336,15 @@ fulltest: $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done + @echo "" + @echo "Integration tests:" + @echo "" + @for TEST in $(INTEGTESTS); do \ + echo "Checking $$TEST..."; \ + $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ + $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ + echo "*** FAIL ***"; \ + done .PHONY: abstptr abstptr: @@ -901,70 +917,17 @@ linked: freearray: ${LCLINTR} freearray.c -expect 1 -.PHONY: tests2.2a -tests2.2a: - @cd tests2.2a ; \ - $(LCLINTR) erik.c -expect 1 ; \ - $(LCLINTR) boolcomp.c -expect 5 ; \ - $(LCLINTR) boolenum.c ; \ - $(LCLINTR) addassign.c -expect 1; \ - $(LCLINTR) toralf.c -expect 5 ; \ - $(LCLINTR) fred.c -booltype Bool ; \ - $(LCLINTR) sizeof.c ; \ - $(LCLINTR) arrayparam.c -expect 5 ; \ - $(LCLINTR) notreached.c ; \ - $(LCLINTR) duff.c -casebreak -firstcase ; \ - $(LCLINTR) obviousloop.c -expect 4 ; \ - $(LCLINTR) bitops.c +bitwisesigned -expect 11 ; \ - $(LCLINTR) bitops.c -expect 5 ; \ - $(LCLINTR) isalpha.c +strictlib -expect 1 ; \ - $(LCLINTR) isalpha.c -expect 1 ; \ - $(LCLINTR) dobb.c ; \ - $(LCLINTR) popik.c -expect 11 - -.PHONY: sizeotest -sizeoftest: - @cd sizeoftest; \ - $(LCLINTR) +arraybounds +arrayboundsread sizeof.c - -.PHONY: bufferTest -bufferTest: - @cd bufferTest; \ - $(LCLINTR) +arraybounds +arrayboundsread test4.c test6.c - -.PHONY: simplebufferConstraintTests -simplebufferConstraintTests: - @cd simplebufferConstraintTests; \ - $(LCLINTR) +arraybounds +arrayboundsread m.c sizeof.c test3.c test7.c - -.PHONY: moreBufferTests -moreBufferTests: - @cd moreBufferTests; \ - $(LCLINTR) +arraybounds +arrayboundsread unrecogCall.c strrchr.c initialization.c simplifyTest.c strncatNotReallyGood.c strncatReallyGood.c - -.PHONY: maxset -maxset: - @cd maxset; \ - $(LCLINTR) +arraybounds maxsetannotations.c; \ - $(LCLINTR) +arraybounds maxsetnoannotations.c -expect 1 - -.PHONY: globalbufferannotation -globalbufferannotation: - @cd globalbufferannotation; \ - $(LCLINTR) +arraybounds +arrayboundsread globalvariable.c - -.PHONY: strchr -strchr: - @cd strchr; \ - $(LCLINTR) +arraybounds +arrayboundsread strchr.c -expect 2 - -.PHONY: for -for: - @cd for; $(LCLINTR) +arraybounds +arrayboundsread for.c +.PHONY: sizeof +sizeof: + $(LCLINTR) +arraybounds +arrayboundsread sizeof.c -expect 1 + +.PHONY: buffertest +buffertest: + $(LCLINTR) +arraybounds +arrayboundsread buffertest1.c -expect 5 .PHONY: $(SUBDIRTESTS) $(SUBDIRTESTS): - cd $@; $(MAKE) LCLINT="$(LCLINTRN)" + cd $@; $(MAKE) LCLINT="$(LCLINTRNNEST)" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/test/Makefile.am b/test/Makefile.am index 865bc0f..e453934 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -9,6 +9,11 @@ DIFFFLAGS = -u ## Set up the lclint commands LCLINT = $(top_builddir)/bin/lclint$(EXEEXT) + +### This is horrible! Can't we make top_builddir absolute? +LCLINTNEST = ../$(top_builddir)/bin/lclint$(EXEEXT) + +LCLINTPNEST = @$(LCLINTNEST) LCLINTP = @$(LCLINT) # Make sure .lclintrc files are not used so test results do not @@ -16,6 +21,9 @@ LCLINTP = @$(LCLINT) LCLINTRN = $(LCLINTP) -nof -hints -booltype "bool" LCLINTR = $(LCLINTRN) -exportlocal +debugfcnconstraint +LCLINTRNNEST = $(LCLINTPNEST) -nof -hints -booltype "bool" +LCLINTRNEST = $(LCLINTRNNEST) -exportlocal +debugfcnconstraint + ## Currently disabled tests: ## fileio tainted mergestate nullret nullassign warnuse metastate \ ## nullret nullassign warnuse @@ -23,12 +31,17 @@ LCLINTR = $(LCLINTRN) -exportlocal +debugfcnconstraint ### ### !!! ### These tests have been temporarily removed because of problems with the new build process: -### fileio tainted mergestate metastate help sizeoftest bufferTest \ +### fileio tainted mergestate metastate \ ### tests2.2 tests2.2a tests2.4 tests2.5 -### simplebufferConstraintTests moreBufferTests globalbufferannotation \ +### ### maxset strchr for UNITTESTS = \ + help \ + fileio tainted mergestate metastate sizeof buffertest \ + tests2.2 tests2.2a tests2.4 tests2.5 \ + simplebufferConstraintTests moreBufferTests globalbufferannotation \ + maxset strchr for \ abstptr abstract alias alttypes ansireserved argorder \ args blocks break cases cast charlit clauses commentchar compdestroy \ constannot controldepth csyntax czechnames czechoslovaknames deadparam \ @@ -59,7 +72,7 @@ version: .PHONY: help help: -@$(LCLINTP) - -@LARCH_PATH=/dev/null $(LCLINTP) empty.lcl + -@LARCH_PATH=/dev/null; $(LCLINT) empty.lcl -@$(LCLINTP) -help -@$(LCLINTP) -asdf -@$(LCLINTP) +boolint +boolint @@ -132,21 +145,21 @@ fulltest: $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done + @echo "" + @echo "Integration tests:" + @echo "" + @for TEST in $(INTEGTESTS); do \ + echo "Checking $$TEST..."; \ + $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ + $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ + echo "*** FAIL ***"; \ + done -#!!!! -# @echo "" -# @echo "Integration tests:" -# @echo "" -# @for TEST in $(INTEGTESTS); do \ -# echo "Checking $$TEST..."; \ -# $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ -# $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ -# echo "*** FAIL ***"; \ -# done - -## Rules for tests start here +### Rules for tests start here -SUBDIRTESTS = metastate mergestate tainted fileio warnuse ensuresclauses +SUBDIRTESTS = metastate mergestate tainted fileio warnuse ensuresclauses \ + simplebufferConstraintTests moreBufferTests globalbufferannotation \ + maxset strchr for .PHONY: abstptr abstptr: @@ -728,69 +741,16 @@ freearray: ### SUBDIRTESTS += tests2.2 - -.PHONY: tests2.2a -tests2.2a: - @cd tests2.2a ; \ - $(LCLINTR) erik.c -expect 1 ; \ - $(LCLINTR) boolcomp.c -expect 5 ; \ - $(LCLINTR) boolenum.c ; \ - $(LCLINTR) addassign.c -expect 1; \ - $(LCLINTR) toralf.c -expect 5 ; \ - $(LCLINTR) fred.c -booltype Bool ; \ - $(LCLINTR) sizeof.c ; \ - $(LCLINTR) arrayparam.c -expect 5 ; \ - $(LCLINTR) notreached.c ; \ - $(LCLINTR) duff.c -casebreak -firstcase ; \ - $(LCLINTR) obviousloop.c -expect 4 ; \ - $(LCLINTR) bitops.c +bitwisesigned -expect 11 ; \ - $(LCLINTR) bitops.c -expect 5 ; \ - $(LCLINTR) isalpha.c +strictlib -expect 1 ; \ - $(LCLINTR) isalpha.c -expect 1 ; \ - $(LCLINTR) dobb.c ; \ - $(LCLINTR) popik.c -expect 11 - +SUBDIRTESTS += tests2.2a SUBDIRTESTS += tests2.4 -.PHONY: sizeotest -sizeoftest: - @cd sizeoftest; \ - $(LCLINTR) +arraybounds +arrayboundsread sizeof.c - -.PHONY: bufferTest -bufferTest: - @cd bufferTest; \ - $(LCLINTR) +arraybounds +arrayboundsread test4.c test6.c - -.PHONY: simplebufferConstraintTests -simplebufferConstraintTests: - @cd simplebufferConstraintTests; \ - $(LCLINTR) +arraybounds +arrayboundsread m.c sizeof.c test3.c test7.c - -.PHONY: moreBufferTests -moreBufferTests: - @cd moreBufferTests; \ - $(LCLINTR) +arraybounds +arrayboundsread unrecogCall.c strrchr.c initialization.c simplifyTest.c strncatNotReallyGood.c strncatReallyGood.c - -.PHONY: maxset -maxset: - @cd maxset; \ - $(LCLINTR) +arraybounds maxsetannotations.c; \ - $(LCLINTR) +arraybounds maxsetnoannotations.c -expect 1 - -.PHONY: globalbufferannotation -globalbufferannotation: - @cd globalbufferannotation; \ - $(LCLINTR) +arraybounds +arrayboundsread globalvariable.c - -.PHONY: strchr -strchr: - @cd strchr; \ - $(LCLINTR) +arraybounds +arrayboundsread strchr.c -expect 2 - -.PHONY: for -for: - @cd for; $(LCLINTR) +arraybounds +arrayboundsread for.c +.PHONY: sizeof +sizeof: + $(LCLINTR) +arraybounds +arrayboundsread sizeof.c -expect 1 + +.PHONY: buffertest +buffertest: + $(LCLINTR) +arraybounds +arrayboundsread buffertest1.c -expect 5 SUBDIRTESTS += tests2.5 @@ -805,4 +765,6 @@ SUBDIRTESTS += db1 db2 db3 .PHONY: $(SUBDIRTESTS) $(SUBDIRTESTS): - cd $@; $(MAKE) LCLINT="$(LCLINTRN)" + cd $@; $(MAKE) LCLINT="$(LCLINTRNNEST)" + + diff --git a/test/Makefile.in b/test/Makefile.in index 805081c..fc57c7f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -87,6 +87,11 @@ AUTOMAKE_OPTIONS = 1.5 foreign DIFFFLAGS = -u LCLINT = $(top_builddir)/bin/lclint$(EXEEXT) + +### This is horrible! Can't we make top_builddir absolute? +LCLINTNEST = ../$(top_builddir)/bin/lclint$(EXEEXT) + +LCLINTPNEST = @$(LCLINTNEST) LCLINTP = @$(LCLINT) # Make sure .lclintrc files are not used so test results do not @@ -94,15 +99,23 @@ LCLINTP = @$(LCLINT) LCLINTRN = $(LCLINTP) -nof -hints -booltype "bool" LCLINTR = $(LCLINTRN) -exportlocal +debugfcnconstraint +LCLINTRNNEST = $(LCLINTPNEST) -nof -hints -booltype "bool" +LCLINTRNEST = $(LCLINTRNNEST) -exportlocal +debugfcnconstraint + ### ### !!! ### These tests have been temporarily removed because of problems with the new build process: -### fileio tainted mergestate metastate help sizeoftest bufferTest \ +### fileio tainted mergestate metastate \ ### tests2.2 tests2.2a tests2.4 tests2.5 -### simplebufferConstraintTests moreBufferTests globalbufferannotation \ +### ### maxset strchr for UNITTESTS = \ + help \ + fileio tainted mergestate metastate sizeof buffertest \ + tests2.2 tests2.2a tests2.4 tests2.5 \ + simplebufferConstraintTests moreBufferTests globalbufferannotation \ + maxset strchr for \ abstptr abstract alias alttypes ansireserved argorder \ args blocks break cases cast charlit clauses commentchar compdestroy \ constannot controldepth csyntax czechnames czechoslovaknames deadparam \ @@ -127,21 +140,15 @@ QUICKTESTS = db3 CLEANOUTPUT = $(GREP) -v "LCLint 3." | $(GREP) -v "$(LCLINT)" | $(GREP) -v "^make.*\[[1-9]*\]:" -#!!!! -# @echo "" -# @echo "Integration tests:" -# @echo "" -# @for TEST in $(INTEGTESTS); do \ -# echo "Checking $$TEST..."; \ -# $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ -# $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ -# echo "*** FAIL ***"; \ -# done +### Rules for tests start here ### ### Bugs fixed and new features since version 2.1b ### -SUBDIRTESTS = metastate mergestate tainted fileio warnuse ensuresclauses tests2.2 tests2.4 tests2.5 db1 db2 db3 +SUBDIRTESTS = metastate mergestate tainted fileio warnuse ensuresclauses \ + simplebufferConstraintTests moreBufferTests globalbufferannotation \ + maxset strchr for \ +tests2.2 tests2.2a tests2.4 tests2.5 db1 db2 db3 subdir = test mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h @@ -269,7 +276,7 @@ version: .PHONY: help help: -@$(LCLINTP) - -@LARCH_PATH=/dev/null $(LCLINTP) empty.lcl + -@LARCH_PATH=/dev/null; $(LCLINT) empty.lcl -@$(LCLINTP) -help -@$(LCLINTP) -asdf -@$(LCLINTP) +boolint +boolint @@ -329,6 +336,15 @@ fulltest: $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done + @echo "" + @echo "Integration tests:" + @echo "" + @for TEST in $(INTEGTESTS); do \ + echo "Checking $$TEST..."; \ + $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ + $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ + echo "*** FAIL ***"; \ + done .PHONY: abstptr abstptr: @@ -901,70 +917,17 @@ linked: freearray: ${LCLINTR} freearray.c -expect 1 -.PHONY: tests2.2a -tests2.2a: - @cd tests2.2a ; \ - $(LCLINTR) erik.c -expect 1 ; \ - $(LCLINTR) boolcomp.c -expect 5 ; \ - $(LCLINTR) boolenum.c ; \ - $(LCLINTR) addassign.c -expect 1; \ - $(LCLINTR) toralf.c -expect 5 ; \ - $(LCLINTR) fred.c -booltype Bool ; \ - $(LCLINTR) sizeof.c ; \ - $(LCLINTR) arrayparam.c -expect 5 ; \ - $(LCLINTR) notreached.c ; \ - $(LCLINTR) duff.c -casebreak -firstcase ; \ - $(LCLINTR) obviousloop.c -expect 4 ; \ - $(LCLINTR) bitops.c +bitwisesigned -expect 11 ; \ - $(LCLINTR) bitops.c -expect 5 ; \ - $(LCLINTR) isalpha.c +strictlib -expect 1 ; \ - $(LCLINTR) isalpha.c -expect 1 ; \ - $(LCLINTR) dobb.c ; \ - $(LCLINTR) popik.c -expect 11 - -.PHONY: sizeotest -sizeoftest: - @cd sizeoftest; \ - $(LCLINTR) +arraybounds +arrayboundsread sizeof.c - -.PHONY: bufferTest -bufferTest: - @cd bufferTest; \ - $(LCLINTR) +arraybounds +arrayboundsread test4.c test6.c - -.PHONY: simplebufferConstraintTests -simplebufferConstraintTests: - @cd simplebufferConstraintTests; \ - $(LCLINTR) +arraybounds +arrayboundsread m.c sizeof.c test3.c test7.c - -.PHONY: moreBufferTests -moreBufferTests: - @cd moreBufferTests; \ - $(LCLINTR) +arraybounds +arrayboundsread unrecogCall.c strrchr.c initialization.c simplifyTest.c strncatNotReallyGood.c strncatReallyGood.c - -.PHONY: maxset -maxset: - @cd maxset; \ - $(LCLINTR) +arraybounds maxsetannotations.c; \ - $(LCLINTR) +arraybounds maxsetnoannotations.c -expect 1 - -.PHONY: globalbufferannotation -globalbufferannotation: - @cd globalbufferannotation; \ - $(LCLINTR) +arraybounds +arrayboundsread globalvariable.c - -.PHONY: strchr -strchr: - @cd strchr; \ - $(LCLINTR) +arraybounds +arrayboundsread strchr.c -expect 2 - -.PHONY: for -for: - @cd for; $(LCLINTR) +arraybounds +arrayboundsread for.c +.PHONY: sizeof +sizeof: + $(LCLINTR) +arraybounds +arrayboundsread sizeof.c -expect 1 + +.PHONY: buffertest +buffertest: + $(LCLINTR) +arraybounds +arrayboundsread buffertest1.c -expect 5 .PHONY: $(SUBDIRTESTS) $(SUBDIRTESTS): - cd $@; $(MAKE) LCLINT="$(LCLINTRN)" + cd $@; $(MAKE) LCLINT="$(LCLINTRNNEST)" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/test/bufferTest/test6.c b/test/bufferTest/test6.c deleted file mode 100644 index 25d8193..0000000 --- a/test/bufferTest/test6.c +++ /dev/null @@ -1,7 +0,0 @@ - -void t() -{ - char *g; - g++; - g[0] = g[1]; -} diff --git a/test/buffertest.expect b/test/buffertest.expect new file mode 100644 index 0000000..a22a2cb --- /dev/null +++ b/test/buffertest.expect @@ -0,0 +1,22 @@ + +buffertest1.c: (in function t1) +buffertest1.c:5:3: Variable g used before definition +buffertest1.c:5:3: Possible out-of-bounds store: + Unable to resolve constraint: + requires maxSet(g @ buffertest1.c:5:3) >= 100 + needed to satisfy precondition: + requires maxSet(g @ buffertest1.c:5:3) >= 100 +buffertest1.c: (in function t2) +buffertest1.c:20:3: Variable g used before definition +buffertest1.c:21:3: Possible out-of-bounds store: + Unable to resolve constraint: + requires maxSet(g @ buffertest1.c:20:3) >= 1 + needed to satisfy precondition: + requires maxSet(g @ buffertest1.c:21:3) >= 0 +buffertest1.c:21:10: Possible out-of-bounds read: + Unable to resolve constraint: + requires maxRead(g @ buffertest1.c:20:3) >= 2 + needed to satisfy precondition: + requires maxRead(g @ buffertest1.c:21:10) >= 1 + +Finished LCLint checking --- 5 code errors found, as expected diff --git a/test/bufferTest/test4.c b/test/buffertest1.c similarity index 62% rename from test/bufferTest/test4.c rename to test/buffertest1.c index fbcfb56..ea8e7bc 100644 --- a/test/bufferTest/test4.c +++ b/test/buffertest1.c @@ -1,15 +1,22 @@ - -void t() +void t1 (void) { char *g; - + g[100] = 'f'; + { g++; - + g[0] = '1'; g[67] = g[70]; g[98] = g[99]; g[90] = g[3]; } } + +void t2 (void) +{ + char *g; + g++; + g[0] = g[1]; +} diff --git a/test/db1.expect b/test/db1.expect index 53268da..c0f7a5d 100644 --- a/test/db1.expect +++ b/test/db1.expect @@ -1,18 +1,9 @@ +make -e clean +make -e check -< reading spec bool.lcl > -< reading spec employee.lcl > -< reading spec eref.lcl > -< reading spec empset.lcl > -< reading spec ereftab.lcl > -< reading spec erc.lcl > -< reading spec dbase.lcl > -< preprocessing > -< checking employee.c > employee.c: (in function employee_equal) employee.c:25: Function strncmp expects arg 3 to be size_t gets int: maxEmployeeName -< checking eref.c > -< checking empset.c > empset.c: (in function empset_insert) empset.c:28: Variable er declared but not used empset.c: (in function empset_disjointUnion) @@ -29,11 +20,9 @@ empset.c: (in function empset_subset) empset.c:139: Undocumented modification of s1 possible from call to erc_iterStart: erc_iterStart(s1) empset.c:135: Variable e declared but not used -< checking ereftab.c > ereftab.c: (in function ereftab_lookup) ereftab.c:34: Undocumented modification of t possible from call to erc_iterStart: erc_iterStart(t) -< checking erc.c > erc.c: (in function erc_member) erc.c:47: Operands of == are abstract type (eref): tmpc->val == er erc.c: (in function erc_delete) @@ -43,48 +32,29 @@ erc.c:141: Function malloc expects arg 1 to be size_t gets int: erc_size(c) * (employeePrintSize + 1) + 1 erc.c:151: Undocumented modification of c possible from call to erc_iterStart: erc_iterStart(c) -< checking dbase.c > dbase.c: (in function query) dbase.c:210: Variable er declared but not used dbase.c:211: Variable e declared but not used -< checking drive.c > drive.c: (in function main) drive.c:123: Return value (type db_status) ignored: hire(e) -< checking macros bool.h > -< global checks > -< cleaning .......... > Finished LCLint checking --- 16 code errors found, as expected -< reading spec bool.lcl > -< reading spec employee.lcl > -< reading spec eref.lcl > -< reading spec empset.lcl > -< reading spec ereftab.lcl > -< reading spec erc.lcl > -< reading spec dbase.lcl > -< preprocessing > employee.h:2: Name EMPLOYEE_H is reserved for future ANSI library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (See ANSI, Section 4.13.1) -< more preprocessing . > eref.h:2: Name EREF_H is reserved for future ANSI library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (See ANSI, Section 4.13.1) -< more preprocessing . > empset.h:2: Name EMPSET_H is reserved for future ANSI library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (See ANSI, Section 4.13.1) -< more preprocessing . > erc.h:2: Name ERC_H is reserved for future ANSI library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (See ANSI, Section 4.13.1) -< more preprocessing . > ereftab.h:4: Name EREFTAB_H is reserved for future ANSI library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (See ANSI, Section 4.13.1) -< more preprocessing . > -< checking employee.c > bool.h:20: Modifies list for bool_initMod uses global internal state, not included in globals list. bool.h:20: Declaration of bool_initMod @@ -121,7 +91,6 @@ employee.h:14: Called procedure bool_initMod may access internal state, but globals list does not include globals internalState employee.h:14: Undocumented modification of internal state possible from call to bool_initMod: bool_initMod() -< checking eref.c > eref.h:9: Constant exported, but not specified: used eref.h:9: Constant exported, but not specified: avail eref.h:9: Type exported, but not specified: eref_status @@ -215,7 +184,6 @@ eref.h:25: Undocumented use of global eref_Pool eref.h: (in macro eref_equal) eref.h:26: Macro parameter used without parentheses: er1 eref.h:26: Macro parameter used without parentheses: er2 -< checking empset.c > erc.h:6: Name _elem is in the implementation name space (any identifier beginning with underscore) erc.h:6: Type exported, but not specified: ercElem @@ -284,7 +252,6 @@ empset.c:156: Undocumented modification of initDone: initDone = TRUE empset.h: (in macro empset_member) empset.h:30: Undetected modification possible from call to unconstrained function _empset_get: _empset_get -< checking ereftab.c > ereftab.c: (in function ereftab_delete) ereftab.c:24: Return value (type bool) ignored: erc_delete(t, er) ereftab.c: (in function ereftab_lookup) @@ -293,7 +260,6 @@ ereftab.c:34: Undocumented modification of t possible from call to ereftab.c:37: Body of if statement is not a block: return er ereftab.c: (in function ereftab_initMod) ereftab.c:47: Statement has no effect: erc_initMod() -< checking erc.c > erc.c: (in function erc_create) erc.c:8: Parameter to sizeof is type ercInfo: sizeof(ercInfo) erc.c:13: Argument to exit has implementation defined behavior: 1 @@ -358,7 +324,6 @@ erc.h: (in macro erc_iterFinal) erc.h:20: Only storage *it->next (type struct _elem *) derived from released storage is not released (memory leak): it erc.h:20: Implicitly temp storage it passed as only param: free (it) -< checking dbase.c > dbase.c: (in function db_initMod) dbase.c:21: Undocumented use of global initDone dbase.c:27: Statement has no effect: employee_initMod() @@ -572,7 +537,6 @@ dbase.c:272: Operands of <= have incompatible types (int, enum { mMGRS, fMGRS, dbase.c:274: Undocumented use of global db dbase.c:272: Incompatible types for <= (int, enum { mMGRS, fMGRS, mNON, fNON }) (in post loop test): i <= fNON -< checking drive.c > drive.c: (in function main) drive.c:22: Statement has no effect: employee_initMod() drive.c:23: Statement has no effect: empset_initMod() @@ -594,8 +558,6 @@ drive.c:131: Variable j used before definition drive.c:134: Return value (type bool) ignored: fire(17) drive.c:158: Return value (type bool) ignored: fire(empset_choo... drive.c:11: Parameter argv not used -< checking macros bool.h > -< global checks > dbase.c:11: Type employeeKinds declared but not used eref.lh:8: Function exported but not used outside eref: eref_free eref.h:23: Definition of eref_free @@ -635,7 +597,6 @@ dbase.c:56: Function _db_keyGet exported but not declared in header file dbase.c:71: Definition of _db_keyGet dbase.c:73: Function _db_addEmpls exported but not declared in header file dbase.c:92: Definition of _db_addEmpls -< cleaning .......... > Error Type Reported Suppressed =================== ======== ========= diff --git a/test/db1/Makefile b/test/db1/Makefile index 98bf187..8a669cb 100644 --- a/test/db1/Makefile +++ b/test/db1/Makefile @@ -21,9 +21,13 @@ test: $(MAKE) -e clean $(MAKE) -e check +### +### Removed +showscan, produces different results on different platforms +### + check: $(LCSFILES) - $(LCLINT) -showcol -weak +showscan $(MODULES) -expect 16 - $(LCLINT) -showcol +strict -modfilesystem +showscan +showsummary $(MODULES) -expect 333 + $(LCLINT) -showcol -weak $(MODULES) -expect 16 + $(LCLINT) -showcol +strict -modfilesystem +showsummary $(MODULES) -expect 333 ### The following rules generate .lh and .lcs files from .lcl files. They also ### ensure that .h files appear to be updated whenever the corresponding .lh diff --git a/test/db1/bool.lcs b/test/db1/bool.lcs index aa00457..108f13a 100644 --- a/test/db1/bool.lcs +++ b/test/db1/bool.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/bool.lh b/test/db1/bool.lh index 46f708b..0d734e0 100644 --- a/test/db1/bool.lh +++ b/test/db1/bool.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" diff --git a/test/db1/dbase.lcs b/test/db1/dbase.lcs index 0a289ea..7105f28 100644 --- a/test/db1/dbase.lcs +++ b/test/db1/dbase.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/dbase.lh b/test/db1/dbase.lh index 0de4c65..91057d3 100644 --- a/test/db1/dbase.lh +++ b/test/db1/dbase.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include # include "bool.h" diff --git a/test/db1/employee.lcs b/test/db1/employee.lcs index b1cdb11..2dea5b7 100644 --- a/test/db1/employee.lcs +++ b/test/db1/employee.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/employee.lh b/test/db1/employee.lh index 162f21c..2596a4b 100644 --- a/test/db1/employee.lh +++ b/test/db1/employee.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "bool.h" diff --git a/test/db1/empset.lcs b/test/db1/empset.lcs index 8f59b9a..7763798 100644 --- a/test/db1/empset.lcs +++ b/test/db1/empset.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/empset.lh b/test/db1/empset.lh index ea46f68..a6dce41 100644 --- a/test/db1/empset.lh +++ b/test/db1/empset.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db1/erc.lcs b/test/db1/erc.lcs index 003c0d8..1621fdd 100644 --- a/test/db1/erc.lcs +++ b/test/db1/erc.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/erc.lh b/test/db1/erc.lh index 803d15c..1bee6f4 100644 --- a/test/db1/erc.lh +++ b/test/db1/erc.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "eref.h" diff --git a/test/db1/eref.lcs b/test/db1/eref.lcs index 44d37e6..d4ef78b 100644 --- a/test/db1/eref.lcs +++ b/test/db1/eref.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/eref.lh b/test/db1/eref.lh index f95ecda..23d5ac2 100644 --- a/test/db1/eref.lh +++ b/test/db1/eref.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db1/ereftab.lcs b/test/db1/ereftab.lcs index 13576cb..396f7f8 100644 --- a/test/db1/ereftab.lcs +++ b/test/db1/ereftab.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db1/ereftab.lh b/test/db1/ereftab.lh index 6869900..24ba6cb 100644 --- a/test/db1/ereftab.lh +++ b/test/db1/ereftab.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db2.expect b/test/db2.expect index 4593bd5..285099f 100644 --- a/test/db2.expect +++ b/test/db2.expect @@ -1,16 +1,9 @@ +make -e clean +make -e check -< reading spec employee.lcl > -< reading spec eref.lcl > -< reading spec empset.lcl > -< reading spec ereftab.lcl > -< reading spec erc.lcl > -< reading spec dbase.lcl > -< preprocessing > -< checking employee.c > employee.c: (in function employee_setName) employee.c:17: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) -< checking eref.c > eref.c: (in function eref_alloc) eref.c:19: Unqualified storage eref_Pool.conts passed as only param: realloc (eref_Pool.conts, ...) @@ -33,9 +26,6 @@ eref.c:84: Storage eref_Pool.status reachable from global is fresh (should be eref.c:70: Fresh storage eref_Pool.status allocated eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status -< checking empset.c > -< checking ereftab.c > -< checking erc.c > erc.c: (in function erc_create) erc.c:33: Null storage c->vals derivable from return value: c erc.c:31: Storage c->vals becomes null @@ -52,25 +42,12 @@ erc.c:102: Released storage c->vals reachable from parameter at return point erc.c: (in function erc_sprint) erc.c:141: Fresh storage returned as unqualified (should be only): result erc.c:122: Fresh storage result allocated -< checking dbase.c > -< checking drive.c > -< checking macros bool.h > -< global checks > Finished LCLint checking --- 15 code errors found, as expected -< reading spec employee.lcl > -< reading spec eref.lcl > -< reading spec empset.lcl > -< reading spec ereftab.lcl > -< reading spec erc.lcl > -< reading spec dbase.lcl > -< preprocessing > -< checking employee.c > employee.c: (in function employee_setName) employee.c:17: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) -< checking eref.c > eref.c: (in function eref_initMod) eref.c:62: Implicitly only storage eref_Pool.conts (type employee *) not released before assignment: eref_Pool.conts = (employee *)malloc(size * @@ -82,12 +59,9 @@ eref.c:84: Global storage *(eref_Pool.conts) contains 5 undefined fields when call returns: ssNum, name, salary, gen, j eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status -< checking empset.c > empset.c: (in function empset_intersect) empset.c:126: Fresh storage toDelete not released before return empset.c:112: Fresh storage toDelete allocated -< checking ereftab.c > -< checking erc.c > erc.c: (in function erc_create) erc.c:33: Null storage c->vals derivable from return value: c erc.c:31: Storage c->vals becomes null @@ -104,8 +78,6 @@ erc.c:98: Clauses exit with elem referencing implicitly only storage in true erc.c:96: Storage elem becomes implicitly only erc.c:102: Released storage c->vals reachable from parameter at return point erc.c:100: Storage c->vals is released -< checking dbase.c > -< checking drive.c > drive.c: (in function main) drive.c:49: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" @@ -136,26 +108,7 @@ drive.c:163: Fresh storage em2 not released before return drive.c:146: Fresh storage em2 allocated drive.c:163: Fresh storage em3 not released before return drive.c:147: Fresh storage em3 allocated -< checking macros bool.h > -< global checks > Finished LCLint checking --- 25 code errors found, as expected -< reading spec employee.lcl > -< reading spec eref.lcl > -< reading spec empset.lcl > -< reading spec ereftab.lcl > -< reading spec erc.lcl > -< reading spec dbase.lcl > -< preprocessing > -< checking employee.c > -< checking eref.c > -< checking empset.c > -< checking ereftab.c > -< checking erc.c > -< checking dbase.c > -< checking drive.c > -< checking macros bool.h > -< global checks > - Finished LCLint checking --- no code errors found diff --git a/test/db2/Makefile b/test/db2/Makefile index d5a5dcf..0d8a46e 100644 --- a/test/db2/Makefile +++ b/test/db2/Makefile @@ -22,9 +22,9 @@ test: $(MAKE) -e check check: $(LCSFILES) - $(LCLINT) -exportlocal -showcol -allimponly -macrovarprefixexclude +showscan $(MODULES) -expect 15 - $(LCLINT) -exportlocal -showcol +allimponly +showscan $(MODULES) -expect 25 - $(LCLINT) -exportlocal -showcol -memchecks -macrovarprefixexclude +showscan $(MODULES) + $(LCLINT) -exportlocal -showcol -allimponly -macrovarprefixexclude $(MODULES) -expect 15 + $(LCLINT) -exportlocal -showcol +allimponly $(MODULES) -expect 25 + $(LCLINT) -exportlocal -showcol -memchecks -macrovarprefixexclude $(MODULES) ### The following rules generate .lh and .lcs files from .lcl files. They also ### ensure that .h files appear to be updated whenever the corresponding .lh diff --git a/test/db2/dbase.lcs b/test/db2/dbase.lcs index 916e7cf..d5c4801 100644 --- a/test/db2/dbase.lcs +++ b/test/db2/dbase.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db2/dbase.lh b/test/db2/dbase.lh index 0de4c65..91057d3 100644 --- a/test/db2/dbase.lh +++ b/test/db2/dbase.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include # include "bool.h" diff --git a/test/db2/employee.lcs b/test/db2/employee.lcs index 25b2707..377a221 100644 --- a/test/db2/employee.lcs +++ b/test/db2/employee.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db2/employee.lh b/test/db2/employee.lh index 384da0d..0578654 100644 --- a/test/db2/employee.lh +++ b/test/db2/employee.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include # include "bool.h" diff --git a/test/db2/empset.lcs b/test/db2/empset.lcs index 4e0180f..5bd5246 100644 --- a/test/db2/empset.lcs +++ b/test/db2/empset.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db2/empset.lh b/test/db2/empset.lh index a6c35ac..b88ed31 100644 --- a/test/db2/empset.lh +++ b/test/db2/empset.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db2/erc.lcs b/test/db2/erc.lcs index 8288c8f..6003ab0 100644 --- a/test/db2/erc.lcs +++ b/test/db2/erc.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db2/erc.lh b/test/db2/erc.lh index d552f84..73ec2b2 100644 --- a/test/db2/erc.lh +++ b/test/db2/erc.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "eref.h" diff --git a/test/db2/eref.lcs b/test/db2/eref.lcs index 50b3d06..d5ae4dc 100644 --- a/test/db2/eref.lcs +++ b/test/db2/eref.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db2/eref.lh b/test/db2/eref.lh index f95ecda..23d5ac2 100644 --- a/test/db2/eref.lh +++ b/test/db2/eref.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db2/ereftab.lcs b/test/db2/ereftab.lcs index bae7369..a866c4a 100644 --- a/test/db2/ereftab.lcs +++ b/test/db2/ereftab.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db2/ereftab.lh b/test/db2/ereftab.lh index 6869900..24ba6cb 100644 --- a/test/db2/ereftab.lh +++ b/test/db2/ereftab.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db3/Makefile b/test/db3/Makefile index 625dc74..dc5a62a 100644 --- a/test/db3/Makefile +++ b/test/db3/Makefile @@ -18,8 +18,8 @@ MODULES = employee eref empset ereftab erc dbase drive.c bool.lcl check.lcl OBJS = dbase.o employee.o empset.o erc.o eref.o ereftab.o test: - $(MAKE) -e clean - $(MAKE) -e check + @$(MAKE) -e clean + @$(MAKE) -e check ### Note there is a .lclint file used for checking! diff --git a/test/db3/bool.lcs b/test/db3/bool.lcs index 61e9652..d29c219 100644 --- a/test/db3/bool.lcs +++ b/test/db3/bool.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/bool.lh b/test/db3/bool.lh index 4b29f2c..ab2d650 100644 --- a/test/db3/bool.lh +++ b/test/db3/bool.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" diff --git a/test/db3/check.lcs b/test/db3/check.lcs index b8a8387..024f3d7 100644 --- a/test/db3/check.lcs +++ b/test/db3/check.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/check.lh b/test/db3/check.lh index 90745ca..34be20a 100644 --- a/test/db3/check.lh +++ b/test/db3/check.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "bool.h" diff --git a/test/db3/dbase.lcs b/test/db3/dbase.lcs index 64a029c..8474971 100644 --- a/test/db3/dbase.lcs +++ b/test/db3/dbase.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/dbase.lh b/test/db3/dbase.lh index 381f1c3..a031c4e 100644 --- a/test/db3/dbase.lh +++ b/test/db3/dbase.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include # include "bool.h" diff --git a/test/db3/employee.lcs b/test/db3/employee.lcs index 4398d1a..6238fd0 100644 --- a/test/db3/employee.lcs +++ b/test/db3/employee.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/employee.lh b/test/db3/employee.lh index 363889a..85fadfa 100644 --- a/test/db3/employee.lh +++ b/test/db3/employee.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include # include "bool.h" diff --git a/test/db3/empset.lcs b/test/db3/empset.lcs index eee6f52..0466e9b 100644 --- a/test/db3/empset.lcs +++ b/test/db3/empset.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/empset.lh b/test/db3/empset.lh index 9883fed..881e60d 100644 --- a/test/db3/empset.lh +++ b/test/db3/empset.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db3/erc.lcs b/test/db3/erc.lcs index 7ffa8ad..2539472 100644 --- a/test/db3/erc.lcs +++ b/test/db3/erc.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/erc.lh b/test/db3/erc.lh index ad5f93c..6340e71 100644 --- a/test/db3/erc.lh +++ b/test/db3/erc.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "eref.h" diff --git a/test/db3/eref.lcs b/test/db3/eref.lcs index f42a8b9..5c44047 100644 --- a/test/db3/eref.lcs +++ b/test/db3/eref.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/eref.lh b/test/db3/eref.lh index eefa37a..d0a3df5 100644 --- a/test/db3/eref.lh +++ b/test/db3/eref.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/db3/ereftab.lcs b/test/db3/ereftab.lcs index 935ceba..ab602a9 100644 --- a/test/db3/ereftab.lcs +++ b/test/db3/ereftab.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/db3/ereftab.lh b/test/db3/ereftab.lh index 47fa306..4c39286 100644 --- a/test/db3/ereftab.lh +++ b/test/db3/ereftab.lh @@ -1,4 +1,4 @@ -/* Output from LCLint 3.0.0.18 */ +/* Output from LCLint 3.0.0.19 */ # include "bool.h" # include "employee.h" diff --git a/test/for.expect b/test/for.expect index 9fc3231..49c9688 100644 --- a/test/for.expect +++ b/test/for.expect @@ -6,4 +6,4 @@ for.c:13:5: Possible out-of-bounds store: needed to satisfy precondition: requires maxSet(t @ for.c:13:5) >= i @ for.c:13:7 -Finished LCLint checking --- 1 code error found +Finished LCLint checking --- 1 code error found, as expected diff --git a/test/for/Makefile b/test/for/Makefile new file mode 100644 index 0000000..a693282 --- /dev/null +++ b/test/for/Makefile @@ -0,0 +1,8 @@ +.PHONY: check + +LCLINT = lclint -exportlocal + +check: + $(LCLINT) +arraybounds +arrayboundsread for.c -expect 1 + + diff --git a/test/globalbufferannotation/Makefile b/test/globalbufferannotation/Makefile new file mode 100644 index 0000000..307ce12 --- /dev/null +++ b/test/globalbufferannotation/Makefile @@ -0,0 +1,7 @@ +.PHONY: check + +LCLINT = lclint -exportlocal + +check: + $(LCLINT) +arraybounds +arrayboundsread globalvariable.c + diff --git a/test/maxset/Makefile b/test/maxset/Makefile new file mode 100644 index 0000000..9ed022b --- /dev/null +++ b/test/maxset/Makefile @@ -0,0 +1,7 @@ +.PHONY: check + +LCLINT = lclint -exportlocal + +check: + $(LCLINT) +arraybounds maxsetannotations.c + $(LCLINT) +arraybounds maxsetnoannotations.c -expect 1 diff --git a/test/mergestate/Makefile b/test/mergestate/Makefile new file mode 100644 index 0000000..93fd50d --- /dev/null +++ b/test/mergestate/Makefile @@ -0,0 +1,9 @@ +.PHONY: tainted + +LCLINT = lclint + +all: tainted + +tainted: + ${LCLINT} -mts taintednm taintednm.c -mustfree -exportlocal -expect 2 + ${LCLINT} -mts tainted taintednm.c -mustfree -exportlocal -expect 4 diff --git a/test/moreBufferTests.expect b/test/moreBufferTests.expect index e92fa95..30c4d6e 100644 --- a/test/moreBufferTests.expect +++ b/test/moreBufferTests.expect @@ -37,4 +37,4 @@ strncatNotReallyGood.c:4:21: Possible out-of-bounds store: derived from strncat precondition: requires maxSet() >= maxRead() + -Finished LCLint checking --- 8 code errors found +Finished LCLint checking --- 8 code errors found, as expected diff --git a/test/moreBufferTests/Makefile b/test/moreBufferTests/Makefile new file mode 100644 index 0000000..e1de558 --- /dev/null +++ b/test/moreBufferTests/Makefile @@ -0,0 +1,7 @@ +.PHONY: check + +LCLINT = lclint + +check: + $(LCLINT) -exportlocal +arraybounds +arrayboundsread unrecogCall.c strrchr.c initialization.c simplifyTest.c strncatNotReallyGood.c strncatReallyGood.c -expect 8 + diff --git a/test/simplebufferConstraintTests.expect b/test/simplebufferConstraintTests.expect index 4e51de9..f2d6a89 100644 --- a/test/simplebufferConstraintTests.expect +++ b/test/simplebufferConstraintTests.expect @@ -30,4 +30,4 @@ test7.c:8:3: Possible out-of-bounds store: needed to satisfy precondition: requires maxSet(j @ test7.c:8:3) >= 0 -Finished LCLint checking --- 7 code errors found +Finished LCLint checking --- 7 code errors found, as expected diff --git a/test/simplebufferConstraintTests/.lclintrc b/test/simplebufferConstraintTests/.lclintrc deleted file mode 100644 index ad3770a..0000000 --- a/test/simplebufferConstraintTests/.lclintrc +++ /dev/null @@ -1,2 +0,0 @@ --no-lib -+fcnpost diff --git a/test/simplebufferConstraintTests/Makefile b/test/simplebufferConstraintTests/Makefile new file mode 100644 index 0000000..fc93a61 --- /dev/null +++ b/test/simplebufferConstraintTests/Makefile @@ -0,0 +1,8 @@ +.PHONY: check + +LCLINT = lclint -exportlocal + +check: + $(LCLINT) +arraybounds +arrayboundsread m.c sizeof.c test3.c test7.c -expect 7 + + diff --git a/test/sizeof.c b/test/sizeof.c new file mode 100644 index 0000000..671ddc0 --- /dev/null +++ b/test/sizeof.c @@ -0,0 +1,9 @@ +int main() +{ + char x[3]; + char y[3]; + + x[(sizeof x)] = 'i'; + y[((sizeof y) - 1)] = '0'; + return 0; +} diff --git a/test/sizeof.expect b/test/sizeof.expect new file mode 100644 index 0000000..ca3463d --- /dev/null +++ b/test/sizeof.expect @@ -0,0 +1,9 @@ + +sizeof.c: (in function main) +sizeof.c:6:3: Possible out-of-bounds store: + Unable to resolve constraint: + requires 2 >= 3 + needed to satisfy precondition: + requires maxSet(x @ sizeof.c:6:3) >= 3 + +Finished LCLint checking --- 1 code error found, as expected diff --git a/test/strchr.out b/test/strchr.out index e69de29..5a3bf3c 100644 --- a/test/strchr.out +++ b/test/strchr.out @@ -0,0 +1,7 @@ + +strchr.c: (in function func) +strchr.c:6:4: Dereference of possibly null pointer c: *c + strchr.c:5:7: Storage c may become null +strchr.c:6:3: Suspect modification of observer c: *c = 'd' + +Finished LCLint checking --- 2 code errors found, as expected diff --git a/test/strchr/Makefile b/test/strchr/Makefile new file mode 100644 index 0000000..b92ee0e --- /dev/null +++ b/test/strchr/Makefile @@ -0,0 +1,8 @@ +.PHONY: check + +LCLINT = lclint -exportlocal + +check: + $(LCLINT) +arraybounds +arrayboundsread strchr.c -expect 2 + + diff --git a/test/temp/Makefile b/test/temp/Makefile new file mode 100644 index 0000000..f9a0757 --- /dev/null +++ b/test/temp/Makefile @@ -0,0 +1,6 @@ +all: + gcc prg.c a.c b.c + +lint: + lclint prg.c a.c b.c + diff --git a/test/tests2.2.out b/test/tests2.2.out index e69de29..49ce385 100644 --- a/test/tests2.2.out +++ b/test/tests2.2.out @@ -0,0 +1,84 @@ + +boolops.c: (in function main) +boolops.c:12:3: Assignment of int to Kzam: b = 12 + +Finished LCLint checking --- 1 code error found, as expected + +mbool.h:1:17: Type implemented as macro: bool + +Finished LCLint checking --- 1 code error found, as expected + +boolenum.c: (in function main) +boolenum.c:11:8: Use of == with BOOLEAN variables (risks inconsistency because + of multiple true values): a == TRUE + +Finished LCLint checking --- 1 code error found, as expected + +break.c: (in function f) +break.c:9:4: Dereference of possibly null pointer x: *x + break.c:1:24: Storage x may become null + +Finished LCLint checking --- 1 code error found, as expected + +bstring.c:4:14: Initial value of s4[0] is type char *, expects char: "hullo" +bstring.c:4:23: Initial value of s4[1] is type char *, expects char: "g'bye" + +Finished LCLint checking --- 2 code errors found, as expected + +decl.c:3:21: Structure struct tm declared with fields { int x; }, specified + with fields { int tm_sec; int tm_min; int tm_hour;, ... } + load file ansi.lcd:961:1: Specification of struct tm + decl.c:3:17: Field tm_sec in specified corresponds to x in declaration + load file ansi.lcd:637:1: Specification of tm_sec + +Finished LCLint checking --- 1 code error found, as expected + +enumbool.c:1:34: Member of boolean enumerated type definition does not match + name set to represent TRUE or FALSE: false +enumbool.c:1:34: Member of boolean enumerated type definition does not match + name set to represent TRUE or FALSE: true + +Finished LCLint checking --- 2 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +extension.c:2:18: Parse Error: New function scope inside function. (For help on + parse errors, see lclint -help parseerrors.) +*** Cannot continue. + +Finished LCLint checking --- no code errors found + +nestext.c: (in function f) +nestext.c:3:26: Declaration using extern inside function scope: int test(void) + +Finished LCLint checking --- 1 code error found, as expected + +sizeofarray.c:1:12: Function parameter x declared as manifest array (size + constant is meaningless) +sizeofarray.c: (in function f) +sizeofarray.c:5:13: Parameter to sizeof is an array-type function parameter: + sizeof((x)) +sizeofarray.c:10:16: Return value type size_t does not match declared type int: + sizeof((a)) + +Finished LCLint checking --- 3 code errors found, as expected + +rex.c: (in function main) +rex.c:19:12: Only storage re.parent (type struct rx_hash *) derived from + variable declared in this scope is not released (memory leak) +rex.c:19:12: Only storage *(re.children)->parent (type struct rx_hash *) + derived from variable declared in this scope is not released (memory leak) +rex.c:19:12: Only storage *(*(re.children)->children)->parent (type struct + rx_hash *) derived from variable declared in this scope is not released + (memory leak) +rex.c:19:12: Only storage *(*(*(re.children)->children)->children)->parent + (type struct rx_hash *) derived from variable declared in this scope is not + released (memory leak) + +Finished LCLint checking --- 4 code errors found, as expected + +struct.c:13:6: Function main declared to return void, should return int + +Finished LCLint checking --- 1 code error found, as expected diff --git a/test/tests2.2/bool.lcs b/test/tests2.2/bool.lcs index 4f467a7..aea5d72 100644 --- a/test/tests2.2/bool.lcs +++ b/test/tests2.2/bool.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/tests2.2a.out b/test/tests2.2a.out index e69de29..1f957e8 100644 --- a/test/tests2.2a.out +++ b/test/tests2.2a.out @@ -0,0 +1,120 @@ + +erik.c: (in function main) +erik.c:6:4: Return value (type int) ignored: scanf("%lf %f", ... + +Finished LCLint checking --- 1 code error found, as expected + +boolcomp.c: (in function f) +boolcomp.c:5:7: Use of == with bool variables (risks inconsistency because of + multiple true values): a == b +boolcomp.c:9:13: Use of == with bool variables (risks inconsistency because of + multiple true values): a == b +boolcomp.c:11:6: Use of != with bool variables (risks inconsistency because of + multiple true values): a != b +boolcomp.c:16:6: Use of == with bool variables (risks inconsistency because of + multiple true values): b == TRUE +boolcomp.c:20:2: Path with no return in function declared to return int + +Finished LCLint checking --- 5 code errors found, as expected + +Finished LCLint checking --- no code errors found + +addassign.c: (in function hash) +addassign.c:7:7: Incompatible types for += (int, char): h += *name++ + +Finished LCLint checking --- 1 code error found, as expected + +toralf.c: (in function func1) +toralf.c:14:3: Incompatible types for += (char *, char): s += 'c' +toralf.c:15:3: Variable i1 used before definition +toralf.c:15:9: Variable f used before definition +toralf.c: (in function func2) +toralf.c:23:8: Variable i2 used before definition +toralf.c: (in function main) +toralf.c:28:10: Null storage passed as non-null param: func1 (NULL) + +Finished LCLint checking --- 5 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +arrayparam.c:1:12: Function parameter x is incomplete type (inner array must + have bounds): int [2] [] +arrayparam.c:11:12: Function parameter x is incomplete type (inner array must + have bounds): int [] [] +arrayparam.c:16:12: Function parameter x is incomplete type (inner array must + have bounds): int [] [] [2] +arrayparam.c:21:12: Function parameter x is incomplete type (inner array must + have bounds): int [2] [] [2] +arrayparam.c:26:12: Function parameter x declared as manifest array (size + constant is meaningless) + +Finished LCLint checking --- 5 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +obviousloop.c: (in function f) +obviousloop.c:14:3: Unreachable code: x = 12 +obviousloop.c: (in function f1) +obviousloop.c:36:2: Path with no return in function declared to return int +obviousloop.c: (in function f1b) +obviousloop.c:59:3: Unreachable code: x = 12 +obviousloop.c: (in function f2) +obviousloop.c:75:3: Unreachable code: x = 12 + +Finished LCLint checking --- 4 code errors found, as expected + +bitops.c: (in function f) +bitops.c:3:11: Left operand of & is not unsigned value (int): i1 & i2 +bitops.c:3:11: Variable x initialized to type unsigned int, expects int: + i1 & i2 +bitops.c:4:21: Right operand of & is not unsigned value (int): u1 & i2 +bitops.c:5:13: Left operand of & is not unsigned value (int): i1 & i2 +bitops.c:5:13: Variable s initialized to type unsigned int, expects short int: + i1 & i2 +bitops.c:6:14: Variable s2 initialized to type int, expects short int: i1 + i2 +bitops.c:9:7: Left operand of << is not unsigned value (int): i1 << 3 +bitops.c:14:7: Left operand of ^ is not unsigned value (int): i1 ^ u1 +bitops.c:15:12: Right operand of ^ is not unsigned value (int): u1 ^ i1 +bitops.c:5:9: Variable s declared but not used +bitops.c:6:9: Variable s2 declared but not used + +Finished LCLint checking --- 11 code errors found, as expected + +bitops.c: (in function f) +bitops.c:5:13: Variable s initialized to type int, expects short int: i1 & i2 +bitops.c:6:14: Variable s2 initialized to type int, expects short int: i1 + i2 +bitops.c:9:7: Left operand of << is not unsigned value (int): i1 << 3 +bitops.c:5:9: Variable s declared but not used +bitops.c:6:9: Variable s2 declared but not used + +Finished LCLint checking --- 5 code errors found, as expected + +isalpha.c: (in function f) +isalpha.c:5:19: Function isalpha expects arg 1 to be int gets char: c + +Finished LCLint checking --- 1 code error found, as expected + +isalpha.c: (in function f) +isalpha.c:5:19: Function isalpha expects arg 1 to be int gets char: c + +Finished LCLint checking --- 1 code error found, as expected + +Finished LCLint checking --- no code errors found + +popik.c:7:3: Variable has unknown (implicitly int) type: dummy[0] +popik.c:7:3: Variable has unknown (implicitly int) type: dummy[1] +popik.c:7:3: Variable has unknown (implicitly int) type: dummy[2] +popik.c:7:3: Variable has unknown (implicitly int) type: dummy[3] +popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[0] +popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[1] +popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[2] +popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[3] +popik.c:1:14: File static variable dummy declared but not used +popik.c:10:24: File static variable dummy2 declared but not used +popik.c:18:14: File static variable dummy3 declared but not used + +Finished LCLint checking --- 11 code errors found, as expected diff --git a/test/tests2.4.out b/test/tests2.4.out index e69de29..9221f5e 100644 --- a/test/tests2.4.out +++ b/test/tests2.4.out @@ -0,0 +1,127 @@ + +Finished LCLint checking --- no code errors found + +enumtest.c:1:9: Variable exported but not used outside enumtest: sig_func +enumtest.c:2:10: Variable exported but not used outside enumtest: sig_func1 + +Finished LCLint checking --- 2 code errors found, as expected + +duffs.c: (in function send) +duffs.c:7:8: Fall through case (no preceding break) +duffs.c:8:8: Fall through case (no preceding break) +duffs.c:9:8: Fall through case (no preceding break) +duffs.c:10:8: Fall through case (no preceding break) +duffs.c:11:8: Fall through case (no preceding break) +duffs.c:12:8: Fall through case (no preceding break) +duffs.c:13:8: Fall through case (no preceding break) + +Finished LCLint checking --- 7 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +bug2.c: (in function main) +bug2.c:6:8: Fall through case (no preceding break) +bug2.c:10:10: Fall through case (no preceding break) +bug2.c:16:8: Fall through case (no preceding break) +bug2.c:5:5: Statement after switch is not a case: printf("here 1") +bug2.c:20:2: Path with no return in function declared to return int + +Finished LCLint checking --- 5 code errors found, as expected + +bug3.c: (in function main) +bug3.c:8:8: Fall through case (no preceding break) +bug3.c:12:21: Variable j used before definition +bug3.c:13:2: Path with no return in function declared to return int + +Finished LCLint checking --- 3 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +hexconstants.c: (in function f) +hexconstants.c:5:10: Return value type unsigned int does not match declared + type int: m1 + m2 + +Finished LCLint checking --- 1 code error found, as expected + +hexconstants.c: (in function f) +hexconstants.c:2:21: Variable m1 initialized to type int, expects unsigned int: + 0xFF +hexconstants.c:3:21: Variable m2 initialized to type int, expects unsigned int: + 0142 +hexconstants.c:5:10: Return value type unsigned int does not match declared + type int: m1 + m2 +hexconstants.c:1:5: Function f exported but not declared in header file + hexconstants.c:6:1: Definition of f + +Finished LCLint checking --- 4 code errors found, as expected + +innercomment.c:1:17: Comment starts inside comment +innercomment.c:16:3: Comment starts inside comment + +Finished LCLint checking --- 2 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +offsetof.c: (in function f) +offsetof.c:10:3: Assignment of size_t to int: m = offsetof(S,u) +offsetof.c:12:26: Deep field k in offsetof is not the name of a field of struct + { int m; }: offsetof(S,u.s.k) + +Finished LCLint checking --- 2 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +error.c:5:9: Variable x initialized to type char, expects int: 'a' + +Finished LCLint checking --- 1 code error found, as expected + +ulrich.c: (in function utl_calloc) +ulrich.c:14:13: Possibly null storage newblock returned as non-null: newblock + ulrich.c:12:16: Storage newblock may become null + +Finished LCLint checking --- 1 code error found, as expected + +cpptest.c: (in function test) +cpptest.c:2:11: Variable x initialized to type char, expects int: 'a' + +Finished LCLint checking --- 1 code error found, as expected + +longlong.c: (in function llf) +longlong.c:2:11: Variable m initialized to type long long, expects int: llx +longlong.c:3:3: Assignment of long long to int: m = 243LL +longlong.c:6:3: Assignment of long long to long int: lx = 5234LL +longlong.c:9:3: Assignment of long long to long int: lx = llx + +Finished LCLint checking --- 4 code errors found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +alignof.c: (in function f) +alignof.c:2:23: Variable m initialized to type size_t, expects int: alignof(x) +alignof.c:3:23: Variable n initialized to type size_t, expects int: + alignof((x)) + +Finished LCLint checking --- 2 code errors found, as expected + +Spec file not found: DBL_MANT_DIG=25.lcl +Command Line: Malformed option `-D' +Cannot open file: DBL_MANT_DIG=25.c +Cannot open file: source.c + +Finished LCLint checking --- no code processed diff --git a/test/tests2.4/Makefile b/test/tests2.4/Makefile index b5d834f..69094c6 100644 --- a/test/tests2.4/Makefile +++ b/test/tests2.4/Makefile @@ -2,7 +2,9 @@ LCLINT = lclint -all: emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source +all: check + +check: emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source emptycase: $(LCLINT) emptycase.c @@ -17,21 +19,21 @@ bitfields: $(LCLINT) bitfields.c bugs: - $(LCLINT) bug1.c ; \ - $(LCLINT) bug2.c -expect 5 ; \ + $(LCLINT) bug1.c + $(LCLINT) bug2.c -expect 5 $(LCLINT) bug3.c -expect 3 tests: - $(LCLINT) test0.c ; \ - $(LCLINT) test1.c ; \ + $(LCLINT) test0.c + $(LCLINT) test1.c $(LCLINT) test2.c hexconstants: - $(LCLINT) hexconstants.c -expect 1 ; \ + $(LCLINT) hexconstants.c -expect 1 $(LCLINT) +checks hexconstants.c -expect 4 innercomment: - $(LCLINT) innercomment.c -expect 2 +forcehints ; \ + $(LCLINT) innercomment.c -expect 2 +forcehints $(LCLINT) innercomment.c -nestcomment nothing: @@ -75,3 +77,12 @@ alignof: source: $(LCLINT) -D DBL_MANT_DIG=25 source.c + + + + + + + + + diff --git a/test/tests2.4/subdir/main.lcs b/test/tests2.4/subdir/main.lcs index 12749be..3739362 100644 --- a/test/tests2.4/subdir/main.lcs +++ b/test/tests2.4/subdir/main.lcs @@ -1,4 +1,4 @@ -%PASSED Output from LCLint 3.0.0.18 +%PASSED Output from LCLint 3.0.0.19 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil diff --git a/test/tests2.5.out b/test/tests2.5.out index e69de29..4aba2d1 100644 --- a/test/tests2.5.out +++ b/test/tests2.5.out @@ -0,0 +1,53 @@ + +Finished LCLint checking --- no code errors found + +boolt.c: (in function test) +boolt.c:7:16: Function test expects arg 1 to be pan_bool_t gets int: 2 + +Finished LCLint checking --- 1 code error found, as expected + +uconstants.c: (in function f) +uconstants.c:2:16: Variable x0 declared but not used +uconstants.c:3:21: Variable x1 declared but not used + +Finished LCLint checking --- 2 code errors found, as expected + +hoof.c: (in function main) +hoof.c:12:16: Function init_arr expects arg 2 to be long int * gets int *: &j + +Finished LCLint checking --- 1 code error found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +booltest.c: (in function f) +booltest.c:9:12: Return value type int does not match declared type bool: i +booltest.c:8:7: Test expression for if not bool, type int: i + +Finished LCLint checking --- 2 code errors found, as expected + +Finished LCLint checking --- no code errors found + +booltest.c: (in function f) +booltest.c:9:12: Return value type int does not match declared type bool: i + +Finished LCLint checking --- 1 code error found, as expected + +Finished LCLint checking --- no code errors found + +Finished LCLint checking --- no code errors found + +immutable.c: (in function immutable_create) +immutable.c:7:6: Arrow access from possibly null pointer res: res->x + immutable.c:5:19: Storage res may become null +immutable.c:8:10: Fresh storage returned as unqualified (should be only): res + immutable.c:5:54: Fresh storage res allocated + +Finished LCLint checking --- 2 code errors found, as expected + +impabsmodule.c: (in function isTwo) +impabsmodule.c:10:7: Variable var used before definition +impabsmodule.c:10:12: Variable var2 used before definition + +Finished LCLint checking --- 2 code errors found, as expected diff --git a/test/tests2.5/newlint.lcd b/test/tests2.5/newlint.lcd index d47cdfc..90f819f 100644 --- a/test/tests2.5/newlint.lcd +++ b/test/tests2.5/newlint.lcd @@ -1,5 +1,5 @@ ;;LCLint Dump: newlint.lcd -;;LCLint 3.0.0.18 --- 5 October 2001 +;;LCLint 3.0.0.19 --- 5 October 2001 ;;lib:168 ;;ctTable 0 u-2 19 38 -- 2.45.1