Commit 4273d1f
Make
Summary: `SCOPE_EXIT` macro is actively used in headers but it uses `__COUNTER__` that gives different value in different TU depending on number of previous `__COUNTER__` usages in translation unit. Therefore it violates ODR because function bodies for the same function become different. Clang detects this ODR violations in modularized builds when it merges AST from different modules or between global fragment and module. This diff create ODR safe version of `FB_ANONYMOUS_VARIABLE` that gives stable value but has limitation that it cannot be used more than once on the same line.
Reviewed By: Gownta
Differential Revision: D63825595
fbshipit-source-id: 7994094df5430a7e58bc51ef6576eae20b5cea0eSCOPE_EXIT ODR safe1 parent 2184a67 commit 4273d1f
2 files changed
+10
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
360 | | - | |
| 359 | + | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
390 | | - | |
| 389 | + | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
| 418 | + | |
| 419 | + | |
420 | 420 | | |
0 commit comments