| 1 |
/// Meta operators |
| 2 |
/// |
| 3 |
// Confidence: Moderate |
| 4 |
|
| 5 |
virtual patch |
| 6 |
virtual context |
| 7 |
virtual org |
| 8 |
virtual report |
| 9 |
|
| 10 |
@plusminus depends on patch && !context && !org && !report@ |
| 11 |
expression e1, e2; |
| 12 |
binary operator op1 = { -, *, /, %, |, &, ^, <<, >>, &&, ||, ==, !=, >, >=, <, <= } ; |
| 13 |
@@ |
| 14 |
|
| 15 |
- e1 op1 e2 |
| 16 |
+ e1 + e2 |
| 17 |
|
| 18 |
@assign depends on patch && !context && !org && !report@ |
| 19 |
expression e1, e2; |
| 20 |
assignment operator aop1 = { +=, -=, *=, /=, %=, |=, &=, ^=, <<=, >>= }; |
| 21 |
assignment operator aop2 = = ; |
| 22 |
@@ |
| 23 |
|
| 24 |
( |
| 25 |
- e1 aop1 e2 |
| 26 |
+ e1 = e2 |
| 27 |
| |
| 28 |
- e1 aop2 e2 |
| 29 |
+ e1 += e2 |
| 30 |
) |
| 31 |
|
| 32 |
// ---------------------------------------------------------------------------- |
| 33 |
|
| 34 |
@plusminus_context depends on !patch && (context || org || report)@ |
| 35 |
expression e1, e2; |
| 36 |
binary operator op1 = {-,*,/,%,|,&,^,<<,>>,&&,||,==,!=,>,>=,<,<=}; |
| 37 |
position j0; |
| 38 |
@@ |
| 39 |
|
| 40 |
* e1@j0 op1 e2 |
| 41 |
|
| 42 |
@assign_context depends on !patch && (context || org || report)@ |
| 43 |
assignment operator aop1 = {+=,-=,*=,/=,%=,|=,&=,^=,<<=,>>=}, aop2 = =; |
| 44 |
expression e1, e2; |
| 45 |
position j0; |
| 46 |
@@ |
| 47 |
|
| 48 |
( |
| 49 |
* e1@j0 aop1 e2 |
| 50 |
| |
| 51 |
* e1@j0 aop2 e2 |
| 52 |
) |
| 53 |
|
| 54 |
// ---------------------------------------------------------------------------- |
| 55 |
|
| 56 |
@script:python plusminus_org depends on org@ |
| 57 |
j0 << plusminus_context.j0; |
| 58 |
@@ |
| 59 |
|
| 60 |
msg = "Binary operator." |
| 61 |
coccilib.org.print_todo(j0[0], msg) |
| 62 |
|
| 63 |
@script:python assign_org depends on org@ |
| 64 |
j0 << assign_context.j0; |
| 65 |
@@ |
| 66 |
|
| 67 |
msg = "Assignment operator." |
| 68 |
coccilib.org.print_todo(j0[0], msg) |
| 69 |
|
| 70 |
// ---------------------------------------------------------------------------- |
| 71 |
|
| 72 |
@script:python plusminus_report depends on report@ |
| 73 |
j0 << plusminus_context.j0; |
| 74 |
@@ |
| 75 |
|
| 76 |
msg = "Binary operator." |
| 77 |
coccilib.report.print_report(j0[0], msg) |
| 78 |
|
| 79 |
@script:python assign_report depends on report@ |
| 80 |
j0 << assign_context.j0; |
| 81 |
@@ |
| 82 |
|
| 83 |
msg = "Assignment operator." |
| 84 |
coccilib.report.print_report(j0[0], msg) |
| 85 |
|