Skip to content

Commit

Permalink
Tactically disable -Wunreachable-code and -Wundef
Browse files Browse the repository at this point in the history
Summary: Suppress `-Wunreachable-code` and `-Wundef` warnings when building with `arvr/mode/platform010`.

Reviewed By: ohcnivek

Differential Revision: D61980555

fbshipit-source-id: ca4793fd83bec1a75d7232d39f2fc1423228c3d9
  • Loading branch information
Gabriel Agamennoni authored and facebook-github-bot committed Sep 4, 2024
1 parent 8356e59 commit b033998
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions folly/net/NetOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ int recvmmsg(
return wrapSocketFunction<int>(::recvmmsg, s, msgvec, vlen, flags, timeout);
}
// implement via recvmsg
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wunreachable-code")
for (unsigned int i = 0; i < vlen; i++) {
ssize_t ret = recvmsg(s, &msgvec[i].msg_hdr, flags);
// in case of an error
Expand All @@ -417,6 +419,7 @@ int recvmmsg(
}
}
return static_cast<int>(vlen);
FOLLY_POP_WARNING
#endif
}

Expand Down Expand Up @@ -548,6 +551,8 @@ int sendmmsg(
return wrapSocketFunction<int>(::sendmmsg, socket, msgvec, vlen, flags);
}
// implement via sendmsg
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wunreachable-code")
for (unsigned int i = 0; i < vlen; i++) {
ssize_t ret = sendmsg(socket, &msgvec[i].msg_hdr, flags);
// in case of an error
Expand All @@ -565,6 +570,7 @@ int sendmmsg(
}

return static_cast<int>(vlen);
FOLLY_POP_WARNING
#endif
}

Expand Down Expand Up @@ -787,6 +793,8 @@ int set_socket_close_on_exec(NetworkSocket s) {
}

void Msgheader::setName(sockaddr_storage* addrStorage, size_t len) {
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wundef")
#ifdef _WIN32
msg_.name = reinterpret_cast<LPSOCKADDR>(addrStorage);
msg_.namelen = len;
Expand All @@ -796,6 +804,7 @@ void Msgheader::setName(sockaddr_storage* addrStorage, size_t len) {
msg_.msg_name = reinterpret_cast<void*>(addrStorage);
msg_.msg_namelen = len;
#endif
FOLLY_POP_WARNING
}

void Msgheader::setIovecs(const struct iovec* vec, size_t iovec_len) {
Expand Down Expand Up @@ -838,13 +847,16 @@ void Msgheader::setFlags(int flags) {
}

void Msgheader::incrCmsgLen(size_t val) {
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wundef")
#ifdef _WIN32
msg_.Control.len += WSA_CMSG_SPACE(val);
#elif __EMSCRIPTEN__
assert(false); // not supported in emcc
#else
msg_.msg_controllen += CMSG_SPACE(val);
#endif
FOLLY_POP_WARNING
}

XPLAT_CMSGHDR* Msgheader::getFirstOrNextCmsgHeader(XPLAT_CMSGHDR* cm) {
Expand All @@ -856,23 +868,29 @@ XPLAT_MSGHDR* Msgheader::getMsg() {
}

XPLAT_CMSGHDR* Msgheader::cmsgNextHrd(XPLAT_CMSGHDR* cm) {
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wundef")
#ifdef _WIN32
return WSA_CMSG_NXTHDR(&msg_, cm);
#elif __EMSCRIPTEN__
assert(false); // not supported in emcc
#else
return CMSG_NXTHDR(&msg_, cm);
#endif
FOLLY_POP_WARNING
}

XPLAT_CMSGHDR* Msgheader::cmsgFirstHrd() {
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wundef")
#ifdef _WIN32
return WSA_CMSG_FIRSTHDR(&msg_);
#elif __EMSCRIPTEN__
assert(false); // not supported in emcc
#else
return CMSG_FIRSTHDR(&msg_);
#endif
FOLLY_POP_WARNING
}
} // namespace netops
} // namespace folly

0 comments on commit b033998

Please sign in to comment.