test,sunos: fix statement not reached warnings

The Studio C compiler issues a warning if there is a `return` after an
`abort()` call or an unreachable `return` after a prior `return`.

The Studio C compiler issues a warning if there is a `return` after a
prior `return`, or an endless loop (e.g., `for (;;)`) with a `return` at
the end of the function.

PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Andrew Paprocki 2019-02-21 10:34:01 -05:00 committed by cjihrig
parent 5234b1c43a
commit 53c15c09e4
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
6 changed files with 15 additions and 3 deletions

View File

@ -92,7 +92,9 @@ int uv__getaddrinfo_translate_error(int sys_err) {
}
assert(!"unknown EAI_* error code");
abort();
#ifndef __SUNPRO_C
return 0; /* Pacify compiler. */
#endif
}

View File

@ -801,7 +801,9 @@ int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) {
return UV_ETIMEDOUT;
abort();
#ifndef __SUNPRO_C
return UV_EINVAL; /* Satisfy the compiler. */
#endif
}

View File

@ -805,13 +805,17 @@ int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
IPV6_UNICAST_HOPS,
&ttl,
sizeof(ttl));
#endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
defined(__MVS__) */
#else /* !(defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
defined(__MVS__)) */
return uv__setsockopt_maybe_char(handle,
IP_TTL,
IPV6_UNICAST_HOPS,
ttl);
#endif /* defined(__sun) || defined(_AIX) || defined (__OpenBSD__) ||
defined(__MVS__) */
}

View File

@ -36,7 +36,7 @@ const char* uv_req_type_name(uv_req_type type) {
case UV_REQ_TYPE_MAX:
case UV_UNKNOWN_REQ:
default: /* UV_REQ_TYPE_PRIVATE */
return NULL;
break;
}
return NULL;
}

View File

@ -67,7 +67,9 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}
#ifndef __SUNPRO_C
return EXIT_SUCCESS;
#endif
}

View File

@ -1861,7 +1861,9 @@ int spawn_stdin_stdout(void) {
c = c - w;
}
}
#ifndef __SUNPRO_C
return 2;
#endif
}
#else
int spawn_stdin_stdout(void) {