Skip to content

test1545: disable deprecation warnings#12444

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:test1545
Closed

test1545: disable deprecation warnings#12444
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:test1545

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Dec 2, 2023

Fixes:
https://ci.appveyor.com/project/curlorg/curl/builds/48631551/job/bhx74e0i66yrp6pk#L1205

Same with details:
https://ci.appveyor.com/project/curlorg/curl/builds/48662893/job/ol8a78q9gmilb6wt#L1263

tests/libtest/lib1545.c:38:3: error: 'curl_formadd' is deprecated: since 7.56.0. Use curl_mime_init() [-Werror=deprecated-declarations]
   38 |   curl_formadd(&m_formpost, &lastptr, CURLFORM_COPYNAME, "file",
      |   ^~~~~~~~~~~~
[...]

Follow-up to 07a3cd8 #12421

Fixes #12445
Closes #12444


The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: C:/projects/curl/tests/libtest/lib1545.c: In function 'test':

https://ci.appveyor.com/project/curlorg/curl/builds/48662115/job/oaos4h0nf8nvwvrp#L1183

What is the way to tell PowerShell to show the full error and stop?

The current $ErrorActionPreference = 'Stop' in appveyor.yml clearly stops but hides the error.
Continue (the default) shows the error but won't stop. Using Continue and the trick used by
GHA
make the script abort when running curl (with exit code 0):
https://ci.appveyor.com/project/curlorg/curl/builds/48663318/job/jx1glcllralaujpp#L445
likely because it writes to stderr, which is considered an error by PowerShell versions
offered in CI.

@github-actions github-actions bot added CI Continuous Integration Windows Windows-specific labels Dec 2, 2023
@vszakats vszakats marked this pull request as draft December 2, 2023 14:16
@github-actions github-actions bot added the tests label Dec 2, 2023
@vszakats vszakats changed the title appveyor: check test 1545 test1545: disable deprecation warnings + AppVeyor CI Dec 2, 2023
@vszakats vszakats changed the title test1545: disable deprecation warnings + AppVeyor CI test1545: disable deprecation warnings Dec 2, 2023
@vszakats vszakats removed Windows Windows-specific CI Continuous Integration labels Dec 2, 2023
@vszakats vszakats marked this pull request as ready for review December 2, 2023 20:03
@vszakats vszakats closed this in 0f10360 Dec 2, 2023
@vszakats vszakats deleted the test1545 branch December 2, 2023 20:19
vszakats added a commit that referenced this pull request Dec 21, 2023
PowerShell works (after a steep development curve), but one property of
it stuck and kept causing unresolvable usability issues: With
`$ErrorActionPreference=Stop`, it does abort on failures, but shows only
the first line of the error message. In `Continue` mode, it shows the
full error message, but doesn't stop on all errors. Another issue is
PowerShell considering any stderr output as if the command failed (this
has been improved in 7.2 (2021-Nov), but fixed versions aren't running
in CI and will not be for a long time in all test images.)

Thus, we're going with bash.

Also:
- use `-j2` with autotools tests, making them finish 5-15 minutes per
  job faster.
- omit `POSIX_PATH_PREFIX`.
- use `WINDIR`.
- prefer forward slashes.

Follow-up to: 75078a4 #11999
Ref: #12444

Fixes #12560
Closes #12572
vszakats added a commit to vszakats/curl that referenced this pull request Sep 5, 2024
vszakats added a commit that referenced this pull request Sep 20, 2024
Suppress deprecation warnings the closest to the deprecated code, using
`CURL_IGNORE_DEPRECATION()`. Then drop build-specific suppressions, and
file-wide ones. The latter is not compatible with Unity mode. Also
replace manual suppressions with a macro to apply to all compilers with
deprecation warning support. Also enable deprecation warnings for clang.

- curl/curl.h: enable deprecation warnings for clang.

- docs/examples: stop setting `CURL_DISABLE_DEPRECATION` with autotools.
  Suppression moved to C-level earlier. Syncs with cmake.
  Follow-up to 5fc61a3 #14123

- tests/http/clients: stop setting `CURL_DISABLE_DEPRECATION` in
  autotools. If it becomes necessary in the future, it can be done in
  C via the macro. Syncs with cmake.

- lib1545: stop setting `CURL_DISABLE_DEPRECATION` in autotools.
  Drop guard from test source.
  Follow-up to 0f10360 #12444

- libtest, unit: replace `CURL_DISABLE_DEPRECATION` with
  `CURL_IGNORE_DEPRECATION()`.

- docs/examples: replace pragmas with `CURL_IGNORE_DEPRECATION()`.

Closes #14789
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Suppress deprecation warnings the closest to the deprecated code, using
`CURL_IGNORE_DEPRECATION()`. Then drop build-specific suppressions, and
file-wide ones. The latter is not compatible with Unity mode. Also
replace manual suppressions with a macro to apply to all compilers with
deprecation warning support. Also enable deprecation warnings for clang.

- curl/curl.h: enable deprecation warnings for clang.

- docs/examples: stop setting `CURL_DISABLE_DEPRECATION` with autotools.
  Suppression moved to C-level earlier. Syncs with cmake.
  Follow-up to 5fc61a3 curl#14123

- tests/http/clients: stop setting `CURL_DISABLE_DEPRECATION` in
  autotools. If it becomes necessary in the future, it can be done in
  C via the macro. Syncs with cmake.

- lib1545: stop setting `CURL_DISABLE_DEPRECATION` in autotools.
  Drop guard from test source.
  Follow-up to 0f10360 curl#12444

- libtest, unit: replace `CURL_DISABLE_DEPRECATION` with
  `CURL_IGNORE_DEPRECATION()`.

- docs/examples: replace pragmas with `CURL_IGNORE_DEPRECATION()`.

Closes curl#14789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

test1545 fails to compile in an AppVeyor CI job with [-Werror=deprecated-declarations]

1 participant