Files
allwpilib/upstream_utils/memory_patches/0003-Fix-deprecation-warning-for-UDLs.patch
Tyler Veness 92010c175f 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

53 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Veness <calcmogul@gmail.com>
Date: Tue, 8 Apr 2025 15:30:06 -0700
Subject: [PATCH 3/3] Fix deprecation warning for UDLs
---
include/foonathan/memory/memory_arena.hpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/foonathan/memory/memory_arena.hpp b/include/foonathan/memory/memory_arena.hpp
index eb969a677329b5b2d536f39f9a15817f040cf79f..d91f2a58cef56278cdb091daf34cebba7ec5b92c 100644
--- a/include/foonathan/memory/memory_arena.hpp
+++ b/include/foonathan/memory/memory_arena.hpp
@@ -656,32 +656,32 @@ namespace foonathan
/// \returns The number of bytes `value` is in the given unit.
/// \ingroup memory_core
/// @{
- constexpr std::size_t operator"" _KiB(unsigned long long value) noexcept
+ constexpr std::size_t operator""_KiB(unsigned long long value) noexcept
{
return std::size_t(value * 1024);
}
- constexpr std::size_t operator"" _KB(unsigned long long value) noexcept
+ constexpr std::size_t operator""_KB(unsigned long long value) noexcept
{
return std::size_t(value * 1000);
}
- constexpr std::size_t operator"" _MiB(unsigned long long value) noexcept
+ constexpr std::size_t operator""_MiB(unsigned long long value) noexcept
{
return std::size_t(value * 1024 * 1024);
}
- constexpr std::size_t operator"" _MB(unsigned long long value) noexcept
+ constexpr std::size_t operator""_MB(unsigned long long value) noexcept
{
return std::size_t(value * 1000 * 1000);
}
- constexpr std::size_t operator"" _GiB(unsigned long long value) noexcept
+ constexpr std::size_t operator""_GiB(unsigned long long value) noexcept
{
return std::size_t(value * 1024 * 1024 * 1024);
}
- constexpr std::size_t operator"" _GB(unsigned long long value) noexcept
+ constexpr std::size_t operator""_GB(unsigned long long value) noexcept
{
return std::size_t(value * 1000 * 1000 * 1000);
}