···11+// SPDX-License-Identifier: GPL-2.0-only22+///33+/// Check for opencoded swap() implementation.44+///55+// Confidence: High66+// Copyright: (C) 2021 Denis Efremov ISPRAS77+// Options: --no-includes --include-headers88+//99+// Keywords: swap1010+//1111+1212+virtual patch1313+virtual org1414+virtual report1515+virtual context1616+1717+@rvar depends on !patch@1818+identifier tmp;1919+expression a, b;2020+type T;2121+position p;2222+@@2323+2424+(2525+* T tmp;2626+|2727+* T tmp = 0;2828+|2929+* T *tmp = NULL;3030+)3131+... when != tmp3232+* tmp = a;3333+* a = b;@p3434+* b = tmp;3535+... when != tmp3636+3737+@r depends on !patch@3838+identifier tmp;3939+expression a, b;4040+position p != rvar.p;4141+@@4242+4343+* tmp = a;4444+* a = b;@p4545+* b = tmp;4646+4747+@rpvar depends on patch@4848+identifier tmp;4949+expression a, b;5050+type T;5151+@@5252+5353+(5454+- T tmp;5555+|5656+- T tmp = 0;5757+|5858+- T *tmp = NULL;5959+)6060+... when != tmp6161+- tmp = a;6262+- a = b;6363+- b = tmp6464++ swap(a, b)6565+ ;6666+... when != tmp6767+6868+@rp depends on patch@6969+identifier tmp;7070+expression a, b;7171+@@7272+7373+- tmp = a;7474+- a = b;7575+- b = tmp7676++ swap(a, b)7777+ ;7878+7979+@depends on patch && (rpvar || rp)@8080+@@8181+8282+(8383+ for (...;...;...)8484+- {8585+ swap(...);8686+- }8787+|8888+ while (...)8989+- {9090+ swap(...);9191+- }9292+|9393+ if (...)9494+- {9595+ swap(...);9696+- }9797+)9898+9999+100100+@script:python depends on report@101101+p << r.p;102102+@@103103+104104+coccilib.report.print_report(p[0], "WARNING opportunity for swap()")105105+106106+@script:python depends on org@107107+p << r.p;108108+@@109109+110110+coccilib.org.print_todo(p[0], "WARNING opportunity for swap()")111111+112112+@script:python depends on report@113113+p << rvar.p;114114+@@115115+116116+coccilib.report.print_report(p[0], "WARNING opportunity for swap()")117117+118118+@script:python depends on org@119119+p << rvar.p;120120+@@121121+122122+coccilib.org.print_todo(p[0], "WARNING opportunity for swap()")