mirror of
https://github.com/curl/curl.git
synced 2026-04-18 01:01:40 +03:00
- cmake: disable test bundles for clang-tidy builds. clang-tidy ignores #included .c sources, and incompatible with unity and bundles. It caused clang-tidy ignoring all test sources. It also means this is the first time tests sources are checked with clang-tidy. (autotools doesn't run it on tests.) - cmake: update description for `CURL_TEST_BUNDLES` option. - fix tests using special `CURLE_*` enums that were missing from `curl/curl.h`. Add them as reserved codes. - fix about ~50 other issues detected by clang-tidy: unchecked results, NULL derefs, memory leaks, casts to enums, unused assigments, uninitialized `errno` uses, unchecked `open`, indent, and more. - drop unnecessary casts (lib1533, lib3207). - suppress a few impossible cases with detailed `NOLINT`s. - lib/escape.c: drop `NOLINT` no longer necessary. Follow-up to72abf7c13a#13862 (possibly) - extend two existing `NOLINT` comments with details. Follow-up tofabfa8e402#15825 Closes #16756
62 lines
2.2 KiB
C
62 lines
2.2 KiB
C
/***************************************************************************
|
|
* _ _ ____ _
|
|
* Project ___| | | | _ \| |
|
|
* / __| | | | |_) | |
|
|
* | (__| |_| | _ <| |___
|
|
* \___|\___/|_| \_\_____|
|
|
*
|
|
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
*
|
|
* This software is licensed as described in the file COPYING, which
|
|
* you should have received as part of this distribution. The terms
|
|
* are also available at https://curl.se/docs/copyright.html.
|
|
*
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
*
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
* KIND, either express or implied.
|
|
*
|
|
* SPDX-License-Identifier: curl
|
|
*
|
|
***************************************************************************/
|
|
#include "test.h"
|
|
|
|
#include "memdebug.h"
|
|
|
|
CURLcode test(char *URL)
|
|
{
|
|
CURLcode res = CURLE_OK;
|
|
CURLcode easyret;
|
|
CURLMcode multiret;
|
|
CURLSHcode shareret;
|
|
CURLUcode urlret;
|
|
(void)URL;
|
|
|
|
/* NOLINTBEGIN(clang-analyzer-optin.core.EnumCastOutOfRange) */
|
|
curl_easy_strerror((CURLcode)INT_MAX);
|
|
curl_multi_strerror((CURLMcode)INT_MAX);
|
|
curl_share_strerror((CURLSHcode)INT_MAX);
|
|
curl_url_strerror((CURLUcode)INT_MAX);
|
|
curl_easy_strerror((CURLcode)-INT_MAX);
|
|
curl_multi_strerror((CURLMcode)-INT_MAX);
|
|
curl_share_strerror((CURLSHcode)-INT_MAX);
|
|
curl_url_strerror((CURLUcode)-INT_MAX);
|
|
/* NOLINTEND(clang-analyzer-optin.core.EnumCastOutOfRange) */
|
|
for(easyret = CURLE_OK; easyret <= CURL_LAST; easyret++) {
|
|
printf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret));
|
|
}
|
|
for(multiret = CURLM_CALL_MULTI_PERFORM; multiret <= CURLM_LAST;
|
|
multiret++) {
|
|
printf("m%d: %s\n", (int)multiret, curl_multi_strerror(multiret));
|
|
}
|
|
for(shareret = CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) {
|
|
printf("s%d: %s\n", (int)shareret, curl_share_strerror(shareret));
|
|
}
|
|
for(urlret = CURLUE_OK; urlret <= CURLUE_LAST; urlret++) {
|
|
printf("u%d: %s\n", (int)urlret, curl_url_strerror(urlret));
|
|
}
|
|
|
|
return res;
|
|
}
|