Powered by Linux
Re: smatch on illumos & false positive — Semantic Matching Tool

Re: smatch on illumos & false positive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 06, 2015 at 11:47:28AM +0300, Dan Carpenter wrote:
> It's really 3 questions so I'll send 3 replies.
> 
> On Mon, Jan 05, 2015 at 01:54:46PM -0500, Josef 'Jeff' Sipek wrote:
> > Hello,
> > 
> > I cloned smatch (ca3d9889352dabbd3dcd403cce3e702a56c7d2b2), and tried to run
> > it on my illumos-based [1] laptop.  There was one quick hack I had to do to
> > get it to run because `uname -m` is "i86pc" on both 32-bit and 64-bit x86.
> > (The machine is i86pc.)  `uname -p` spits out "i386" on both 32-bit and 64-bit.
> > (The processor is i386 compatible.)
> > 
> > diff --git a/cgcc b/cgcc
> > index c075e5f..26d10f0 100755
> > --- a/cgcc
> > +++ b/cgcc
> > @@ -271,7 +271,7 @@ sub add_specs {
> >  	chomp $os;
> >  	return &add_specs (lc $os);
> >      } elsif ($spec eq 'host_arch_specs') {
> > -	my $arch = `uname -m`;
> > +	my $arch = `uname -p`;
> >  	chomp $arch;
> >  	if ($arch =~ /^(i.?86|athlon)$/i) {
> >  	    return &add_specs ('i86');
> > 
> > 
> 
> This is something I inherited from Sparse.  I'm pretty sure the correct
> fix is more like the following.  I bet you'll want different arguments
> from i386 eventually...  These are things I'm not sure about.
> 
> diff --git a/cgcc b/cgcc
> index c075e5f..819b808 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -283,6 +283,8 @@ sub add_specs {
>  	    return &add_specs ('ppc');
>  	} elsif ($arch =~ /^(sparc64)$/i) {
>  	    return &add_specs ('sparc64');
> +	} elsif ($arch =~ /^(i86pc)$/i) {
> +	    return &add_specs ('i86');

Yep, it works too.

>  	}
>      } else {
>  	die "$0: invalid specs: $spec\n";

-- 
All parts should go together without forcing.  You must remember that the
parts you are reassembling were disassembled by you.  Therefore, if you
can’t get them together again, there must be a reason.  By all means, do not
use a hammer.
		— IBM Manual, 1925
--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux