Hi,

I hope this is the correct list to post this information. I've had some
issues with Splint, started to poke at the code, made some changes
that scratched my itches. Afterwards I've looked on the net and found
various bugs/patches/fixes, which after correcting my issues, seemed
not so challenging. As some of the fixes might help others, I'm making
them available at:
   http://repo.or.cz/splint-patched.git

What does it do and why should anyone using Splint might be
interested? I'm adding a summary bellow.

Bug fixes:
 - "ctype.h" and "complex.h" are never detected as standard headers (and
   thus not skipped, even if user specified +skip-ansi-headers),
   instead "ctypecomplex.h" is (a missing comma between the two literals
   in an array initialization);
 - support for variadic (ala C99) macros (inspired by Debian & upstream
   patches, but with additional fixes;
 - support for mixing statements and variable declarations (as in C99)
   added, inspired by upstream changes (but with additional fixes for
   situations not correctly handled by the patch, e.g. declarations
   inside switch/case);
 - support for using variable declaration (and initialization) in the
   initialization part of for statements (as in C99); this only
   addresses parsing, it doesn't extend Splint's checking with knowledge
   about how to find bugs for the added syntax; [Splint's loop
   handling is problematic anyhow, the added complexity doesn't make
   it's analysis any better];
 - Duff's device handling (switch+loop) handled only combinations of
   switch/case with while and do-while loops, missing for loops --
   corrected; somewhat related (and legal) code of mixing switch and
   if-else statements was also missing and was corrected;
 - corrected various issues (reported upstream but also found by me) in
   standard library specifications;
 - incorrect order of initialization of variables in a declaration list
   ("int x=3, y = x+7;" triggered a warning);
 - correctly parse uses of function variables of function (not pointer
   to function);
 - correct handling of spliced string literals ("a" "b");
 - fixes for (open) bugs at SourceFourge:
     https://sourceforge.net/p/splint/bugs/{5,7,12*,13,14,15,17,18,20}
   (and added https://sourceforge.net/p/splint/patches/1);
 - fixes for (not forwarded up-stream) bugs:
     https://bugs.debian.org/{499395,626552*,775917,820950*}
 - fixes for issues related to:
     https://github.com/ravenexp/splint/pull/{1,3,4}
   (issue 1 fixed in a totally different way).
[fixes marked with * are partial fixes].

Other relevant changes:
 - preprocessor commands look more like standard preprocessor commands
   (Splint no longer accepts combinations like ++U, +-D & +I, only -U,
   -D & -I);
 - preprocessor environment paths CPATH & C_INCLUDE_PATH behave (more)
   like in the GNU C preprocessor (from which Splint's preprocessor was
   borrowed some long time ago); meaning they (should) add to instead of
   replace the user/system include path;
 - builder can configure the install prefix with <dirname>/ and
   <dirname>, the result will be the same; previously the resulting
   binaries would behave differently (testing headers if they're _system_
   depended on string comparison with the name specified at build time,
   but that name was not canonicalized);
 - builder can specify a path (the same format as an environment path)
   at build time for the default include path used by the binary;
   previously the path would have been "/usr/include:
   <non-canonicalized-prefix>/include", causing some strange behaviour
   when one binary built without any prefix (default "/usr/local",
   usually there are no headers under that folder) would behave
   differently then one configured correctly (prefix "/usr") -- they
   interpreted what is a standard header file differently;
 - builder can specify a list of definitions that should always be added
   to the preprocessor; somebody knowing that the binary will always be
   used to check code using certain definitions (some platform code)
   might use these;
 - removed platform dependent definitions hardwired in the code;
   maintaining it is a never-ending nightmare (as such a list of
   definitions for each platform would always get updated, it easily
   gets obsolete); additionally, users might want to check code not
   targeted at their current working platform;
 - default values for environment variables LARCH_PATH & LCLIMPORTDIR no
   longer configured by to include the building path -- this path might
   be temporary, or, if builder actually builds a package to be
   distributed, that path might have never existed on the installed
   machine;
 - macros declared on the command line (-D) were treated differently
   then those inside file (#define), thus causing (in some cases)
   surprises when switching from one usage to the other;
 - support for unknown symbols from the system's reserved name space
   (those symbols starting with __) are no longer handled (handling them
   meant breaking the system already installed to handle type/name
   ambivalence in C); such symbols should be defined (either in the
   command line, in source code, or if in external headers, maybe skip
   including such headers for Splint);
 - giving +nolib flag also implies disabling -skip-std-headers,
   giving +posixlib also enable +skip-std-headers;
 - more minor tweaks (and probably some other things that I don't
   remember now);

Build changes:
 - (!) dropped support for a series of obsolete platform/system configurations;
 - clean-up repository of temporary/generated/unused/deprecated files;
 - remove ability to use 'binary' builds (builds without generation tools:
   lex, yacc or autotools) as these cause build inconsistencies;
 - out-of-place builds;
 - nicer, cleaner and more standard build printing (use V=1 for verbose mode);
 - cleaned tests running (re-enabled tests that were inadvertently disabled,
   additional tests for added functionality changes);
 - build system can now correctly build a distribution archive;

Additional changes:
 - numerous warnings reported by compilers (and other static analyzer
   tools) addressed;
 - updated lex/yacc files to newer (and less permissive) tools versions;
 - some memory issues fixed (leaks, use-after-free, double-free) tackled;
   this is just a drop in an ocean, Splint is full of memory leaks (its
   parser especially; for example, every token is freshly allocated, but
   is rarely freed);
 - some code rearranging to better suit my coding style/expectations;

Mistakes:
 - surely removed/modified (without fully comprehending at the moment
   I've started poking at the code) some Splint specifications, some of
   the added functionality didn't had specification at all or had
   improper specifications, causing self-check on Splint's code to now
   have significantly more (about triple number of lines) warnings then
   before; these shouldn't be so hard to fix though;
 - surely more then I'm aware of;

What I would like to do next is to reduce the gap between what the
library specification for C99 and for POSIX (version ?) by adding
missing components (definitions but also entire headers missing). Some
of the reported bugs are not actually in code, but in the specification
(incorrect, but more commonly incomplete). Of course, this entirely
depends on the free time I have, and that is a limited resource.

Thanks for your attention and hope some of you find this useful.

Best regards,
Mihail Groza
_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to