[Libvir] 0/8 add syntax checks

A few days ago I wrote a patch eliminating all of the useless if tests of the form "if (foo) free (foo);". In general, when making such a global change, I prefer to add a check so that it is easy to ensure mechanically that the new violations don't sneak back in. So I wrote a script to detect the above, then another to perform the "remove-if-cond" part as a double check against my detect-and-manually-remove work. Once you can mechanically detect the offending pattern, it's good to make it as easy as possible to check for recurrence. In other projects, I've used "make syntax-check", because most such tests are syntax-related and detectable using tools like grep. The first patch simply removes the useless if tests. Following it, I introduce a "make syntax-check" framework similar to what I use in coreutils. In it, most tests are disabled, except the new one that tests for the unnecessary "if"-before-free. In the following 6 patches, I enable new tests one by one, and correct the violations each one exposes. I deliberately keep these tests in a separate Makefile.maint file, and pull them in via GNUmakefile so that they are not subject to the burdensome portability constraints associated with regular Makefile.am contents. I.e., if you run "make syntax-check", you are expected to have GNU make as well as a reasonable set of working tools. Thus, we don't have to worry about whether egrep works or whether e.g., perl is present. Jim

On Fri, Jan 25, 2008 at 11:16:15PM +0100, Jim Meyering wrote:
The first patch simply removes the useless if tests. Following it, I introduce a "make syntax-check" framework similar to what I use in coreutils. In it, most tests are disabled, except the new one that tests for the unnecessary "if"-before-free.
We should add a call to 'make syntax-check' into the autobuild.sh script so that these checks get on the automated builds each night.
I deliberately keep these tests in a separate Makefile.maint file, and pull them in via GNUmakefile so that they are not subject to the burdensome portability constraints associated with regular Makefile.am contents. I.e., if you run "make syntax-check", you are expected to have GNU make as well as a reasonable set of working tools. Thus, we don't have to worry about whether egrep works or whether e.g., perl is present.
Sounds like a good strategy Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
participants (2)
-
Daniel P. Berrange
-
Jim Meyering