Skip to content

Commit

Permalink
configure: silence compiler warnings in feature checks, drop duplicates
Browse files Browse the repository at this point in the history
Silence compiler warnings (200 of them across the main CI workflows):
```
warning curl#2193: null argument provided for parameter marked with attribute "nonnull"
warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker]
warning: argument 1 null where non-null expected [-Wnonnull]
warning: argument 2 null where non-null expected [-Wnonnull]
warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
warning: null argument where non-null required (argument 1) [-Wnonnull]
```

Also drop `if ... can be linked` feature checks that were identical to
`if ... is compilable` checks, for:
`closesocket`, `ioctlsocket`, `socket`, `freeaddrinfo`, `getaddrinfo`,
`gethostname`, `getpeername`, `getsockname`,
`CloseSocket` (AmigaOS), `IoctlSocket` (AmigaOS).
Another option is to really do the link checks. But, if they weren't
missed so far, it seems safer to drop than risk a detection failure,
as was the case with AmigaOS functions while working on this PR.

There remain 22 `-Wnonnull` warnings in `gethostbyname_r()`,
`getpeername()` `getsockname()`. Most of the rest is necessary for
detection, or originate from autotools and CMake detection code
templates. Some still fixable, like duplicate libs.

Follow-up to ca2f49d curl#16287
Closes curl#16377
  • Loading branch information
vszakats committed Feb 21, 2025
1 parent 2a292c3 commit bd9f9b0
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 297 deletions.
3 changes: 2 additions & 1 deletion acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
#endif
#endif
]],[[
send(0, 0, 0, 0);
char s[] = "";
send(0, (void *)s, 0, 0);
]])
],[
AC_MSG_RESULT([yes])
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
{
int s = (int)sizeof(struct sockaddr_in6);
(void)s;
return socket(AF_INET6, SOCK_STREAM, 0) < 0;
return socket(AF_INET6, SOCK_STREAM, 0) > 0;
}
]])
],
Expand Down
Loading

0 comments on commit bd9f9b0

Please sign in to comment.