mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 15:19:41 +00:00
Suppress clang warning for musl libc inline
Closes https://github.com/dart-lang/sdk/pull/51191 GitOrigin-RevId: d7064c43adce0b115c79e818800e44ba4f60739e Change-Id: Ie73e96c83294d43baf3be6772cb84705ba2d2712 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280136 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Slava Egorov <vegorov@google.com>
This commit is contained in:
parent
2bc3d0ef6e
commit
ddc19f7f92
|
@ -672,12 +672,9 @@ config("chromium_code") {
|
|||
cflags = [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
]
|
||||
|
||||
if (dart_sysroot != "alpine") {
|
||||
cflags += [ "-Werror" ]
|
||||
}
|
||||
|
||||
defines = []
|
||||
if (!using_sanitizer && !is_clang) {
|
||||
# _FORTIFY_SOURCE isn't really supported by Clang now, see
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
#include "bin/socket_base_macos.h"
|
||||
#include "platform/signal_blocker.h"
|
||||
|
||||
// We wrap CMSG_NXTHDR to suppress sign-compare warnings which occur on musl.
|
||||
#define CMSG_NEXTHDR(mhdr, cmsg) \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wsign-compare\"") \
|
||||
CMSG_NXTHDR(mhdr, cmsg) \
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
|
@ -151,13 +158,13 @@ intptr_t SocketBase::ReceiveMessage(intptr_t fd,
|
|||
size_t num_messages = 0;
|
||||
while (cmsg != nullptr) {
|
||||
num_messages++;
|
||||
cmsg = CMSG_NXTHDR(&msg, cmsg);
|
||||
cmsg = CMSG_NEXTHDR(&msg, cmsg);
|
||||
}
|
||||
(*p_messages) = reinterpret_cast<SocketControlMessage*>(
|
||||
Dart_ScopeAllocate(sizeof(SocketControlMessage) * num_messages));
|
||||
SocketControlMessage* control_message = *p_messages;
|
||||
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr;
|
||||
cmsg = CMSG_NXTHDR(&msg, cmsg), control_message++) {
|
||||
cmsg = CMSG_NEXTHDR(&msg, cmsg), control_message++) {
|
||||
void* data = CMSG_DATA(cmsg);
|
||||
size_t data_length = cmsg->cmsg_len - (reinterpret_cast<uint8_t*>(data) -
|
||||
reinterpret_cast<uint8_t*>(cmsg));
|
||||
|
@ -260,7 +267,7 @@ intptr_t SocketBase::SendMessage(intptr_t fd,
|
|||
struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
|
||||
message = messages;
|
||||
for (intptr_t i = 0; i < num_messages;
|
||||
i++, message++, cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
||||
i++, message++, cmsg = CMSG_NEXTHDR(&msg, cmsg)) {
|
||||
ASSERT(message->is_file_descriptors_control_message());
|
||||
cmsg->cmsg_level = SOL_SOCKET;
|
||||
cmsg->cmsg_type = SCM_RIGHTS;
|
||||
|
|
Loading…
Reference in a new issue