[lldb] Add compile time checks for signal codes when on the matching platform
This adds a new macro to the UnixSignals subclasses, ADD_SIGCODE. ADD_SIGCODE(4, ILL_ILLOPC, 1, "illegal opcode"); Adds a sigcode to signal 4. That code is ILL_ILLOPC and we expect its value to be 1. When compiling on a system that matches the class e.g. FreeBSD for FreeBSDSignals, the macro will check that that is true. When you're not on FreeBSD we just use the number 1, and ILL_ILLOPC won't be defined to anything because we don't include csignal. Example error: LinuxSignals.cpp:52:3: error: static_assert failed due to requirement 'ILL_COPROC == 9' "Value mismatch for signal code ILL_COPROC" Reviewed By: arichardson Differential Revision: https://reviews.llvm.org/D146222
Loading
Please sign in to comment