[splint-discuss] Query
Roland Illig
roland.illig at gmx.de
Fri Jul 21 02:21:25 EDT 2006
amit kumar wrote:
> Hi all,
> The question is can we apply splint to our makefiles
> ie can i compile whole directory structure at once ............
Yes, that should be possible. You may try the attached wrapper program.
If it proves useful, maybe it can be included in the next SPlint release?
Roland
-------------- next part --------------
#! /usr/bin/env perl
#
# A wrapper for gcc that calls splint with the appropriate -D..., -I...
# and -U... flags, and after that calls gcc. To use it, define the
# Makefile variable CC="splintcc cc".
#
# Copyright (c) 2006 Roland Illig <roland.illig at gmx.de>.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# This software is provided ``as is'' and without any warranties.
# Use it at your own risk.
#
use strict;
use warnings;
use constant false => 0;
use constant true => 1;
my @lint_args = ("splint");
my @cc_args = (shift());
my $compiling = false;
my $arg;
while (defined($arg = shift(@ARGV))) {
push(@cc_args, $arg);
if ($arg =~ qr"^-[DIU]") {
push(@lint_args, $arg);
} elsif ($arg =~ qr"^(?:-E|-f.*|-m.*|-O.*|-S|-static|-W.*)$") {
# ignore them for splint
} elsif ($arg eq "-c") {
push(@lint_args, "+partial");
$compiling = true;
} elsif ($arg eq "-o") {
# skip this and the next argument for splint
push(@cc_args, shift(@ARGV));
} elsif ($arg =~ qr"^-.") {
print STDERR "$0: warning: Unknown argument: $arg\n";
} else {
push(@lint_args, $arg);
}
}
# Only run SPlint when the "-c" option is given.
if ($compiling) {
system { $lint_args[0] } (@lint_args);
}
# Run the real compiler.
exec { $cc_args[0] } (@cc_args) or die;
More information about the splint-discuss
mailing list