fix_remove_deprecated_errno_constants.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Calvin Watford <[email protected]>
  3. Date: Thu, 28 Mar 2024 14:28:19 -0600
  4. Subject: fix: remove deprecated errno constants
  5. Various errno constants were deprecated by POSIX. libc++ added deprecation markers on these constants.
  6. 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.
  7. See: https://github.com/llvm/llvm-project/pull/80542
  8. diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
  9. index f75a496071ac3396cbc6dec819eaab7294609deb..30f9a05f2f508b55a7d7ae036612660068c8400e 100644
  10. --- a/deps/uv/include/uv.h
  11. +++ b/deps/uv/include/uv.h
  12. @@ -155,7 +155,6 @@ struct uv__queue {
  13. XX(EFTYPE, "inappropriate file type or format") \
  14. XX(EILSEQ, "illegal byte sequence") \
  15. XX(ESOCKTNOSUPPORT, "socket type not supported") \
  16. - XX(ENODATA, "no data available") \
  17. XX(EUNATCH, "protocol driver not attached") \
  18. #define UV_HANDLE_TYPE_MAP(XX) \
  19. diff --git a/deps/uv/include/uv/errno.h b/deps/uv/include/uv/errno.h
  20. index 127278ef916161a96e23e645927d16bedfdaca5b..b36da3daa5744e6f994e32d9d82aaef689008a5f 100644
  21. --- a/deps/uv/include/uv/errno.h
  22. +++ b/deps/uv/include/uv/errno.h
  23. @@ -456,18 +456,6 @@
  24. # define UV__ESOCKTNOSUPPORT (-4025)
  25. #endif
  26. -/* FreeBSD defines ENODATA in /usr/include/c++/v1/errno.h which is only visible
  27. - * if C++ is being used. Define it directly to avoid problems when integrating
  28. - * libuv in a C++ project.
  29. - */
  30. -#if defined(ENODATA) && !defined(_WIN32)
  31. -# define UV__ENODATA UV__ERR(ENODATA)
  32. -#elif defined(__FreeBSD__)
  33. -# define UV__ENODATA (-9919)
  34. -#else
  35. -# define UV__ENODATA (-4024)
  36. -#endif
  37. -
  38. #if defined(EUNATCH) && !defined(_WIN32)
  39. # define UV__EUNATCH UV__ERR(EUNATCH)
  40. #else
  41. diff --git a/src/node_constants.cc b/src/node_constants.cc
  42. index 149c7c107322919dfeea1dfe89dc223f78b0e979..e4e8dac6b8b5924a7eae83935031e09142554747 100644
  43. --- a/src/node_constants.cc
  44. +++ b/src/node_constants.cc
  45. @@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object> target) {
  46. NODE_DEFINE_CONSTANT(target, ENOBUFS);
  47. #endif
  48. -#ifdef ENODATA
  49. - NODE_DEFINE_CONSTANT(target, ENODATA);
  50. -#endif
  51. -
  52. #ifdef ENODEV
  53. NODE_DEFINE_CONSTANT(target, ENODEV);
  54. #endif
  55. @@ -281,14 +277,6 @@ void DefineErrnoConstants(Local<Object> target) {
  56. NODE_DEFINE_CONSTANT(target, ENOSPC);
  57. #endif
  58. -#ifdef ENOSR
  59. - NODE_DEFINE_CONSTANT(target, ENOSR);
  60. -#endif
  61. -
  62. -#ifdef ENOSTR
  63. - NODE_DEFINE_CONSTANT(target, ENOSTR);
  64. -#endif
  65. -
  66. #ifdef ENOSYS
  67. NODE_DEFINE_CONSTANT(target, ENOSYS);
  68. #endif
  69. @@ -369,10 +357,6 @@ void DefineErrnoConstants(Local<Object> target) {
  70. NODE_DEFINE_CONSTANT(target, ESTALE);
  71. #endif
  72. -#ifdef ETIME
  73. - NODE_DEFINE_CONSTANT(target, ETIME);
  74. -#endif
  75. -
  76. #ifdef ETIMEDOUT
  77. NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
  78. #endif
  79. diff --git a/src/node_errors.cc b/src/node_errors.cc
  80. index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe9963d100a8b 100644
  81. --- a/src/node_errors.cc
  82. +++ b/src/node_errors.cc
  83. @@ -857,10 +857,6 @@ const char* errno_string(int errorno) {
  84. ERRNO_CASE(ENOBUFS);
  85. #endif
  86. -#ifdef ENODATA
  87. - ERRNO_CASE(ENODATA);
  88. -#endif
  89. -
  90. #ifdef ENODEV
  91. ERRNO_CASE(ENODEV);
  92. #endif
  93. @@ -899,14 +895,6 @@ const char* errno_string(int errorno) {
  94. ERRNO_CASE(ENOSPC);
  95. #endif
  96. -#ifdef ENOSR
  97. - ERRNO_CASE(ENOSR);
  98. -#endif
  99. -
  100. -#ifdef ENOSTR
  101. - ERRNO_CASE(ENOSTR);
  102. -#endif
  103. -
  104. #ifdef ENOSYS
  105. ERRNO_CASE(ENOSYS);
  106. #endif
  107. @@ -989,10 +977,6 @@ const char* errno_string(int errorno) {
  108. ERRNO_CASE(ESTALE);
  109. #endif
  110. -#ifdef ETIME
  111. - ERRNO_CASE(ETIME);
  112. -#endif
  113. -
  114. #ifdef ETIMEDOUT
  115. ERRNO_CASE(ETIMEDOUT);
  116. #endif