Files
allwpilib/upstream_utils/debugging_patches/0001-Guard-gnu-flatten-attribute.patch

36 lines
1005 B
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Veness <calcmogul@gmail.com>
Date: Thu, 21 Nov 2024 17:51:15 -0800
Fix more emscripten compiler errors (#7895) I ran the CMake configure with: ```bash emcmake cmake -B build-wasm -S . \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ -DWITH_SIMULATION_MODULES=OFF \ -DWITH_PROTOBUF=OFF \ -DWITH_GUI=OFF \ -DWITH_CSCORE=OFF ``` * Turned off simulation modules because they require shared libraries * Turned off GUI because glfw requires libssh * Turned off cscore because it requires OpenCV I still get the following compiler errors: ``` /home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp:43:10: fatal error: 'sys/epoll.h' file not found 43 | #include <sys/epoll.h> | ^~~~~~~~~~~~~ ``` ``` /home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp:991:56: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare] 991 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { | ^~~~~~~~~~~~~~~~~~~~~~ /home/tav/.cache/emscripten/sysroot/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR' 358 | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` ``` /home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp:748:56: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare] 748 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) | ^~~~~~~~~~~~~~~~~~~~~~ /home/tav/.cache/emscripten/sysroot/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR' 358 | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
2025-04-25 21:56:26 -07:00
Subject: [PATCH 1/5] Guard [[gnu::flatten]] attribute
---
include/debugging.hpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/debugging.hpp b/include/debugging.hpp
index 70ba724a2b6522a774931af7d7be2cee9408567a..25014a9fc65d06052089058feea7566462c01d60 100644
--- a/include/debugging.hpp
+++ b/include/debugging.hpp
@@ -7,13 +7,19 @@ namespace stdx {
bool is_debugger_present() noexcept;
-[[gnu::flatten]] inline void breakpoint() noexcept
+#if defined(__GNUC__) && !defined(__clang__)
+[[gnu::flatten]]
+#endif
+inline void breakpoint() noexcept
{
psnip_trap();
}
-[[gnu::flatten]] inline void breakpoint_if_debugging() noexcept
+#if defined(__GNUC__) && !defined(__clang__)
+[[gnu::flatten]]
+#endif
+inline void breakpoint_if_debugging() noexcept
{
if (is_debugger_present()) breakpoint();
}