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

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 09:42:41 PST 2024


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

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.

>From 985019e12b10539b5b47bdce7b9a77e24f8b5abe Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Sat, 13 Jan 2024 12:39:44 -0500
Subject: [PATCH] [libunwind] Move errno.h and signal.h includes under the
 block where they're needed

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.
---
 libunwind/src/UnwindCursor.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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>



More information about the cfe-commits mailing list