2024-04-15 18:10:32 -04:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Calvin Watford <cwatford@slack-corp.com>
Date: Thu, 28 Mar 2024 14:28:19 -0600
Subject: fix: remove deprecated errno constants
Various errno constants were deprecated by POSIX. libc++ added deprecation markers on these constants.
This change removes the usage of these constants to fix a compilation failure due to mappings of those constants. This patch should be upstreamed to node/libuv.
See: https://github.com/llvm/llvm-project/pull/80542
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
2025-06-30 14:49:12 +02:00
index 0295eeddbb4eb1cffd9dbcd02e037907fadc1b7e..7c2f9d2a8b13584ff6b33cd3ff4745e9fb3c4170 100644
2024-04-15 18:10:32 -04:00
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
2025-06-30 14:49:12 +02:00
@@ -156,7 +156,6 @@ struct uv__queue {
2024-04-15 18:10:32 -04:00
XX(EFTYPE, "inappropriate file type or format") \
XX(EILSEQ, "illegal byte sequence") \
XX(ESOCKTNOSUPPORT, "socket type not supported") \
- XX(ENODATA, "no data available") \
XX(EUNATCH, "protocol driver not attached") \
2025-06-30 14:49:12 +02:00
XX(ENOEXEC, "exec format error") \
2024-04-15 18:10:32 -04:00
diff --git a/deps/uv/include/uv/errno.h b/deps/uv/include/uv/errno.h
2025-06-30 14:49:12 +02:00
index ac00778cfc59fb55e361b24fc81a965a5e8f97e7..f0c4d6dfc9f03bee59e656b2da9ac325bced7b69 100644
2024-04-15 18:10:32 -04:00
--- a/deps/uv/include/uv/errno.h
+++ b/deps/uv/include/uv/errno.h
@@ -456,18 +456,6 @@
# define UV__ESOCKTNOSUPPORT (-4025)
#endif
-/* FreeBSD defines ENODATA in /usr/include/c++/v1/errno.h which is only visible
- * if C++ is being used. Define it directly to avoid problems when integrating
- * libuv in a C++ project.
- */
-#if defined(ENODATA) && !defined(_WIN32)
-# define UV__ENODATA UV__ERR(ENODATA)
-#elif defined(__FreeBSD__)
-# define UV__ENODATA (-9919)
-#else
-# define UV__ENODATA (-4024)
-#endif
-
#if defined(EUNATCH) && !defined(_WIN32)
# define UV__EUNATCH UV__ERR(EUNATCH)
#else
diff --git a/src/node_constants.cc b/src/node_constants.cc
2025-06-30 14:49:12 +02:00
index 8c44e32381a44675792ca0922e47df1adda48e41..d193725ea9a3270ed9affea12d11467fb14efdf8 100644
2024-04-15 18:10:32 -04:00
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object> target) {
NODE_DEFINE_CONSTANT(target, ENOBUFS);
#endif
-#ifdef ENODATA
- NODE_DEFINE_CONSTANT(target, ENODATA);
-#endif
-
#ifdef ENODEV
NODE_DEFINE_CONSTANT(target, ENODEV);
#endif
@@ -281,14 +277,6 @@ void DefineErrnoConstants(Local<Object> target) {
NODE_DEFINE_CONSTANT(target, ENOSPC);
#endif
-#ifdef ENOSR
- NODE_DEFINE_CONSTANT(target, ENOSR);
-#endif
-
-#ifdef ENOSTR
- NODE_DEFINE_CONSTANT(target, ENOSTR);
-#endif
-
#ifdef ENOSYS
NODE_DEFINE_CONSTANT(target, ENOSYS);
#endif
@@ -369,10 +357,6 @@ void DefineErrnoConstants(Local<Object> target) {
NODE_DEFINE_CONSTANT(target, ESTALE);
#endif
-#ifdef ETIME
- NODE_DEFINE_CONSTANT(target, ETIME);
-#endif
-
#ifdef ETIMEDOUT
NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
#endif
diff --git a/src/node_errors.cc b/src/node_errors.cc
2025-05-05 10:23:17 +02:00
index 5f51add4cdf68a9487edfc9382f586cc94539571..befb642f1effa3c4139e4cd99ff64d9c5175fd72 100644
2024-04-15 18:10:32 -04:00
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
2025-02-14 11:05:01 +01:00
@@ -862,10 +862,6 @@ const char* errno_string(int errorno) {
2024-04-15 18:10:32 -04:00
ERRNO_CASE(ENOBUFS);
#endif
-#ifdef ENODATA
- ERRNO_CASE(ENODATA);
-#endif
-
#ifdef ENODEV
ERRNO_CASE(ENODEV);
#endif
2025-02-14 11:05:01 +01:00
@@ -904,14 +900,6 @@ const char* errno_string(int errorno) {
2024-04-15 18:10:32 -04:00
ERRNO_CASE(ENOSPC);
#endif
-#ifdef ENOSR
- ERRNO_CASE(ENOSR);
-#endif
-
-#ifdef ENOSTR
- ERRNO_CASE(ENOSTR);
-#endif
-
#ifdef ENOSYS
ERRNO_CASE(ENOSYS);
#endif
2025-02-14 11:05:01 +01:00
@@ -994,10 +982,6 @@ const char* errno_string(int errorno) {
2024-04-15 18:10:32 -04:00
ERRNO_CASE(ESTALE);
#endif
-#ifdef ETIME
- ERRNO_CASE(ETIME);
-#endif
-
#ifdef ETIMEDOUT
ERRNO_CASE(ETIMEDOUT);
#endif