Add new rules to detect the cases where sizeof is used in function calls as a argument. Also, for the patch mode third rule should behave same as second rule with arguments reversed. So, change that as well.
Unified · Split
| @@ -16,6 +16,7 @@ virtual patch · 15 unmodified lines | ||
| 16 | 16 | @depends on patch@ |
| 17 | 17 | expression *x; |
| 18 | 18 | expression f; |
| 19 | +expression i; | |
| 19 | 20 | type T; |
| 20 | 21 | @@ |
| 21 | 22 | |
| @@ -30,15 +31,26 @@ f(...,(T)(x),...,sizeof( · 8 unmodified lines | ||
| 30 | 31 | + *x |
| 31 | 32 | ),...) |
| 32 | 33 | | |
| 33 | −f(...,sizeof(x),...,(T)( | |
| 34 | +f(...,sizeof( | |
| 35 | +- x | |
| 36 | ++ *x | |
| 37 | + ),...,(T)(x),...) | |
| 38 | +| | |
| 39 | +f(...,(T)(x),...,i*sizeof( | |
| 34 | 40 | - x |
| 35 | 41 | + *x |
| 36 | 42 | ),...) |
| 43 | +| | |
| 44 | +f(...,i*sizeof( | |
| 45 | +- x | |
| 46 | ++ *x | |
| 47 | + ),...,(T)(x),...) | |
| 37 | 48 | ) |
| 38 | 49 | |
| 39 | 50 | @r depends on !patch@ |
| 40 | 51 | expression *x; |
| 41 | 52 | expression f; |
| 53 | +expression i; | |
| 42 | 54 | position p; |
| 43 | 55 | type T; |
| 44 | 56 | @@ |
| @@ -49,6 +61,10 @@ type T; · 4 unmodified lines | ||
| 49 | 61 | *f(...,(T)(x),...,sizeof@p(x),...) |
| 50 | 62 | | |
| 51 | 63 | *f(...,sizeof@p(x),...,(T)(x),...) |
| 64 | +| | |
| 65 | +*f(...,(T)(x),...,i*sizeof@p(x),...) | |
| 66 | +| | |
| 67 | +*f(...,i*sizeof@p(x),...,(T)(x),...) | |
| 52 | 68 | ) |
| 53 | 69 | |
| 54 | 70 | @script:python depends on org@ |