1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-23 16:21:00 +03:00

build: prepare builds for clang-cl, add cmake ossfuzz support

- cmake: add support to build ossfuzz.
  Enable with `-DBUILD_OSSFUZZ=ON`.
  Also supports `-DLIB_FUZZING_ENGINE=` like autotools does.
- check for `__clang__` when suppressing warnings in source. Necessary
  for clang-cl, which set `__clang__`, but doesn't set `__GNU__`.
- cmake: optimize out 4 picky warning option detections with gcc.
- cmake: bring `-pedantic-error`, `-Wall` use closer to curl's.
- cmake: set `-Wno-language-extension-token` for clang-cl.
- cmake: escape only the necessary `-W` options for clang-cl.
- cmake: apply picky warnings to C++.
- cmake: replace `unset(VAR)` with `set(VAR "")` for init.
- cmake: prefer dash-style MSVC options.
- cmake: simplify `MATCHES` expression.
- cmake: formatting/whitespace.
- ci/GHA: bump `actions/upload-artifact` to v4

Closes #1524
This commit is contained in:
Viktor Szakats
2024-10-30 00:59:03 +01:00
parent af5c9fb88f
commit 854cfa8292
22 changed files with 158 additions and 131 deletions

View File

@ -246,12 +246,12 @@ int main(int argc, char *argv[])
for(;;) {
fd_set fds;
FD_ZERO(&fds);
#if defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
FD_SET(forwardsock, &fds);
#if defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
tv.tv_sec = 0;
@ -261,12 +261,12 @@ int main(int argc, char *argv[])
fprintf(stderr, "failed to select().\n");
goto shutdown;
}
#if defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
if(rc && FD_ISSET(forwardsock, &fds)) {
#if defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
ssize_t nwritten;