diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-09-07 10:52:48 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-09-08 13:53:02 +0200 |
commit | 17fcdf6a310d4c80762455ee9d5e4f52bd55c809 (patch) | |
tree | 747916b49eb0913ab3405ecb3b4484ad104e77d9 /tests/libtest | |
parent | ad425d3e3e2e9b5325332f4b883cdcb23e3f071e (diff) | |
download | curl-17fcdf6a310d4c80762455ee9d5e4f52bd55c809.tar.gz |
lib: fix -Wassign-enum warnings
configure --enable-debug now enables -Wassign-enum with clang,
identifying several enum "abuses" also fixed.
Reported-by: Gisle Vanem
Bug: https://github.com/curl/curl/commit/879007f8118771f4896334731aaca5850a154675#commitcomment-42087553
Closes #5929
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/lib1538.c | 14 | ||||
-rw-r--r-- | tests/libtest/lib1560.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib1592.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib556.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib583.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib661.c | 2 | ||||
-rwxr-xr-x | tests/libtest/mk-lib1521.pl | 2 | ||||
-rw-r--r-- | tests/libtest/test.h | 46 |
8 files changed, 38 insertions, 38 deletions
diff --git a/tests/libtest/lib1538.c b/tests/libtest/lib1538.c index 91481e88d..0f91e2f0c 100644 --- a/tests/libtest/lib1538.c +++ b/tests/libtest/lib1538.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2020, 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 @@ -31,12 +31,12 @@ int test(char *URL) CURLSHcode shareret; (void)URL; - curl_easy_strerror(INT_MAX); - curl_multi_strerror(INT_MAX); - curl_share_strerror(INT_MAX); - curl_easy_strerror(-INT_MAX); - curl_multi_strerror(-INT_MAX); - curl_share_strerror(-INT_MAX); + curl_easy_strerror((CURLcode)INT_MAX); + curl_multi_strerror((CURLMcode)INT_MAX); + curl_share_strerror((CURLSHcode)INT_MAX); + curl_easy_strerror((CURLcode)-INT_MAX); + curl_multi_strerror((CURLMcode)-INT_MAX); + curl_share_strerror((CURLSHcode)-INT_MAX); for(easyret = CURLE_OK; easyret <= CURL_LAST; easyret++) { printf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret)); } diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 20f852310..cc61199e9 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -638,7 +638,7 @@ static CURLUPart part2id(char *part) return CURLUPART_FRAGMENT; if(!strcmp("zoneid", part)) return CURLUPART_ZONEID; - return 9999; /* bad input => bad output */ + return (CURLUPart)9999; /* bad input => bad output */ } static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags) diff --git a/tests/libtest/lib1592.c b/tests/libtest/lib1592.c index 5e6bf04eb..ce0892be2 100644 --- a/tests/libtest/lib1592.c +++ b/tests/libtest/lib1592.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2020, 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 @@ -43,7 +43,7 @@ int test(char *URL) int stillRunning; CURLM *multiHandle = NULL; CURL *curl = NULL; - CURLMcode res = CURLM_OK; + CURLcode res = CURLE_OK; int timeout; global_init(CURL_GLOBAL_ALL); diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index 0595000ce..82e8b71dc 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2020, 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 @@ -96,7 +96,7 @@ int test(char *URL) } if(iolen != 0) - res = TEST_ERR_FAILURE; + res = (CURLcode)TEST_ERR_FAILURE; } test_cleanup: diff --git a/tests/libtest/lib583.c b/tests/libtest/lib583.c index 86dd8b55a..3e2fe3867 100644 --- a/tests/libtest/lib583.c +++ b/tests/libtest/lib583.c @@ -35,7 +35,7 @@ int test(char *URL) int stillRunning; CURLM *multiHandle = NULL; CURL *curl = NULL; - CURLMcode res = CURLM_OK; + CURLcode res = CURLE_OK; global_init(CURL_GLOBAL_ALL); diff --git a/tests/libtest/lib661.c b/tests/libtest/lib661.c index a4f2c8e5c..454d8f337 100644 --- a/tests/libtest/lib661.c +++ b/tests/libtest/lib661.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2020, 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 diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index e71fe1e51..9b57b64ee 100755 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -297,7 +297,7 @@ while(<STDIN>) { print <<FOOTER - curl_easy_setopt(curl, 1, 0); + curl_easy_setopt(curl, (CURLoption)1, 0); res = CURLE_OK; test_cleanup: curl_easy_cleanup(curl); diff --git a/tests/libtest/test.h b/tests/libtest/test.h index 4806375a0..3e92598bc 100644 --- a/tests/libtest/test.h +++ b/tests/libtest/test.h @@ -86,18 +86,18 @@ extern int unitfail; ** For portability reasons TEST_ERR_* values should be less than 127. */ -#define TEST_ERR_MAJOR_BAD 126 -#define TEST_ERR_RUNS_FOREVER 125 -#define TEST_ERR_EASY_INIT 124 -#define TEST_ERR_MULTI_INIT 123 -#define TEST_ERR_NUM_HANDLES 122 -#define TEST_ERR_SELECT 121 -#define TEST_ERR_SUCCESS 120 -#define TEST_ERR_FAILURE 119 -#define TEST_ERR_USAGE 118 -#define TEST_ERR_FOPEN 117 -#define TEST_ERR_FSTAT 116 -#define TEST_ERR_BAD_TIMEOUT 115 +#define TEST_ERR_MAJOR_BAD (CURLcode) 126 +#define TEST_ERR_RUNS_FOREVER (CURLcode) 125 +#define TEST_ERR_EASY_INIT (CURLcode) 124 +#define TEST_ERR_MULTI (CURLcode) 123 +#define TEST_ERR_NUM_HANDLES (CURLcode) 122 +#define TEST_ERR_SELECT (CURLcode) 121 +#define TEST_ERR_SUCCESS (CURLcode) 120 +#define TEST_ERR_FAILURE (CURLcode) 119 +#define TEST_ERR_USAGE (CURLcode) 118 +#define TEST_ERR_FOPEN (CURLcode) 117 +#define TEST_ERR_FSTAT (CURLcode) 116 +#define TEST_ERR_BAD_TIMEOUT (CURLcode) 115 /* ** Macros for test source code readability/maintainability. @@ -154,7 +154,7 @@ extern int unitfail; #define exe_multi_init(A,Y,Z) do { \ if(((A) = curl_multi_init()) == NULL) { \ fprintf(stderr, "%s:%d curl_multi_init() failed\n", (Y), (Z)); \ - res = TEST_ERR_MULTI_INIT; \ + res = TEST_ERR_MULTI; \ } \ } while(0) @@ -178,7 +178,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_easy_setopt() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_easy_strerror(ec)); \ - res = (int)ec; \ + res = ec; \ } \ } while(0) @@ -202,7 +202,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_setopt() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ } while(0) @@ -226,7 +226,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ } while(0) @@ -250,7 +250,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ } while(0) @@ -275,7 +275,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_perform() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ else if(*((B)) < 0) { \ fprintf(stderr, "%s:%d curl_multi_perform() succeeded, " \ @@ -305,7 +305,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_fdset() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ else if(*((E)) < -1) { \ fprintf(stderr, "%s:%d curl_multi_fdset() succeeded, " \ @@ -335,7 +335,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_timeout() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_BAD_TIMEOUT; \ } \ else if(*((B)) < -1L) { \ fprintf(stderr, "%s:%d curl_multi_timeout() succeeded, " \ @@ -365,7 +365,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_poll() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ else if(*((E)) < 0) { \ fprintf(stderr, "%s:%d curl_multi_poll() succeeded, " \ @@ -395,7 +395,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ + res = TEST_ERR_MULTI; \ } \ } while(0) @@ -470,7 +470,7 @@ extern int unitfail; fprintf(stderr, "%s:%d curl_global_init() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_easy_strerror(ec)); \ - res = (int)ec; \ + res = ec; \ } \ } while(0) |