Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Coccinelle rules - bitmap set operations #6265

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions coccinelle/bms_result.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Some bitmap set operations recycle one of the input parameters or return
// a reference to a new bitmap set. The following set of rules checks that the
// returned reference is not discarded.

@rule_1@
expression E1, E2;
@@

+ /* Result of bms_add_member has to be used */
+ E1 = bms_add_member(E1, E2);
- bms_add_member(E1, E2);

@rule_2@
expression E1, E2;
@@

+ /* Result of bms_del_member has to be used */
+ E1 = bms_del_member(E1, E2);
- bms_del_member(E1, E2);

@rule_3@
expression E1, E2;
@@

+ /* Result of bms_add_members has to be used */
+ E1 = bms_add_members(E1, E2);
- bms_add_members(E1, E2);

@rule_4@
expression E1, E2, E3;
@@

+ /* Result of bms_add_range has to be used */
+ E1 = bms_add_range(E1, E2, E3);
- bms_add_range(E1, E2, E3);

@rule_5@
expression E1, E2;
@@

+ /* Result of bms_int_members has to be used */
+ E1 = bms_int_members(E1, E2);
- bms_int_members(E1, E2);

@rule_6@
expression E1, E2;
@@

+ /* Result of bms_del_members has to be used */
+ E1 = bms_del_members(E1, E2);
- bms_del_members(E1, E2);

@rule_7@
expression E1, E2;
@@

+ /* Result of bms_join has to be used */
+ E1 = bms_join(E1, E2);
- bms_join(E1, E2);

@rule_8@
expression E1, E2;
@@

+ /* Result of bms_union has to be used */
+ E1 = bms_union(E1, E2);
- bms_union(E1, E2);

@rule_9@
expression E1, E2;
@@

+ /* Result of bms_intersect has to be used */
+ E1 = bms_intersect(E1, E2);
- bms_intersect(E1, E2);

@rule_10@
expression E1, E2;
@@

+ /* Result of bms_difference has to be used */
+ E1 = bms_difference(E1, E2);
- bms_difference(E1, E2);