1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-29 11:21:33 +03:00
systemd-stable/coccinelle/flags-set.cocci
Zbigniew Jędrzejewski-Szmek d94a24ca2e Add macro for checking if some flags are set
This way we don't need to repeat the argument twice.
I didn't replace all instances. I think it's better to leave out:
- asserts
- comparisons like x & y == x, which are mathematically equivalent, but
  here we aren't checking if flags are set, but if the argument fits in the
  flags.
2018-06-04 11:50:44 +02:00

16 lines
180 B
Plaintext

@@
expression x, y;
@@
- ((x) & (y)) == (y)
+ FLAGS_SET(x, y)
@@
expression x, y;
@@
- (x & (y)) == (y)
+ FLAGS_SET(x, y)
@@
expression x, y;
@@
- ((x) & y) == y
+ FLAGS_SET(x, y)