tmux-3.3a-clang.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. https://github.com/tmux/tmux/pull/3332
  2. From 1b4c87de0249242309f10684761698aa880b80a5 Mon Sep 17 00:00:00 2001
  3. From: Marvin Schmidt <marv@exherbo.org>
  4. Date: Tue, 13 Sep 2022 03:25:00 +0200
  5. Subject: [PATCH 1/2] compat/systemd: Include <string.h> for strerror
  6. Recent compilers are getting stricter about function declarations being
  7. known during compilation and e.g. clang-15 now errors out if a function
  8. signature is not found:
  9. > compat/systemd.c:56:49: error: call to undeclared library function 'strerror' with type 'char *(int)'; ISO C99 and
  10. > later do not support implicit function declarations [-Wimplicit-function-declaration]
  11. > xasprintf(cause, "systemd socket error (%s)", strerror(errno));
  12. > ^
  13. > compat/systemd.c:56:49: note: include the header <string.h> or explicitly provide a declaration for 'strerror'
  14. > 1 warning and 1 error generated.
  15. Provide the declaration of `strerror` by including `<string.h>` to fix
  16. this
  17. --- a/compat/systemd.c
  18. +++ b/compat/systemd.c
  19. @@ -16,6 +16,7 @@
  20. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21. */
  22. +#include <string.h>
  23. #include <sys/types.h>
  24. #include <sys/un.h>
  25. From 1e7ef02c52f2f8a67ab05d8a1c3fec9f4ccb7ea0 Mon Sep 17 00:00:00 2001
  26. From: Marvin Schmidt <marv@exherbo.org>
  27. Date: Tue, 13 Sep 2022 03:34:01 +0200
  28. Subject: [PATCH 2/2] compat/systemd: Use socklen_t instead of int to fix
  29. warning
  30. clang-15 warns about the pointer passed to `getsockname()` being of
  31. different signedness then the parameter declaration:
  32. > compat/systemd.c:46:47: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *')
  33. > converts between pointers to integer types with different sign [-Wpointer-sign]
  34. > if (getsockname(fd, (struct sockaddr *)&sa, &addrlen) == -1)
  35. > ^~~~~~~~
  36. > /usr/x86_64-pc-linux-musl/include/sys/socket.h:391:73: note: passing argument to parameter here
  37. > int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
  38. > ^
  39. --- a/compat/systemd.c
  40. +++ b/compat/systemd.c
  41. @@ -30,7 +30,7 @@ systemd_create_socket(int flags, char **cause)
  42. int fds;
  43. int fd;
  44. struct sockaddr_un sa;
  45. - int addrlen = sizeof sa;
  46. + socklen_t addrlen = sizeof sa;
  47. fds = sd_listen_fds(0);
  48. if (fds > 1) { /* too many file descriptors */