From a6e96f31f52a0180a19d115e47fc07cf2c6d4405 Mon Sep 17 00:00:00 2001 From: neverchanje Date: Fri, 26 Mar 2021 20:29:39 +0800 Subject: [PATCH] build: fix compilation errors on clang-10 --- bin/dsn.cmake | 6 ++++++ src/http/pprof_http_service.cpp | 4 ++-- src/meta/test/meta_bulk_load_service_test.cpp | 4 ++-- src/meta/test/meta_split_service_test.cpp | 2 +- src/replica/replica.h | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/dsn.cmake b/bin/dsn.cmake index c83d1b88e2..de661d4fbe 100644 --- a/bin/dsn.cmake +++ b/bin/dsn.cmake @@ -203,6 +203,12 @@ function(dsn_setup_compiler_flags) # use frame pointers to allow simple stack frame walking for backtraces. # This has a small perf hit but worth it for the ability to profile in production add_compile_options( -fno-omit-frame-pointer) + # -Wno-deprecated-register + # kbr5.h uses the legacy 'register' keyword. + add_compile_options(-Wno-deprecated-register) + # -Wimplicit-int-float-conversion + # Poco/Dynamic/VarHolder.h uses 'unsigned long' to 'float' conversion + add_compile_options(-Wno-implicit-int-float-conversion) find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) diff --git a/src/http/pprof_http_service.cpp b/src/http/pprof_http_service.cpp index 4cce6eef19..60ead0baca 100644 --- a/src/http/pprof_http_service.cpp +++ b/src/http/pprof_http_service.cpp @@ -474,9 +474,9 @@ void pprof_http_service::profile_handler(const http_request &req, http_response useconds_t seconds = 60000000; - const char *req_url = req.full_url.to_string().data(); + std::string req_url = req.full_url.to_string(); size_t len = req.full_url.length(); - string_splitter url_sp(req_url, req_url + len, '?'); + string_splitter url_sp(req_url.data(), req_url.data() + len, '?'); if (url_sp != NULL && ++url_sp != NULL) { string_splitter param_sp(url_sp.field(), url_sp.field() + url_sp.length(), '&'); while (param_sp != NULL) { diff --git a/src/meta/test/meta_bulk_load_service_test.cpp b/src/meta/test/meta_bulk_load_service_test.cpp index 820e5a8792..bfc5060966 100644 --- a/src/meta/test/meta_bulk_load_service_test.cpp +++ b/src/meta/test/meta_bulk_load_service_test.cpp @@ -210,7 +210,7 @@ class bulk_load_service_test : public meta_test_base ainfo.app_id, app_path, dsn::enum_to_string(ainfo.status)); - for (const auto kv : partition_bulk_load_info_map) { + for (const auto &kv : partition_bulk_load_info_map) { mock_partition_bulk_load_info_on_remote_storage(gpid(ainfo.app_id, kv.first), kv.second); } @@ -280,7 +280,7 @@ class bulk_load_service_test : public meta_test_base int32_t get_partition_bulk_load_info_size(int32_t app_id) { int count = 0; - for (const auto kv : bulk_svc()._partition_bulk_load_info) { + for (const auto &kv : bulk_svc()._partition_bulk_load_info) { if (kv.first.get_app_id() == app_id) { ++count; } diff --git a/src/meta/test/meta_split_service_test.cpp b/src/meta/test/meta_split_service_test.cpp index 4bcd6901db..e72560d239 100644 --- a/src/meta/test/meta_split_service_test.cpp +++ b/src/meta/test/meta_split_service_test.cpp @@ -284,7 +284,7 @@ class meta_split_service_test : public meta_test_base std::string path = app_root; _ms->get_meta_storage()->create_node( - std::move(path), blob(lock_state, 0, strlen(lock_state)), [this, &app_root]() { + std::move(path), blob(lock_state, 0, strlen(lock_state)), [&app_root]() { ddebug_f("create app root {}", app_root); }); wait_all(); diff --git a/src/replica/replica.h b/src/replica/replica.h index ab844dabac..1ad244be35 100644 --- a/src/replica/replica.h +++ b/src/replica/replica.h @@ -72,7 +72,7 @@ class replica_disk_migrator; class cold_backup_context; typedef dsn::ref_ptr cold_backup_context_ptr; -class cold_backup_metadata; +struct cold_backup_metadata; namespace test { class test_checker;