Commit 4943c20
Fix enum math in verbs.h for CUDA C++20 upgrade via reversions and casts
Summary:
Generated by running
```
hg backout D88882181
hg backout D89083275
hg backout D88911049
```
and then adding explicit casts.
`infiniband/verbs.h` caused C++20 compilation failures due to enum-enum math which could not simply be suppressed because it's a header file.
D88882181 converted `enum` to constants to allow the math to work and because the enums themselves seemed suspect. This caused compilation to succeed with C++20 and unblock a number of broken tests.
But it broke Rust! D89083275 and D88911049 fix Rust by artificially restoring the `enum` values. But that's a mess.
Here we back out both D88882181 and D89083275 and D88911049. Doing so brings us back to a state where the following compilation error would arise:
```
buck-out/v2/gen/fbsource/third-party/rdma-core/stablev60/__ibverbs__/c01e142197f8fe04/buck-headers/infiniband/verbs.h:573:59: error: bitwise operation between different enumeration types ('(unnamed enum at buck-out/v2/gen/fbsource/third-party/rdma-core/stablev60/__ibverbs__/c01e142197f8fe04/buck-headers/infiniband/verbs.h:562:1)' and 'ibv_create_cq_wc_flags') is deprecated [-Werror,-Wdeprecated-anon-enum-enum-conversion]
573 | IBV_CREATE_CQ_SUP_WC_FLAGS = ((((((IBV_WC_STANDARD_FLAGS) | (IBV_WC_EX_WITH_COMPLETION_TIMESTAMP)) | (IBV_WC_EX_WITH_CVLAN)) | (IBV_WC_EX_WITH_FLOW_TAG)) | (IBV_WC_EX_WITH_TM_INFO)) | (IBV_WC_EX_WITH_COMPLETION_TIMESTAMP_WALLCLOCK))
| ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
This time we fix the error by adding explicit `(int)` casts to the affected Line 573.
The result is code that:
* Compiles with C++20 by explicitly suppressing the issue causing the compilation failure
* Retains the enums so that builds with Rust work.
Upstream PR: linux-rdma/rdma-core#1671
See discussion [here](https://fb.workplace.com/groups/rust.language/permalink/30268407786114448/).
Reviewed By: peterdelevoryas
Differential Revision: D890880111 parent 2c8aa89 commit 4943c20
1 file changed
+2
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 26 | | |
81 | 27 | | |
82 | 28 | | |
| |||
0 commit comments