From: Viktor Szakats Date: Thu, 5 Sep 2024 00:11:35 +0000 (+0200) Subject: build: tidy up deprecation suppression, enable warnings for clang X-Git-Tag: curl-8_11_0~386 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cefda1b936ef91002678c03e74432a393cef8e4;p=thirdparty%2Fcurl.git build: tidy up deprecation suppression, enable warnings for clang 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 5fc61a37c1b177cefbc11dc9f5eef7b2a14538da #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 0f103600731f7e08637017ef4df67a194e0d6711 #12444 - libtest, unit: replace `CURL_DISABLE_DEPRECATION` with `CURL_IGNORE_DEPRECATION()`. - docs/examples: replace pragmas with `CURL_IGNORE_DEPRECATION()`. Closes #14789 --- diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am index 91f90cf65b..e5ff9ffdcf 100644 --- a/docs/examples/Makefile.am +++ b/docs/examples/Makefile.am @@ -34,8 +34,7 @@ EXTRA_DIST = README.md Makefile.example Makefile.mk CMakeLists.txt \ # # $(top_srcdir)/include is for libcurl's external include files -AM_CPPFLAGS = -I$(top_srcdir)/include \ - -DCURL_DISABLE_DEPRECATION +AM_CPPFLAGS = -I$(top_srcdir)/include LIBDIR = $(top_builddir)/lib diff --git a/docs/examples/multi-formadd.c b/docs/examples/multi-formadd.c index 6a927bba7b..58c7e641c4 100644 --- a/docs/examples/multi-formadd.c +++ b/docs/examples/multi-formadd.c @@ -36,11 +36,6 @@ #include -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - int main(void) { CURL *curl; @@ -53,27 +48,29 @@ int main(void) struct curl_slist *headerlist = NULL; static const char buf[] = "Expect:"; - /* Fill in the file upload field. This makes libcurl load data from - the given file name when curl_easy_perform() is called. */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "sendfile", - CURLFORM_FILE, "multi-formadd.c", - CURLFORM_END); - - /* Fill in the filename field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "filename", - CURLFORM_COPYCONTENTS, "multi-formadd.c", - CURLFORM_END); - - /* Fill in the submit field too, even if this is rarely needed */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "submit", - CURLFORM_COPYCONTENTS, "send", - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + /* Fill in the file upload field. This makes libcurl load data from + the given file name when curl_easy_perform() is called. */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile", + CURLFORM_FILE, "multi-formadd.c", + CURLFORM_END); + + /* Fill in the filename field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filename", + CURLFORM_COPYCONTENTS, "multi-formadd.c", + CURLFORM_END); + + /* Fill in the submit field too, even if this is rarely needed */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "submit", + CURLFORM_COPYCONTENTS, "send", + CURLFORM_END); + ) curl = curl_easy_init(); multi_handle = curl_multi_init(); @@ -88,7 +85,9 @@ int main(void) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + CURL_IGNORE_DEPRECATION( + curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + ) curl_multi_add_handle(multi_handle, curl); @@ -109,15 +108,13 @@ int main(void) /* always cleanup */ curl_easy_cleanup(curl); - /* then cleanup the formpost chain */ - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + /* then cleanup the formpost chain */ + curl_formfree(formpost); + ) /* free slist */ curl_slist_free_all(headerlist); } return 0; } - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif diff --git a/docs/examples/postit2-formadd.c b/docs/examples/postit2-formadd.c index 6000245b1f..0d9034612a 100644 --- a/docs/examples/postit2-formadd.c +++ b/docs/examples/postit2-formadd.c @@ -47,11 +47,6 @@ #include -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - int main(int argc, char *argv[]) { CURL *curl; @@ -64,27 +59,29 @@ int main(int argc, char *argv[]) curl_global_init(CURL_GLOBAL_ALL); - /* Fill in the file upload field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "sendfile", - CURLFORM_FILE, "postit2-formadd.c", - CURLFORM_END); - - /* Fill in the filename field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "filename", - CURLFORM_COPYCONTENTS, "postit2-formadd.c", - CURLFORM_END); - - - /* Fill in the submit field too, even if this is rarely needed */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "submit", - CURLFORM_COPYCONTENTS, "send", - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + /* Fill in the file upload field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile", + CURLFORM_FILE, "postit2-formadd.c", + CURLFORM_END); + + /* Fill in the filename field */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filename", + CURLFORM_COPYCONTENTS, "postit2-formadd.c", + CURLFORM_END); + + + /* Fill in the submit field too, even if this is rarely needed */ + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "submit", + CURLFORM_COPYCONTENTS, "send", + CURLFORM_END); + ) curl = curl_easy_init(); /* initialize custom header list (stating that Expect: 100-continue is not @@ -96,7 +93,9 @@ int main(int argc, char *argv[]) if((argc == 2) && (!strcmp(argv[1], "noexpectheader"))) /* only disable 100-continue header if explicitly requested */ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + CURL_IGNORE_DEPRECATION( + curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); + ) /* Perform the request, res gets the return code */ res = curl_easy_perform(curl); @@ -108,14 +107,13 @@ int main(int argc, char *argv[]) /* always cleanup */ curl_easy_cleanup(curl); - /* then cleanup the formpost chain */ - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + /* then cleanup the formpost chain */ + curl_formfree(formpost); + ) + /* free slist */ curl_slist_free_all(headerlist); } return 0; } - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif diff --git a/include/curl/curl.h b/include/curl/curl.h index c4fae4d446..043b7103e8 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -34,10 +34,11 @@ #endif /* Compile-time deprecation macros. */ -#if (defined(__GNUC__) && \ - ((__GNUC__ > 12) || ((__GNUC__ == 12) && (__GNUC_MINOR__ >= 1 ))) || \ - defined(__IAR_SYSTEMS_ICC__)) && \ - !defined(__INTEL_COMPILER) && \ +#if (defined(__GNUC__) && \ + ((__GNUC__ > 12) || ((__GNUC__ == 12) && (__GNUC_MINOR__ >= 1))) || \ + (defined(__clang__) && __clang_major__ >= 3) || \ + defined(__IAR_SYSTEMS_ICC__)) && \ + !defined(__INTEL_COMPILER) && \ !defined(CURL_DISABLE_DEPRECATION) && !defined(BUILDING_LIBCURL) #define CURL_DEPRECATED(version, message) \ __attribute__((deprecated("since " # version ". " message))) diff --git a/tests/http/clients/Makefile.am b/tests/http/clients/Makefile.am index 007de3c877..935614c5fd 100644 --- a/tests/http/clients/Makefile.am +++ b/tests/http/clients/Makefile.am @@ -35,8 +35,7 @@ EXTRA_DIST = CMakeLists.txt AM_CPPFLAGS = -I$(top_srcdir)/include \ -I$(top_builddir)/lib \ - -I$(top_srcdir)/lib \ - -DCURL_DISABLE_DEPRECATION + -I$(top_srcdir)/lib LIBDIR = $(top_builddir)/lib diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index d84b17643d..492548658a 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -477,7 +477,6 @@ lib1543_SOURCES = lib1518.c $(SUPPORTFILES) lib1543_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1543 lib1545_SOURCES = lib1545.c $(SUPPORTFILES) -lib1545_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_DISABLE_DEPRECATION lib1550_SOURCES = lib1550.c $(SUPPORTFILES) diff --git a/tests/libtest/lib1545.c b/tests/libtest/lib1545.c index c101b3eef2..a1891375b3 100644 --- a/tests/libtest/lib1545.c +++ b/tests/libtest/lib1545.c @@ -21,9 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#ifndef CURL_DISABLE_DEPRECATION -#define CURL_DISABLE_DEPRECATION /* Using and testing the form api */ -#endif #include "test.h" CURLcode test(char *URL) @@ -38,17 +35,20 @@ CURLcode test(char *URL) easy_init(eh); easy_setopt(eh, CURLOPT_URL, URL); - curl_formadd(&m_formpost, &lastptr, CURLFORM_COPYNAME, "file", - CURLFORM_FILE, "missing-file", CURLFORM_END); - curl_easy_setopt(eh, CURLOPT_HTTPPOST, m_formpost); + CURL_IGNORE_DEPRECATION( + curl_formadd(&m_formpost, &lastptr, CURLFORM_COPYNAME, "file", + CURLFORM_FILE, "missing-file", CURLFORM_END); + curl_easy_setopt(eh, CURLOPT_HTTPPOST, m_formpost); + ) (void)curl_easy_perform(eh); (void)curl_easy_perform(eh); test_cleanup: - curl_formfree(m_formpost); - + CURL_IGNORE_DEPRECATION( + curl_formfree(m_formpost); + ) curl_easy_cleanup(eh); curl_global_cleanup(); diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 0ec7ea2ef4..95fdf9eff3 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#define CURL_DISABLE_DEPRECATION /* Using and testing the form api */ #include "test.h" #include "memdebug.h" @@ -76,23 +75,27 @@ static CURLcode once(char *URL, bool oldstyle) /* Fill in the file upload field */ if(oldstyle) { - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "sendfile", - CURLFORM_STREAM, &pooh, - CURLFORM_CONTENTSLENGTH, (long)pooh.sizeleft, - CURLFORM_FILENAME, "postit2.c", - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile", + CURLFORM_STREAM, &pooh, + CURLFORM_CONTENTSLENGTH, (long)pooh.sizeleft, + CURLFORM_FILENAME, "postit2.c", + CURLFORM_END); + ) } else { - /* new style */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "sendfile alternative", - CURLFORM_STREAM, &pooh, - CURLFORM_CONTENTLEN, (curl_off_t)pooh.sizeleft, - CURLFORM_FILENAME, "file name 2", - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + /* new style */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "sendfile alternative", + CURLFORM_STREAM, &pooh, + CURLFORM_CONTENTLEN, (curl_off_t)pooh.sizeleft, + CURLFORM_FILENAME, "file name 2", + CURLFORM_END); + ) } if(formrc) @@ -104,52 +107,58 @@ static CURLcode once(char *URL, bool oldstyle) pooh2.readptr = data; pooh2.sizeleft = strlen(data); - /* Fill in the file upload field */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "callbackdata", - CURLFORM_STREAM, &pooh2, - CURLFORM_CONTENTSLENGTH, (long)pooh2.sizeleft, - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Fill in the file upload field */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "callbackdata", + CURLFORM_STREAM, &pooh2, + CURLFORM_CONTENTSLENGTH, (long)pooh2.sizeleft, + CURLFORM_END); + ) if(formrc) printf("curl_formadd(2) = %d\n", (int)formrc); - /* Fill in the filename field */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "filename", - CURLFORM_COPYCONTENTS, "postit2.c", - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Fill in the filename field */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filename", + CURLFORM_COPYCONTENTS, "postit2.c", + CURLFORM_END); + ) if(formrc) printf("curl_formadd(3) = %d\n", (int)formrc); - /* Fill in a submit field too */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "submit", - CURLFORM_COPYCONTENTS, "send", - CURLFORM_CONTENTTYPE, "text/plain", - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Fill in a submit field too */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "submit", + CURLFORM_COPYCONTENTS, "send", + CURLFORM_CONTENTTYPE, "text/plain", + CURLFORM_END); + ) if(formrc) printf("curl_formadd(4) = %d\n", (int)formrc); - formrc = curl_formadd(&formpost, &lastptr, - CURLFORM_COPYNAME, "somename", - CURLFORM_BUFFER, "somefile.txt", - CURLFORM_BUFFERPTR, "blah blah", - CURLFORM_BUFFERLENGTH, (long)9, - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + formrc = curl_formadd(&formpost, &lastptr, + CURLFORM_COPYNAME, "somename", + CURLFORM_BUFFER, "somefile.txt", + CURLFORM_BUFFERPTR, "blah blah", + CURLFORM_BUFFERLENGTH, (long)9, + CURLFORM_END); + ) if(formrc) printf("curl_formadd(5) = %d\n", (int)formrc); curl = curl_easy_init(); if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + curl_formfree(formpost); + ) curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } @@ -166,8 +175,10 @@ static CURLcode once(char *URL, bool oldstyle) /* we want to use our own read function */ test_setopt(curl, CURLOPT_READFUNCTION, read_callback); - /* send a multi-part formpost */ - test_setopt(curl, CURLOPT_HTTPPOST, formpost); + CURL_IGNORE_DEPRECATION( + /* send a multi-part formpost */ + test_setopt(curl, CURLOPT_HTTPPOST, formpost); + ) /* get verbose debug output please */ test_setopt(curl, CURLOPT_VERBOSE, 1L); @@ -180,11 +191,15 @@ static CURLcode once(char *URL, bool oldstyle) test_cleanup: - /* always cleanup */ - curl_easy_cleanup(curl); + CURL_IGNORE_DEPRECATION( + /* always cleanup */ + curl_easy_cleanup(curl); + ) - /* now cleanup the formpost chain */ - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + /* now cleanup the formpost chain */ + curl_formfree(formpost); + ) return res; } diff --git a/tests/libtest/lib650.c b/tests/libtest/lib650.c index 407641bb02..2945e366f6 100644 --- a/tests/libtest/lib650.c +++ b/tests/libtest/lib650.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#define CURL_DISABLE_DEPRECATION /* Using and testing the form api */ #include "test.h" #include "memdebug.h" @@ -80,12 +79,13 @@ CURLcode test(char *URL) goto test_cleanup; } headers = headers2; - formrc = curl_formadd(&formpost, &lastptr, - CURLFORM_COPYNAME, &name, - CURLFORM_COPYCONTENTS, &data, - CURLFORM_CONTENTHEADER, headers, - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + formrc = curl_formadd(&formpost, &lastptr, + CURLFORM_COPYNAME, &name, + CURLFORM_COPYCONTENTS, &data, + CURLFORM_CONTENTHEADER, headers, + CURLFORM_END); + ) if(formrc) { printf("curl_formadd(1) = %d\n", (int) formrc); goto test_cleanup; @@ -93,21 +93,22 @@ CURLcode test(char *URL) contentlength = (long)(strlen(data) - 1); - /* Use a form array for the non-copy test. */ - formarray[0].option = CURLFORM_PTRCONTENTS; - formarray[0].value = data; - formarray[1].option = CURLFORM_CONTENTSLENGTH; - formarray[1].value = (char *)(size_t)contentlength; - formarray[2].option = CURLFORM_END; - formarray[2].value = NULL; - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_PTRNAME, name, - CURLFORM_NAMELENGTH, strlen(name) - 1, - CURLFORM_ARRAY, formarray, - CURLFORM_FILENAME, "remotefile.txt", - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Use a form array for the non-copy test. */ + formarray[0].option = CURLFORM_PTRCONTENTS; + formarray[0].value = data; + formarray[1].option = CURLFORM_CONTENTSLENGTH; + formarray[1].value = (char *)(size_t)contentlength; + formarray[2].option = CURLFORM_END; + formarray[2].value = NULL; + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_PTRNAME, name, + CURLFORM_NAMELENGTH, strlen(name) - 1, + CURLFORM_ARRAY, formarray, + CURLFORM_FILENAME, "remotefile.txt", + CURLFORM_END); + ) if(formrc) { printf("curl_formadd(2) = %d\n", (int) formrc); goto test_cleanup; @@ -118,57 +119,65 @@ CURLcode test(char *URL) CURLOPT_PTRNAME actually copies the name thus we do not test this here. */ data[0]++; - /* Check multi-files and content type propagation. */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "multifile", - CURLFORM_FILE, libtest_arg2, /* Set in first.c. */ - CURLFORM_FILE, libtest_arg2, - CURLFORM_CONTENTTYPE, "text/whatever", - CURLFORM_FILE, libtest_arg2, - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Check multi-files and content type propagation. */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "multifile", + CURLFORM_FILE, libtest_arg2, /* Set in first.c. */ + CURLFORM_FILE, libtest_arg2, + CURLFORM_CONTENTTYPE, "text/whatever", + CURLFORM_FILE, libtest_arg2, + CURLFORM_END); + ) if(formrc) { printf("curl_formadd(3) = %d\n", (int) formrc); goto test_cleanup; } - /* Check data from file content. */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "filecontents", - CURLFORM_FILECONTENT, libtest_arg2, - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Check data from file content. */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "filecontents", + CURLFORM_FILECONTENT, libtest_arg2, + CURLFORM_END); + ) if(formrc) { printf("curl_formadd(4) = %d\n", (int) formrc); goto test_cleanup; } - /* Measure the current form length. - * This is done before including stdin data because we want to reuse it - * and stdin cannot be rewound. - */ - curl_formget(formpost, (void *) &formlength, count_chars); + CURL_IGNORE_DEPRECATION( + /* Measure the current form length. + * This is done before including stdin data because we want to reuse it + * and stdin cannot be rewound. + */ + curl_formget(formpost, (void *) &formlength, count_chars); + ) /* Include length in data for external check. */ curl_msnprintf(flbuf, sizeof(flbuf), "%lu", (unsigned long) formlength); - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "formlength", - CURLFORM_COPYCONTENTS, &flbuf, - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "formlength", + CURLFORM_COPYCONTENTS, &flbuf, + CURLFORM_END); + ) if(formrc) { printf("curl_formadd(5) = %d\n", (int) formrc); goto test_cleanup; } - /* Check stdin (may be problematic on some platforms). */ - formrc = curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "standardinput", - CURLFORM_FILE, "-", - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + /* Check stdin (may be problematic on some platforms). */ + formrc = curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "standardinput", + CURLFORM_FILE, "-", + CURLFORM_END); + ) if(formrc) { printf("curl_formadd(6) = %d\n", (int) formrc); goto test_cleanup; @@ -183,8 +192,10 @@ CURLcode test(char *URL) /* First set the URL that is about to receive our POST. */ test_setopt(curl, CURLOPT_URL, URL); - /* send a multi-part formpost */ - test_setopt(curl, CURLOPT_HTTPPOST, formpost); + CURL_IGNORE_DEPRECATION( + /* send a multi-part formpost */ + test_setopt(curl, CURLOPT_HTTPPOST, formpost); + ) /* get verbose debug output please */ test_setopt(curl, CURLOPT_VERBOSE, 1L); @@ -203,8 +214,10 @@ test_cleanup: /* always cleanup */ curl_easy_cleanup(curl); - /* now cleanup the formpost chain */ - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + /* now cleanup the formpost chain */ + curl_formfree(formpost); + ) curl_slist_free_all(headers); curl_global_cleanup(); diff --git a/tests/libtest/lib651.c b/tests/libtest/lib651.c index c4754ee34c..3993dfa622 100644 --- a/tests/libtest/lib651.c +++ b/tests/libtest/lib651.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#define CURL_DISABLE_DEPRECATION /* Using and testing the form api */ #include "test.h" #include "memdebug.h" @@ -50,12 +49,13 @@ CURLcode test(char *URL) return TEST_ERR_MAJOR_BAD; } - /* Check proper name and data copying. */ - formrc = curl_formadd(&formpost, &lastptr, - CURLFORM_COPYNAME, "hello", - CURLFORM_COPYCONTENTS, buffer, - CURLFORM_END); - + CURL_IGNORE_DEPRECATION( + /* Check proper name and data copying. */ + formrc = curl_formadd(&formpost, &lastptr, + CURLFORM_COPYNAME, "hello", + CURLFORM_COPYCONTENTS, buffer, + CURLFORM_END); + ) if(formrc) printf("curl_formadd(1) = %d\n", (int) formrc); @@ -63,7 +63,9 @@ CURLcode test(char *URL) curl = curl_easy_init(); if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + curl_formfree(formpost); + ) curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } @@ -71,8 +73,10 @@ CURLcode test(char *URL) /* First set the URL that is about to receive our POST. */ test_setopt(curl, CURLOPT_URL, URL); - /* send a multi-part formpost */ - test_setopt(curl, CURLOPT_HTTPPOST, formpost); + CURL_IGNORE_DEPRECATION( + /* send a multi-part formpost */ + test_setopt(curl, CURLOPT_HTTPPOST, formpost); + ) /* get verbose debug output please */ test_setopt(curl, CURLOPT_VERBOSE, 1L); @@ -88,8 +92,10 @@ test_cleanup: /* always cleanup */ curl_easy_cleanup(curl); - /* now cleanup the formpost chain */ - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + /* now cleanup the formpost chain */ + curl_formfree(formpost); + ) curl_global_cleanup(); diff --git a/tests/libtest/lib670.c b/tests/libtest/lib670.c index fad3298e95..8c4a7b9651 100644 --- a/tests/libtest/lib670.c +++ b/tests/libtest/lib670.c @@ -21,11 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - -#if !defined(LIB670) && !defined(LIB671) -#define CURL_DISABLE_DEPRECATION /* Using and testing the form api */ -#endif - #include "test.h" #include @@ -159,12 +154,14 @@ CURLcode test(char *URL) if(res == CURLE_OK) test_setopt(pooh.easy, CURLOPT_MIMEPOST, mime); #else - /* Build the form. */ - formrc = curl_formadd(&formpost, &lastptr, - CURLFORM_COPYNAME, name, - CURLFORM_STREAM, &pooh, - CURLFORM_CONTENTLEN, (curl_off_t) 2, - CURLFORM_END); + CURL_IGNORE_DEPRECATION( + /* Build the form. */ + formrc = curl_formadd(&formpost, &lastptr, + CURLFORM_COPYNAME, name, + CURLFORM_STREAM, &pooh, + CURLFORM_CONTENTLEN, (curl_off_t) 2, + CURLFORM_END); + ) if(formrc) { fprintf(stderr, "curl_formadd() = %d\n", (int) formrc); goto test_cleanup; @@ -173,8 +170,10 @@ CURLcode test(char *URL) /* We want to use our own read function. */ test_setopt(pooh.easy, CURLOPT_READFUNCTION, read_callback); - /* Send a multi-part formpost. */ - test_setopt(pooh.easy, CURLOPT_HTTPPOST, formpost); + CURL_IGNORE_DEPRECATION( + /* Send a multi-part formpost. */ + test_setopt(pooh.easy, CURLOPT_HTTPPOST, formpost); + ) #endif #if defined(LIB670) || defined(LIB672) @@ -253,7 +252,9 @@ test_cleanup: #if defined(LIB670) || defined(LIB671) curl_mime_free(mime); #else - curl_formfree(formpost); + CURL_IGNORE_DEPRECATION( + curl_formfree(formpost); + ) #endif curl_global_cleanup(); diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index 4b3921d77a..0eee841c27 100755 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -195,7 +195,6 @@ print <
@@ -352,6 +351,8 @@ CURLcode test(char *URL) res = CURLE_OUT_OF_MEMORY; goto test_cleanup; } + + CURL_IGNORE_DEPRECATION( HEADER ; @@ -584,6 +585,8 @@ MOO print <