[PATCH] D104978: [lld/mac] Don't fold UNWIND_X86_64_MODE_STACK_IND unwind entries

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 01:44:28 PDT 2021


uabelho added inline comments.


================
Comment at: lld/MachO/UnwindInfoSection.cpp:332-333
+  // entries need unique addresses.
+  static_assert(UNWIND_X86_64_MODE_MASK == UNWIND_X86_MODE_MASK, "");
+  static_assert(UNWIND_X86_64_MODE_STACK_IND == UNWIND_X86_MODE_STACK_IND, "");
+  if ((target->cpuType == CPU_TYPE_X86_64 || target->cpuType == CPU_TYPE_X86) &&
----------------
gcc warns on the comparisons in the two new static_asserts:
```
lld/MachO/UnwindInfoSection.cpp:345:44: warning: comparison between 'enum<unnamed>' and 'enum<unnamed>' [-Wenum-compare]
353 |   static_assert(UNWIND_X86_64_MODE_MASK == UNWIND_X86_MODE_MASK, "");
    |                                            ^~~~~~~~~~~~~~~~~~~~
lld/MachO/UnwindInfoSection.cpp:346:49: warning: comparison between 'enum<unnamed>' and 'enum<unnamed>' [-Wenum-compare]
354 |   static_assert(UNWIND_X86_64_MODE_STACK_IND == UNWIND_X86_MODE_STACK_IND, "");
    |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
```
Perhaps cast the enum values to some integer type to silence the warnings if we really do want to compare values from different enums? I'm not sure what type to cast it to make it sufficiently large on all platforms though, perhaps intmax_t?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104978/new/

https://reviews.llvm.org/D104978



More information about the llvm-commits mailing list