-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
When compiling the following code,
#include <httplib.h>
int main()
{
httplib::Client cli("localhost", 1234);
return 0;
}with the flags -Wall -Wextra -Werror -Wpedantic -Wshadow, there are multiple -Wshadow warnings emitted on compilation:
In file included from /test_realm/main.cpp:1:0:
/test_realm/lib/cpp-httplib/httplib.h: In lambda function:
/test_realm/lib/cpp-httplib/httplib.h:1863:54: error: declaration of 'const char* e' shadows a parameter [-Werror=shadow]
split(b, e, '=', [&](const char *b, const char *e) {
^
/test_realm/lib/cpp-httplib/httplib.h:1860:66: note: shadowed declaration is here
split(&s[0], &s[s.size()], '&', [&](const char *b, const char *e) {
^
/test_realm/lib/cpp-httplib/httplib.h:1863:54: error: declaration of 'const char* b' shadows a parameter [-Werror=shadow]
split(b, e, '=', [&](const char *b, const char *e) {
^
/test_realm/lib/cpp-httplib/httplib.h:1860:51: note: shadowed declaration is here
split(&s[0], &s[s.size()], '&', [&](const char *b, const char *e) {
^
/test_realm/lib/cpp-httplib/httplib.h: In lambda function:
/test_realm/lib/cpp-httplib/httplib.h:1894:25: error: declaration of 'm' shadows a previous local [-Werror=shadow]
std::cmatch m;
^
/test_realm/lib/cpp-httplib/httplib.h:1887:17: note: shadowed declaration is here
std::smatch m;
^
/test_realm/lib/cpp-httplib/httplib.h: In member function 'bool httplib::detail::MultipartFormDataParser::parse(const char*, size_t, T, U)':
/test_realm/lib/cpp-httplib/httplib.h:2047:16: error: declaration of 'pos' shadows a previous local [-Werror=shadow]
auto pos = buf_.find(pattern);
^~~
/test_realm/lib/cpp-httplib/httplib.h:2038:14: note: shadowed declaration is here
auto pos = buf_.find(crlf_);
^~~
/test_realm/lib/cpp-httplib/httplib.h: In lambda function:
/test_realm/lib/cpp-httplib/httplib.h:2386:37: error: declaration of 'size_t length' shadows a parameter [-Werror=shadow]
Done) { provider(offset, length, sink); };
^
/test_realm/lib/cpp-httplib/httplib.h:2380:12: note: shadowed declaration is here
size_t length,
^~~~~~
/test_realm/lib/cpp-httplib/httplib.h: In instantiation of 'bool httplib::detail::MultipartFormDataParser::parse(const char*, size_t, T, U) [with T = std::function<bool(const std::__cxx11::basic_string<char>&, const char*, long long unsigned int)>; U = std::function<bool(const std::__cxx11::basic_string<char>&, const httplib::MultipartFile&)>; size_t = long long unsigned int]':
/test_realm/lib/cpp-httplib/httplib.h:2857:91: required from here
/test_realm/lib/cpp-httplib/httplib.h:2047:16: error: declaration of 'pos' shadows a previous local [-Werror=shadow]
auto pos = buf_.find(pattern);
^~~
/test_realm/lib/cpp-httplib/httplib.h:2038:14: note: shadowed declaration is here
auto pos = buf_.find(crlf_);
^~~
It would be great if these could be addressed.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels