From: Roel Kluin <12o3l@tiscali.nl>
To: kernel-janitors@vger.kernel.org
Subject: Re: script to find incorrect tests on unsigneds
Date: Wed, 23 Apr 2008 10:26:29 +0000 [thread overview]
Message-ID: <480F0ED5.5060800@tiscali.nl> (raw)
In-Reply-To: <4808C90A.5040600@tiscali.nl>
Julia Lawall wrote:
> On Wed, 23 Apr 2008, Roel Kluin wrote:
>
>> Forgot to add these on top of my script,
>>
>> int="[0-9]"
>> hEx="[A-Fa-f0-9]"
>> an_="[A-Za-z0-9_]"
>> D="$int*\.\?$int\+x\?$hEx*[uUlL]\{0,3\}[fF]\?"
>> V="$an_\+$an_*"
>> w="\($V\|${V}\[$s$an_*${s}\]\|$V\.\|$V->\)\+"
>> s="[[:space:]]*";
>> S="[[:space:]]\+"
>> cendl="$s\(\/[\*\/].*\)\?$"
>
> With this I get an error from sed.
>
> julia
Not due to this, but I had an error in my script. here's the updated
script below. it's working now, I'll post the results shortly.
Thanks, and especially for the -quiet flag,
Roel
---
int="[0-9]"
hEx="[A-Fa-f0-9]"
an_="[A-Za-z0-9_]"
D="$int*\.\?$int\+x\?$hEx*[uUlL]\{0,3\}[fF]\?"
V="$an_\+$an_*"
w="\($V\|${V}\[$s$an_*${s}\]\|$V\.\|$V->\)\+"
s="[[:space:]]*";
S="[[:space:]]\+"
cendl="$s\(\/[\*\/].*\)\?$"
# define what to search for
left_operator="\([;,|^?:(]\|[\!+*/%&|~^-]=\|>>=\|<<=\|\[\|&&\|$an_$s&\)"
right_operator="\([;,&|^?:)]\|[\!+*/%&|~^<>-]=\|>>=\|<<=\|>[^>]\|<[^<]\|\]\)"
variable="$s\(\(++\|--\)$w\|$w\(++\|--\)\|$w\)$s"
comparison="\(\(>=\|<\)${s}0\|\([><\!=]=\|[<>]\)$s-$s$D\)$s"
query="$left_operator$variable$comparison$right_operator"
arr="\(\[[^\]]*\]$s\)*"
attr="__attribute__$s(([^;]*))"
# for each unsigned typedefs
for ut in "unsigned" "unsigned long" $(
git-grep "^${s}typedef${S}unsigned$S\($V$S\)*\($V$s$arr\|$attr$S$V$s$arr\|$V$s$arr$S$attr\)$s;$cendl" |
sed -n "s/^[^.]*\.[hc]:${s}typedef${S}unsigned$S\($V$S\)*\(\($V\)$s$arr\|$attr$S\($V\)$s$arr\|\($V\)$s$arr$S$attr\)$s;$cendl/\3\5\7/p" | sort | uniq); do
# create the spatch
cat > ../spatches/negative_unsigned.cocci << EOF
@@
constant C;
$ut i;
@@
(
* i < 0
|
* i <= 0
|
* i = -C
|
* i < -C
|
* i <= -C
)
EOF
# find
for f in $(git-grep -l "$ut" | grep "[^.]*\.[ch]" | xargs grep -l "$query"); do
spatch -quiet -sp_file ../spatches/negative_unsigned $f;
done
done > ../spatch.log
next prev parent reply other threads:[~2008-04-23 10:26 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-18 16:15 script to find incorrect tests on unsigneds Roel Kluin
2008-04-18 19:08 ` Julia Lawall
2008-04-19 14:05 ` esp_scsi incorrect unsigned test Matthew Wilcox
2008-04-19 14:05 ` Matthew Wilcox
2008-04-19 14:16 ` James Bottomley
2008-04-19 14:16 ` James Bottomley
2008-04-20 0:59 ` David Miller
2008-04-20 0:59 ` David Miller
2008-04-19 14:17 ` u14-3f " Matthew Wilcox
2008-04-19 14:17 ` Matthew Wilcox
[not found] ` <Pine.LNX.4.64.0804182101200.14832-QfmoRoYWmW9knbxzx/v8hQ@public.gmane.org>
2008-04-19 14:24 ` script to find incorrect tests on unsigneds Matthew Wilcox
2008-04-19 14:24 ` Matthew Wilcox
2008-04-19 14:49 ` Matthew Wilcox
2008-04-19 14:49 ` Matthew Wilcox
2008-04-18 19:36 ` Julia Lawall
2008-04-19 13:29 ` walter harms
2008-04-19 13:43 ` Matthew Wilcox
2008-04-19 15:20 ` Julia Lawall
2008-04-19 15:43 ` Julia Lawall
2008-04-22 21:06 ` Julia Lawall
2008-04-22 21:28 ` Roel Kluin
2008-04-23 5:47 ` Julia Lawall
2008-04-23 9:26 ` Roel Kluin
2008-04-23 9:30 ` Roel Kluin
2008-04-23 9:54 ` Julia Lawall
2008-04-23 10:02 ` Julia Lawall
2008-04-23 10:26 ` Roel Kluin [this message]
2008-04-23 14:02 ` Roel Kluin
2008-04-23 14:05 ` Roel Kluin
2008-04-23 14:11 ` Roel Kluin
2008-04-23 14:24 ` Julia Lawall
2008-04-23 16:01 ` Roel Kluin
2008-04-23 17:59 ` Roel Kluin
2008-04-23 18:58 ` Julia Lawall
2008-04-23 19:12 ` Julia Lawall
2008-04-23 19:36 ` Roel Kluin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=480F0ED5.5060800@tiscali.nl \
--to=12o3l@tiscali.nl \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.