~ubuntu-branches/ubuntu/trusty/coccinelle/trusty-proposed

« back to all changes in this revision

Viewing changes to scripts/coccicheck/cocci/find_unsigned.cocci

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-01-31 22:30:19 UTC
  • mfrom: (7.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100131223019-hbq02ip17tn17n52
Tags: 0.2.0.deb-1ubuntu1
* Merge from debian testing (LP: #515198).Remaining changes:
  - debian/control: build-depend on python2.6-dev,
    set XB-Python-Version to 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// A variable that is declared as unsigned should not be tested to be less than
 
2
// zero.
 
3
//
 
4
// Confidence: High
 
5
// Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU.  GPLv2.
 
6
// URL: http://www.emn.fr/x-info/coccinelle/rules/find_unsigned.html
 
7
// Options: -all_includes
 
8
 
 
9
virtual org,diff
 
10
 
 
11
@u@ type T; unsigned T i; position p; @@
 
12
 
 
13
 i@p < 0
 
14
 
 
15
@script:python depends on org@
 
16
p << u.p;
 
17
@@
 
18
 
 
19
cocci.print_main("",p)
 
20
 
 
21
@depends on diff@
 
22
expression i;
 
23
position u.p;
 
24
@@
 
25
 
 
26
*i@p
 
27
 
 
28