[libunwind] [libunwind] Add Unwind-wasm.c to CMakeLists.txt (PR #67770)

Heejin Ahn via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 30 18:01:44 PDT 2023


https://github.com/aheejin updated https://github.com/llvm/llvm-project/pull/67770

>From 3277e2c8058c5d9b0afcc073d711646ebbf7ed62 Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin at gmail.com>
Date: Thu, 28 Sep 2023 23:43:26 -0700
Subject: [PATCH 1/5] [libunwind] Add Unwind-wasm.c to CMakeLists.txt

This was missing when the file was added.
---
 libunwind/src/CMakeLists.txt | 1 +
 libunwind/src/Unwind-wasm.c  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 452d988c3726b5e..abb019b88ebabd7 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -16,6 +16,7 @@ set(LIBUNWIND_C_SOURCES
     UnwindLevel1.c
     UnwindLevel1-gcc-ext.c
     Unwind-sjlj.c
+    Unwind-wasm.c
     )
 set_source_files_properties(${LIBUNWIND_C_SOURCES}
                             PROPERTIES
diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index 35f2f9aeab08048..47c79b0d14d37b7 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -10,12 +10,13 @@
 //
 //===----------------------------------------------------------------------===//
 
+#ifdef __USING_WASM_EXCEPTIONS__
+
 #include "config.h"
 #include "unwind.h"
 #include <stdbool.h>
 #include <threads.h>
 
-#ifdef __USING_WASM_EXCEPTIONS__
 
 _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
                                             uint64_t exceptionClass,

>From 784fd43b2a58b55d838afce420c04598e3e37efa Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin at gmail.com>
Date: Fri, 29 Sep 2023 00:01:54 -0700
Subject: [PATCH 2/5] Remove newline

---
 libunwind/src/Unwind-wasm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index 47c79b0d14d37b7..96af603d666128a 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -17,7 +17,6 @@
 #include <stdbool.h>
 #include <threads.h>
 
-
 _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
                                             uint64_t exceptionClass,
                                             _Unwind_Exception *unwind_exception,

>From 921cad7d2db034cdc9f6c80e6dcbad614661fac8 Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin at gmail.com>
Date: Fri, 29 Sep 2023 11:20:45 -0700
Subject: [PATCH 3/5] File needs to have at least one declaration

---
 libunwind/src/Unwind-wasm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index 96af603d666128a..efbc0762f6349f9 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -10,12 +10,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifdef __USING_WASM_EXCEPTIONS__
-
-#include "config.h"
-#include "unwind.h"
 #include <stdbool.h>
 #include <threads.h>
+#include "config.h"
+#include "unwind.h"
+
+#ifdef __USING_WASM_EXCEPTIONS__
 
 _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
                                             uint64_t exceptionClass,
@@ -118,4 +118,4 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
   return 0;
 }
 
-#endif
+#endif // defined(__USING_WASM_EXCEPTIONS__)

>From 66b224100087cbfb46ee5acf76c34afa9553c119 Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin at gmail.com>
Date: Fri, 29 Sep 2023 11:38:38 -0700
Subject: [PATCH 4/5] Make clang-format happy

---
 libunwind/src/Unwind-wasm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index efbc0762f6349f9..403a381fc1d96b7 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -12,6 +12,7 @@
 
 #include <stdbool.h>
 #include <threads.h>
+
 #include "config.h"
 #include "unwind.h"
 

>From ba3b1feb17d96e6e06039e8abd7ab643676b63e3 Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin at gmail.com>
Date: Sat, 30 Sep 2023 17:48:58 -0700
Subject: [PATCH 5/5] thread.h doesn't exist in other platforms

---
 libunwind/src/Unwind-wasm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index 403a381fc1d96b7..502187e395f5bb0 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -11,13 +11,14 @@
 //===----------------------------------------------------------------------===//
 
 #include <stdbool.h>
-#include <threads.h>
 
 #include "config.h"
 #include "unwind.h"
 
 #ifdef __USING_WASM_EXCEPTIONS__
 
+#include <threads.h>
+
 _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
                                             uint64_t exceptionClass,
                                             _Unwind_Exception *unwind_exception,



More information about the cfe-commits mailing list