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

verbs: fix compilation warning with C++20 #1367

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Conversation

rleon
Copy link
Member

@rleon rleon commented Jul 5, 2023

Our customer reported the below warning whe using Clang v16.0.4 and C++20, on a code that includes the header "/usr/include/infiniband/verbs.h":

error: bitwise operation between different enumeration types ('ibv_access_flags' and 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

According to the article "Clang 11 warning: Bitwise operation between different enumeration types is deprecated":

C++20's P1120R0 deprecated bitwise operations between different enums. Such code is likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.

Reported-by: Rogerio Moraes rogerio@cadence.com

Link: https://lore.kernel.org/r/20230613131931.738436-1-neelx@redhat.com

Our customer reported the below warning whe using Clang v16.0.4 and C++20,
on a code that includes the header "/usr/include/infiniband/verbs.h":

error: bitwise operation between different enumeration types ('ibv_access_flags' and
'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
                mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
                             ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
                              ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

According to the article "Clang 11 warning: Bitwise operation between different
enumeration types is deprecated":

C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.

Reported-by: Rogerio Moraes <rogerio@cadence.com>
Signed-off-by: Daniel Vacek <neelx@redhat.com>
Link: https://lore.kernel.org/r/20230613131931.738436-1-neelx@redhat.com
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
@rleon rleon merged commit 2755113 into linux-rdma:master Jul 5, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant