[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <56051D2B.5040802@samsung.com>
Date: Fri, 25 Sep 2015 12:08:43 +0200
From: Andrzej Hajda <a.hajda@...sung.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Gilles Muller <Gilles.Muller@...6.fr>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Michal Marek <mmarek@...e.com>,
Nicolas Palix <nicolas.palix@...g.fr>,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
cocci@...teme.lip6.fr
Subject: Re: [PATCH] coccinelle: assign signed result to unsigned variable
On 09/24/2015 05:51 PM, SF Markus Elfring wrote:
>> +@rs@
>> +position p;
>> +typedef bool, u8, u16, u32, u64, s8, s16, s32, s64;
>> +{char, short int, int, long, long long, s8, s16, s32, s64} vs;
> Can it matter to specify also the type modifier "signed" in this SmPL approach?
> http://coccinelle.lip6.fr/docs/main_grammar005.html#ctype_qualif
According to my tests it does not matter.
Btw I should replace short int, with short, to allow catch short intergers.
>
>
>> +{unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, size_t, bool, u8, u16, u32, u64} vu;
> How do you think about to reformat such a data type enumeration?
If you mean split line to be below 80 chars, OK.
>
>
>> +@@
>> +
>> +vu@p = vs
>> +
>> +@r@
>> +position rs.p;
>> +identifier v, f;
>> +statement S1, S2;
>> +expression e;
>> +@@
>> +
>> +*v@p = f(...);
> Do you try to check here if the value receiver is at the same source code
> position from the SmPL rule "rs"?
Yes.
Generally I want to catch all assignments of signed function result to unsigned var.
In this script I have implemented it this way:
1. Look for all assignments 'unsigned = signed' (rs rule).
2. Check if signed from rs rule looks as a function call.
Is there better way to do it?
Regards
Andrzej
>
> Regards,
> Markus
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists