#
fb711b50 |
| 29-Oct-2024 |
Viktor Szakats |
build: fix clang-cl builds, add CI job - appveyor: add build-only job for clang-cl. - cmake: `-pedantic-errors` enables `-Werror,-Wlanguage-extension-token` automatically, whi
build: fix clang-cl builds, add CI job - appveyor: add build-only job for clang-cl. - cmake: `-pedantic-errors` enables `-Werror,-Wlanguage-extension-token` automatically, which makes `__int64` detection fail. Explictly disable this compiler warning for clang-cl to make the feature detection work and to accept `__int64` in the source code. - cmake: disable `-Wlanguage-extension-token` warning for clang-cl to fix these when encountering `__int64`: ``` lib/formdata.c(797,29): error : extension used [-Werror,-Wlanguage-extension-token] lib/warnless.c(117,33): error : extension used [-Werror,-Wlanguage-extension-token] lib/warnless.c(60,28): message : expanded from macro 'CURL_MASK_SCOFFT' lib/warnless.c(59,38): message : expanded from macro 'CURL_MASK_UCOFFT' include\curl/system.h(352,40): message : expanded from macro 'CURL_TYPEOF_CURL_OFF_T' ``` - make `__GNUC__` warning suppressions apply to `__clang__` too. Necessary for clang-cl, which defines the latter, but not the former. (Regular clang defines both.) - examples: fix clang-cl compiler warning in `http2-upload.c`. ``` docs\examples\http2-upload.c(56,5): error : no previous prototype for function 'my_gettimeofday' [-Werror,-Wmissing-prototypes] docs\examples\http2-upload.c(56,1): message : declare 'static' if the function is not intended to be used outside of this translation unit ``` - unit2604: add missing `#pragma GCC diagnostic pop`. Follow-up to e53523fef07894991c69d907a7c7794c7ada4ff4 #14859 - unit1652: limit compiler warning suppression to GCC. They do not affect clang builds. Follow-up to 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772 Closes #15449
show more ...
|
#
0da1489e |
| 25-Oct-2024 |
Viktor Szakats |
build: disable warning `-Wunreachable-code-break` This warning remains silent in unity builds. Since we're using unity in CI for most jobs, warnings remain undetected there. Disable
build: disable warning `-Wunreachable-code-break` This warning remains silent in unity builds. Since we're using unity in CI for most jobs, warnings remain undetected there. Disable them for all builds to avoid a surprise warning outside our CI. The issue caught by the warning is useful for a tidy codebase, but doesn't affect executed code. It was enabled in 84338c4de2d7c798e3c270c9610d51a4ad18a90b #12331 (2023-11-15). llvm source: https://github.com/llvm/llvm-project/blob/fee2953f23bd8a8a71e574e6a8db08033778d3a4/clang/lib/Sema/AnalysisBasedWarnings.cpp#L125-L134 llvm issue: https://github.com/llvm/llvm-project/issues/71046 Follow-up to 7c023c3f6e2c454fbac7277d8dc038854c192d72 #15384 Closes #15416
show more ...
|
#
0910a412 |
| 25-Oct-2024 |
Viktor Szakats |
cmake: fix missing spacing in log message Follow-up to e89491e1f015bab8b4050ed73d1cedc17419336f #15337 Closes #15411
|
#
1da1fcc4 |
| 24-Oct-2024 |
Viktor Szakats |
cmake: tidy up picky warning initialization - use CMake 3.12 syntax when available, in clang-cl branch. Follow-up to e89491e1f015bab8b4050ed73d1cedc17419336f #15337 - rename i
cmake: tidy up picky warning initialization - use CMake 3.12 syntax when available, in clang-cl branch. Follow-up to e89491e1f015bab8b4050ed73d1cedc17419336f #15337 - rename internal variables to underscore-lowercase. Follow-up to d8de4806e1463f589a1b54de1da7d6396de94d11 #14571 - update comment. Closes #15404
show more ...
|
#
e89491e1 |
| 16-Oct-2024 |
zjyhjqs |
cmake: fix compile warnings for clang-cl clang-cl is an alternative command-line interface to Clang, designed for compatibility with the Visual C++ compiler, `cl.exe`: https://clang.
cmake: fix compile warnings for clang-cl clang-cl is an alternative command-line interface to Clang, designed for compatibility with the Visual C++ compiler, `cl.exe`: https://clang.llvm.org/docs/UsersManual.html#clang-cl The way to test clang-cl in CMake: - `CMAKE_<LANGUAGE>_COMPILER_ID`: "Clang" - `CMAKE_<LANGUAGE>_COMPILER_FRONTEND_VARIANT`: "MSVC" Note: `CMAKE_<LANGUAGE>_COMPILER_FRONTEND_VARIANT` was introduced since CMake 3.14, but the variable `MSVC` works fine here. https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.html https://cmake.org/cmake/help/latest/variable/MSVC.html Closes #15337
show more ...
|
#
4619b410 |
| 22-Sep-2024 |
Viktor Szakats |
build: fix possible `-Wformat-overflow` in lib557 with test bundle builds - lib557: suppress `-Wformat-overflow` warning in source. Fixes: ``` lib557.c: In function ‘test_f
build: fix possible `-Wformat-overflow` in lib557 with test bundle builds - lib557: suppress `-Wformat-overflow` warning in source. Fixes: ``` lib557.c: In function ‘test_float_formatting’: lib557.c:1408:37: error: ‘%*f’ directive output of 2147483648 bytes exceeds ‘INT_MAX’ [-Werror=format-overflow=] 1408 | curl_msnprintf(buf, sizeof(buf), "%*f", INT_MIN, 9.1); | ^~~ lib557.c:1408:3: note: ‘curl_msnprintf’ output 2147483649 bytes 1408 | curl_msnprintf(buf, sizeof(buf), "%*f", INT_MIN, 9.1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Ref: https://app.circleci.com/pipelines/github/curl/curl/10226/workflows/87642ee9-cda6-4916-8206-c82aac5f595e/jobs/107669?invite=true#step-106-40996_46 The root cause of why this option gets enabled remains undiscovered. Reported-by: Daniel Stenberg Fixes #15008 Follow-up to 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772 - build: drop `-Wno-format-overflow` from picky warning list. These options only get used with picky warnings enabled. Follow-up to 145f87b9e89f3a5e287233fe7d3cf57aca23dd8c #14598 - unit1652: suppress in source (and not rely on picky warnings anymore.) Closes #15012
show more ...
|
#
145f87b9 |
| 19-Aug-2024 |
Daniel Stenberg |
build: use -Wno-format-overflow -Wformat-overflow is not a warning that we want enabled as it does not help us. It can only bring us false positives since it warns on bad uses of spr
build: use -Wno-format-overflow -Wformat-overflow is not a warning that we want enabled as it does not help us. It can only bring us false positives since it warns on bad uses of sprintf and vsprintf ("that might overflow the destination buffer"). Two functions we explicitly ban in curl code. The only way this flag triggers warnings in curl code is false positives for functions we have marked with the CURL_PRINTF() macro. Further: it seems -Wformat-trunaction option might in turn also enable -Wformat-overflow, so if this second option is used, we need to explicitly set -Wno-format-overflow - not just skip setting -Wformat-overflow. Reported-by: Viktor Szakats Fixes #14168 Closes #14598
show more ...
|
#
dcf5a538 |
| 18-Aug-2024 |
Viktor Szakats |
cmake: fix `cmakelint` warnings - keep line lengths below 132 characters. - fix two "weird indentation" warnings. Reported-by: Dan Fandrich Bug: #14580 Closes #14583
|
#
f81f351b |
| 02-Aug-2024 |
Viktor Szakats |
tidy-up: OS names Use these words and casing more consistently across text, comments and one curl tool output: AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux,
tidy-up: OS names Use these words and casing more consistently across text, comments and one curl tool output: AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux, macOS, MS-DOS, MSYS, MinGW, NTLM, POSIX, Solaris, UNIX, Unix, Unicode, WINE, WebDAV, Win32, winbind, WinIDN, Windows, Windows CE, Winsock. Mostly OS names and a few more. Also a couple of other minor text fixups. Closes #14360
show more ...
|
#
acbc6b70 |
| 12-Jul-2024 |
Viktor Szakats |
cmake: tidy-ups - tidy-up comments. - use lowercase, underscore prefixed names for internal variables. - use `IN LISTS` and `IN ITEMS` in `foreach()` loops. - rename variable nam
cmake: tidy-ups - tidy-up comments. - use lowercase, underscore prefixed names for internal variables. - use `IN LISTS` and `IN ITEMS` in `foreach()` loops. - rename variable name `OUTPUT` to a more distinctive one. - tidy-up `STREQUAL` syntax. - delete commented code. - indent/whitespace. Closes #14197
show more ...
|
#
59cadacf |
| 06-Jul-2024 |
Viktor Szakats |
build: sync warning options between autotools, cmake & compilers - cmake: enable Apple-specific `-Werror=partial-availability` to match autotools. - autotools: enable `-pedant
build: sync warning options between autotools, cmake & compilers - cmake: enable Apple-specific `-Werror=partial-availability` to match autotools. - autotools: enable `-pedantic-errors` with llvm/clang to match gcc and CMake. - autotools: enable `-Werror-implicit-function-declaration` for llvm/clang to match gcc. - cmake: enable `-Werror-implicit-function-declaration` to match autotools. - move `-Wpointer-bool-conversion` from autotools to the local file (`sectransp.c`) it was meant to apply. This way it applies to all build methods. - autotoos: show `CURL_CFLAG_EXTRAS` in the `./configure` summary. (it may contain `-Werror` and/or `-pedentic-errors`.) Cherry-picked from #14097 Closes #14128
show more ...
|
#
11d27cf3 |
| 04-Apr-2024 |
Viktor Szakats |
cmake: enable `-pedantic-errors` for clang when `CURL_WERROR=ON` clang doesn't have the issues of GCC and old CMake versions. Note: This introduces asymmetry with autotools, which o
cmake: enable `-pedantic-errors` for clang when `CURL_WERROR=ON` clang doesn't have the issues of GCC and old CMake versions. Note: This introduces asymmetry with autotools, which only enables this for GCC. Reviewed-by: Daniel Stenberg Closes #13286
show more ...
|
#
f43545e9 |
| 04-Apr-2024 |
Viktor Szakats |
cmake: fix `CURL_WERROR=ON` for old CMake and use it in GHA/linux-old - cmake: fix `-pedantic-errors` for old CMake with `CURL_WERROR=ON` set. `-pedantic-errors` option throws a w
cmake: fix `CURL_WERROR=ON` for old CMake and use it in GHA/linux-old - cmake: fix `-pedantic-errors` for old CMake with `CURL_WERROR=ON` set. `-pedantic-errors` option throws a warning with GCC (all versions) and makes `check_symbol_exists()` fail in CMake versions older than v3.23.0 (2022-03-29), when CMake introduced a workaround: https://gitlab.kitware.com/cmake/cmake/-/issues/13208 https://gitlab.kitware.com/cmake/cmake/-/commit/eeb45401163d831b8c841ef6eba81466b4067b68 https://gitlab.kitware.com/cmake/cmake/-/commit/1ab7c3cd28b27ca162c4559e1026e5cad1898ade Follow-up to 3829759bd042c03225ae862062560f568ba1a231 #12489 - set `CURL_WERROR=ON` for the `linux-old` job in CI. Closes #13282
show more ...
|
#
2dbe75bd |
| 09-Dec-2023 |
Viktor Szakats |
build: fix some `-Wsign-conversion`/`-Warith-conversion` warnings - enable `-Wsign-conversion` warnings, but also setting them to not raise errors. - fix `-Warith-conversion` warni
build: fix some `-Wsign-conversion`/`-Warith-conversion` warnings - enable `-Wsign-conversion` warnings, but also setting them to not raise errors. - fix `-Warith-conversion` warnings seen in CI. These are triggered by `-Wsign-converion` and causing errors unless explicitly silenced. It makes more sense to fix them, there just a few of them. - fix some `-Wsign-conversion` warnings. - hide `-Wsign-conversion` warnings with a `#pragma`. - add macro `CURL_WARN_SIGN_CONVERSION` to unhide them on a per-build basis. - update a CI job to unhide them with the above macro: https://github.com/curl/curl/actions/workflows/linux.yml -> OpenSSL -O3 Closes #12492
show more ...
|
#
3829759b |
| 08-Dec-2023 |
Viktor Szakats |
build: enable missing OpenSSF-recommended warnings, with fixes https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html as of 2023-11-29 [1]
build: enable missing OpenSSF-recommended warnings, with fixes https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html as of 2023-11-29 [1]. Enable new recommended warnings (except `-Wsign-conversion`): - enable `-Wformat=2` for clang (in both cmake and autotools). - add `CURL_PRINTF()` internal attribute and mark functions accepting printf arguments with it. This is a copy of existing `CURL_TEMP_PRINTF()` but using `__printf__` to make it compatible with redefinting the `printf` symbol: https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC94 - fix `CURL_PRINTF()` and existing `CURL_TEMP_PRINTF()` for mingw-w64 and enable it on this platform. - enable `-Wimplicit-fallthrough`. - enable `-Wtrampolines`. - add `-Wsign-conversion` commented with a FIXME. - cmake: enable `-pedantic-errors` the way we do it with autotools. Follow-up to d5c0351055d5709da8f3e16c91348092fdb481aa #2747 - lib/curl_trc.h: use `CURL_FORMAT()`, this also fixes it to enable format checks. Previously it was always disabled due to the internal `printf` macro. Fix them: - fix bug where an `set_ipv6_v6only()` call was missed in builds with `--disable-verbose` / `CURL_DISABLE_VERBOSE_STRINGS=ON`. - add internal `FALLTHROUGH()` macro. - replace obsolete fall-through comments with `FALLTHROUGH()`. - fix fallthrough markups: Delete redundant ones (showing up as warnings in most cases). Add missing ones. Fix indentation. - silence `-Wformat-nonliteral` warnings with llvm/clang. - fix one `-Wformat-nonliteral` warning. - fix new `-Wformat` and `-Wformat-security` warnings. - fix `CURL_FORMAT_SOCKET_T` value for mingw-w64. Also move its definition to `lib/curl_setup.h` allowing use in `tests/server`. - lib: fix two wrongly passed string arguments in log outputs. Co-authored-by: Jay Satiro - fix new `-Wformat` warnings on mingw-w64. [1] https://github.com/ossf/wg-best-practices-os-developers/blob/56c0fde3895bfc55c8a973ef49a2572c507b2ae1/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C%2B%2B.md Closes #12489
show more ...
|
#
84338c4d |
| 15-Nov-2023 |
Viktor Szakats |
build: add more picky warnings and fix them Enable more picky compiler warnings. I've found these options in the nghttp3 project when implementing the CMake quick picky warning funct
build: add more picky warnings and fix them Enable more picky compiler warnings. I've found these options in the nghttp3 project when implementing the CMake quick picky warning functionality for it [1]. `-Wunused-macros` was too noisy to keep around, but fixed a few issues it revealed while testing. - autotools: reflect the more precisely-versioned clang warnings. Follow-up to 033f8e2a08eb1d3102f08c4d8c8e85470f8b460e #12324 - autotools: sync between clang and gcc the way we set `no-multichar`. - autotools: avoid setting `-Wstrict-aliasing=3` twice. - autotools: disable `-Wmissing-noreturn` for MSYS gcc targets [2]. It triggers in libtool-generated stub code. - lib/timeval: delete a redundant `!MSDOS` guard from a `WIN32` branch. - lib/curl_setup.h: delete duplicate declaration for `fileno`. Added in initial commit ae1912cb0d494b48d514d937826c9fe83ec96c4d (1999-12-29). This suggests this may not be needed anymore, but if it does, we may restore this for those specific (non-Windows) systems. - lib: delete unused macro `FTP_BUFFER_ALLOCSIZE` since c1d6fe2aaa5a26e49a69a4f2495b3cc7a24d9394. - lib: delete unused macro `isxdigit_ascii` since f65f750742068f579f4ee6d8539ed9d5f0afcb85. - lib/mqtt: delete unused macro `MQTT_HEADER_LEN`. - lib/multi: delete unused macro `SH_READ`/`SH_WRITE`. - lib/hostip: add `noreturn` function attribute via new `CURL_NORETURN` macro. - lib/mprintf: delete duplicate declaration for `Curl_dyn_vprintf`. - lib/rand: fix `-Wunreachable-code` and related fallouts [3]. - lib/setopt: fix `-Wunreachable-code-break`. - lib/system_win32 and lib/timeval: fix double declarations for `Curl_freq` and `Curl_isVistaOrGreater` in CMake UNITY mode [4]. - lib/warnless: fix double declarations in CMake UNITY mode [5]. This was due to force-disabling the header guard of `warnless.h` to to reapply it to source code coming after `warnless.c` in UNITY builds. This reapplied declarations too, causing the warnings. Solved by adding a header guard for the lines that actually need to be reapplied. - lib/vauth/digest: fix `-Wunreachable-code-break` [6]. - lib/vssh/libssh2: fix `-Wunreachable-code-break` and delete redundant block. - lib/vtls/sectransp: fix `-Wunreachable-code-break` [7]. - lib/vtls/sectransp: suppress `-Wunreachable-code`. Detected in `else` branches of dynamic feature checks, with results known at compile-time, e.g. ```c if(SecCertificateCopySubjectSummary) /* -> true */ ``` Likely fixable as a separate micro-project, but given SecureTransport is deprecated anyway, let's just silence these locally. - src/tool_help: delete duplicate declaration for `helptext`. - src/tool_xattr: fix `-Wunreachable-code`. - tests: delete duplicate declaration for `unitfail` [8]. - tests: delete duplicate declaration for `strncasecompare`. - tests/libtest: delete duplicate declaration for `gethostname`. Originally added in 687df5c8c39c370a59999b9afc0917d808d978b7 (2010-08-02). Got complicated later: c49e9683b85ba9d12cbb6eebc4ab2c8dba68fbdc If there are still systems around with warnings, we may restore the prototype, but limited for those systems. - tests/lib2305: delete duplicate declaration for `libtest_debug_config`. - tests/h2-download: fix `-Wunreachable-code-break`. [1] https://github.com/ngtcp2/nghttp3/blob/a70edb08e954d690e8fb2c1df999b5a056f8bf9f/cmake/PickyWarningsC.cmake [2] https://ci.appveyor.com/project/curlorg/curl/builds/48553586/job/3qkgjauiqla5fj45?fullLog=true#L1675 [3] https://github.com/curl/curl/actions/runs/6880886309/job/18716044703?pr=12331#step:7:72 https://github.com/curl/curl/actions/runs/6883016087/job/18722707368?pr=12331#step:7:109 [4] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L204 [5] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L218 [6] https://github.com/curl/curl/actions/runs/6880886309/job/18716042927?pr=12331#step:7:290 [7] https://github.com/curl/curl/actions/runs/6891484996/job/18746659406?pr=12331#step:9:1193 [8] https://github.com/curl/curl/actions/runs/6882803986/job/18722082562?pr=12331#step:33:1870 Closes #12331
show more ...
|
#
033f8e2a |
| 15-Nov-2023 |
Viktor Szakats |
build: picky warning updates - cmake: sync some picky gcc warnings with autotools. - cmake, autotools: add `-Wold-style-definition` for clang too. - cmake: more precise version info
build: picky warning updates - cmake: sync some picky gcc warnings with autotools. - cmake, autotools: add `-Wold-style-definition` for clang too. - cmake: more precise version info for old clang options. - cmake: use `IN LISTS` syntax in `foreach()`. Reviewed-by: Daniel Stenberg Reviewed-by: Marcel Raad Closes #12324
show more ...
|
#
9c543de0 |
| 16-Apr-2023 |
Viktor Szakats |
cmake: speed up and extend picky clang/gcc options Extend existing picky compiler options with ones missing compared to autotools builds. Also sync options between clang and gcc.
cmake: speed up and extend picky clang/gcc options Extend existing picky compiler options with ones missing compared to autotools builds. Also sync options between clang and gcc. Redesign the way we enable these options to avoid the slow option detection almost completely. This reduces the number of detections from 35 to zero for clang and 3 for gcc, even after adding a bunch of new options. clang 3.0 (2011-11-29) and gcc 2.95 (1999-07-31) now required. Also show enabled picky options. Ref: https://github.com/libssh2/libssh2/pull/952 Reviewed-by: Daniel Stenberg Closes #10973
show more ...
|