examples: suppress deprecation warnings locally

Simplify making clean builds by silencing deprecation warnings inside
the example code where these may occur.

Drop related build tweaks/comments from GHA jobs.

Example warning:
```
curl/docs/examples/postit2-formadd.c:65:16: error: 'CURLFORM_COPYNAME' is deprecated: since 7.56.0. Use curl_mime_name() [-Werror=deprecated-declarations]
   65 |                CURLFORM_COPYNAME, "sendfile",
      |                ^~~~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9841099503/job/27166970904#step:10:829

Closes #14123
This commit is contained in:
Viktor Szakats 2024-07-08 16:02:21 +02:00
parent 72341068a2
commit 5fc61a37c1
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
4 changed files with 20 additions and 6 deletions

View file

@ -36,6 +36,11 @@
#include <curl/curl.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
int main(void)
{
CURL *curl;
@ -112,3 +117,7 @@ int main(void)
}
return 0;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View file

@ -47,6 +47,11 @@
#include <curl/curl.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
int main(int argc, char *argv[])
{
CURL *curl;
@ -110,3 +115,7 @@ int main(int argc, char *argv[])
}
return 0;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif