Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid C++ unused goto symbol warning when liburing is not supported #1250

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

ibc
Copy link
Member

@ibc ibc commented Dec 4, 2023

When compiling worker in macOS (for example) we got this warnings:

../../../src/handles/TcpConnectionHandle.cpp:270:1: warning: unused label 'write_libuv' [-Wunused-label]
write_libuv:
^~~~~~~~~~~~
1 warning generated.

../../../src/handles/UdpSocketHandle.cpp:195:1: warning: unused label 'send_libuv' [-Wunused-label]
send_libuv:
^~~~~~~~~~~
1 warning generated.

This PR fixes them.

When compiling worker in macOS (for example) we got this warnings:

```
../../../src/handles/TcpConnectionHandle.cpp:270:1: warning: unused label 'write_libuv' [-Wunused-label]
write_libuv:
^~~~~~~~~~~~
1 warning generated.

../../../src/handles/UdpSocketHandle.cpp:195:1: warning: unused label 'send_libuv' [-Wunused-label]
send_libuv:
^~~~~~~~~~~
1 warning generated.
```

This PR fixes them.
@ibc ibc requested a review from jmillan December 4, 2023 12:23
@jmillan
Copy link
Member

jmillan commented Dec 4, 2023

That's right. Here a cleaner approach:

Simply do not define the tags outside the ifdef.

diff --git a/worker/src/handles/TcpConnectionHandle.cpp b/worker/src/handles/TcpConnectionHandle.cpp
index f254ce867..dd7095ec1 100644
--- a/worker/src/handles/TcpConnectionHandle.cpp
+++ b/worker/src/handles/TcpConnectionHandle.cpp
@@ -265,9 +265,10 @@ void TcpConnectionHandle::Write(

                return;
        }
-#endif

 write_libuv:
+#endif
+
        const size_t totalLen = len1 + len2;
        uv_buf_t buffers[2];
        int written{ 0 };
diff --git a/worker/src/handles/UdpSocketHandle.cpp b/worker/src/handles/UdpSocketHandle.cpp
index e5d9c91fa..a963957c6 100644
--- a/worker/src/handles/UdpSocketHandle.cpp
+++ b/worker/src/handles/UdpSocketHandle.cpp
@@ -190,9 +190,10 @@ void UdpSocketHandle::Send(

                return;
        }
-#endif

 send_libuv:
+#endif
+
        // First try uv_udp_try_send(). In case it can not directly send the datagram
        // then build a uv_req_t and use uv_udp_send().

@ibc
Copy link
Member Author

ibc commented Dec 4, 2023

Done.

@ibc ibc requested review from jmillan and removed request for jmillan December 4, 2023 14:52
@ibc ibc merged commit b578d42 into v3 Dec 4, 2023
36 checks passed
@ibc ibc deleted the fix-usused-goto-warning-when-host-doesnt-support-liburing branch December 4, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants