Skip to content

Commit

Permalink
unix: fix compilation errors when using the -pedantic flag
Browse files Browse the repository at this point in the history
This commit fixes some errors that might arise when compiling
libuv with the pendanting. The error in question is
"ISO C90 forbids mixing declarations and code"

Closes: libuv#3131
  • Loading branch information
cabelitos committed May 5, 2021
1 parent 8b8b618 commit 215d1cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/unix/darwin.c
Expand Up @@ -210,6 +210,7 @@ static int uv__get_cpu_speed(uint64_t* speed) {
void* core_foundation_handle;
void* iokit_handle;
int err;
CFMutableDictionaryRef classes_to_match;

kern_return_t kr;
mach_port_t mach_port;
Expand Down Expand Up @@ -257,8 +258,7 @@ static int uv__get_cpu_speed(uint64_t* speed) {

kr = pIOMasterPort(MACH_PORT_NULL, &mach_port);
assert(kr == KERN_SUCCESS);
CFMutableDictionaryRef classes_to_match
= pIOServiceMatching("IOPlatformDevice");
classes_to_match = pIOServiceMatching("IOPlatformDevice");
kr = pIOServiceGetMatchingServices(mach_port, classes_to_match, &it);
assert(kr == KERN_SUCCESS);
service = pIOIteratorNext(it);
Expand Down
4 changes: 2 additions & 2 deletions src/unix/udp.c
Expand Up @@ -954,8 +954,8 @@ static int uv__udp_set_source_membership6(uv_udp_t* handle,
mreq.gsr_interface = 0;
}

STATIC_ASSERT(sizeof(mreq.gsr_group) >= sizeof(*multicast_addr));
STATIC_ASSERT(sizeof(mreq.gsr_source) >= sizeof(*source_addr));
assert(sizeof(mreq.gsr_group) >= sizeof(*multicast_addr));
assert(sizeof(mreq.gsr_source) >= sizeof(*source_addr));
memcpy(&mreq.gsr_group, multicast_addr, sizeof(*multicast_addr));
memcpy(&mreq.gsr_source, source_addr, sizeof(*source_addr));

Expand Down

0 comments on commit 215d1cd

Please sign in to comment.