[libunwind] [libunwind] Move errno.h and signal.h includes under the block where they're needed (PR #78054)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 09:43:10 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libunwind

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

Commit fc1c478709e3 added includes of <signal.h> and <errno.h> to UnwindCursor.hpp. The library previously built on platforms where these headers are not provided. These headers should be included only in the case where they are actually needed, i.e. on Linux.

---
Full diff: https://github.com/llvm/llvm-project/pull/78054.diff


1 Files Affected:

- (modified) libunwind/src/UnwindCursor.hpp (+2-2) 


``````````diff
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 8517d328bd058b..7753936a5894a3 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -12,8 +12,6 @@
 #define __UNWINDCURSOR_HPP__
 
 #include "cet_unwind.h"
-#include <errno.h>
-#include <signal.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -35,6 +33,8 @@
 #if defined(_LIBUNWIND_TARGET_LINUX) &&                                        \
     (defined(_LIBUNWIND_TARGET_AARCH64) || defined(_LIBUNWIND_TARGET_RISCV) || \
      defined(_LIBUNWIND_TARGET_S390X))
+#include <errno.h>
+#include <signal.h>
 #include <sys/syscall.h>
 #include <sys/uio.h>
 #include <unistd.h>

``````````

</details>


https://github.com/llvm/llvm-project/pull/78054


More information about the cfe-commits mailing list