From d1de6e507438b6a5fc29c208f263e82140f9668b Mon Sep 17 00:00:00 2001 From: Artyom Beilis Date: Thu, 2 Mar 2017 12:32:57 +0200 Subject: [PATCH] Cleanup of auto_ptr and some other warnings --- booster/booster/aio/io_service.h | 2 +- booster/booster/aio/reactor.h | 2 +- booster/booster/auto_ptr_inc.h | 21 +++++++++++++++++++++ booster/booster/callback.h | 2 +- booster/booster/config.h | 12 ++++++++++++ booster/booster/locale/generator.h | 2 +- booster/booster/locale/localization_backend.h | 2 +- booster/booster/locale/message.h | 2 +- booster/booster/log.h | 6 +++--- booster/booster/nowide/fstream.h | 2 +- booster/booster/shared_ptr.h | 2 +- booster/booster/smart_ptr/shared_count.h | 2 +- booster/booster/smart_ptr/sp_counted_impl.h | 2 +- booster/booster/streambuf.h | 2 +- booster/booster/system_error.h | 6 +++--- booster/booster/weak_ptr.h | 2 +- booster/lib/aio/src/stream_socket.cpp | 1 - booster/lib/locale/src/encoding/codepage.cpp | 2 +- booster/lib/locale/src/icu/codecvt.h | 2 +- booster/lib/locale/src/icu/date_time.cpp | 2 +- booster/lib/locale/src/icu/formatter.h | 2 +- booster/lib/locale/src/icu/predefined_formatters.h | 2 +- booster/lib/locale/src/icu/time_zone.cpp | 2 +- booster/lib/locale/src/icu/uconv.h | 2 +- booster/lib/locale/src/posix/codecvt.h | 2 +- booster/lib/locale/src/shared/mo_lambda.cpp | 11 ----------- booster/lib/locale/src/shared/mo_lambda.h | 2 +- booster/lib/locale/src/util/codecvt_converter.cpp | 2 +- booster/lib/locale/src/util/gregorian.cpp | 2 +- booster/lib/thread/src/pthread.cpp | 2 +- cppcms/applications_pool.h | 2 +- cppcms/archive_traits.h | 2 +- cppcms/base_view.h | 2 +- cppcms/crypto.h | 2 +- cppcms/service.h | 2 +- cppcms/session_cookies.h | 2 +- cppcms/session_dual.h | 2 +- cppcms/session_interface.h | 2 +- cppcms/session_pool.h | 2 +- cppcms/views_pool.h | 2 +- private/fastcgi_api.h | 2 +- private/http_api.h | 2 +- private/prefork_acceptor.h | 2 +- private/scgi_api.h | 2 +- private/service_impl.h | 2 +- src/cache_storage.cpp | 2 +- src/session_win32_file_storage.cpp | 2 +- tests/cache_backend_test.cpp | 2 +- tests/cache_performance_test.cpp | 2 +- tests/storage_test.cpp | 2 +- 50 files changed, 83 insertions(+), 62 deletions(-) create mode 100644 booster/booster/auto_ptr_inc.h diff --git a/booster/booster/aio/io_service.h b/booster/booster/aio/io_service.h index 109f976..cbc41f4 100644 --- a/booster/booster/aio/io_service.h +++ b/booster/booster/aio/io_service.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace booster { class ptime; diff --git a/booster/booster/aio/reactor.h b/booster/booster/aio/reactor.h index a83251c..9c69710 100644 --- a/booster/booster/aio/reactor.h +++ b/booster/booster/aio/reactor.h @@ -9,7 +9,7 @@ #define BOOSTER_AIO_REACTOR_H #include #include -#include +#include #include namespace booster { namespace aio { diff --git a/booster/booster/auto_ptr_inc.h b/booster/booster/auto_ptr_inc.h new file mode 100644 index 0000000..587ab59 --- /dev/null +++ b/booster/booster/auto_ptr_inc.h @@ -0,0 +1,21 @@ +// +// Copyright (C) 2009-2017 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +#ifndef BOOSTER_AUTO_PTR_INC_H +#define BOOSTER_AUTO_PTR_INC_H + +#include +#if defined __GLIBCXX__ +# include +# ifdef _GLIBCXX_DEPRECATED +# undef _GLIBCXX_DEPRECATED +# define _GLIBCXX_DEPRECATED +# endif +#endif +#include + +#endif // BOOSTER_AUTO_PTR_INC_H diff --git a/booster/booster/callback.h b/booster/booster/callback.h index 9307aad..b21f820 100644 --- a/booster/booster/callback.h +++ b/booster/booster/callback.h @@ -9,7 +9,7 @@ #define BOOSTER_CALLBACK_H #include -#include +#include #include #include diff --git a/booster/booster/config.h b/booster/booster/config.h index 7afae82..545ae52 100644 --- a/booster/booster/config.h +++ b/booster/booster/config.h @@ -73,5 +73,17 @@ # define BOOST_NO_SWPRINTF #endif +#if defined __GNUC__ || defined __clang__ +#define BOOSTER_UNUSED __attribute__((unused)) +#else +#define BOOSTER_UNUSED +#endif + +#if defined __clang__ +#define BOOSTER_UNUSED_MEMBER __attribute__((unused)) +#else +#define BOOSTER_UNUSED_MEMBER +#endif + #endif /// BOOSTER_CONFIG_H diff --git a/booster/booster/locale/generator.h b/booster/booster/locale/generator.h index 5da0cfe..032a1ae 100644 --- a/booster/booster/locale/generator.h +++ b/booster/booster/locale/generator.h @@ -15,7 +15,7 @@ #endif #include #include -#include +#include namespace booster { diff --git a/booster/booster/locale/localization_backend.h b/booster/booster/locale/localization_backend.h index 4829dfd..5248ce8 100644 --- a/booster/booster/locale/localization_backend.h +++ b/booster/booster/locale/localization_backend.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace booster { namespace locale { diff --git a/booster/booster/locale/message.h b/booster/booster/locale/message.h index 15054e1..48a5c0e 100644 --- a/booster/booster/locale/message.h +++ b/booster/booster/locale/message.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include diff --git a/booster/booster/log.h b/booster/booster/log.h index 7799e1c..09773ba 100644 --- a/booster/booster/log.h +++ b/booster/booster/log.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -338,8 +338,8 @@ namespace log { std::string format_file(std::string const &,int); unsigned max_files_; - size_t max_size_; - size_t current_size_; + BOOSTER_UNUSED_MEMBER size_t max_size_; + BOOSTER_UNUSED_MEMBER size_t current_size_; bool opened_; bool append_; bool use_local_time_; diff --git a/booster/booster/nowide/fstream.h b/booster/booster/nowide/fstream.h index 2d28cf6..a52b4b2 100644 --- a/booster/booster/nowide/fstream.h +++ b/booster/booster/nowide/fstream.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #if defined BOOSTER_WIN_NATIVE || defined BOOSTER_WORKAROUND_BROKEN_GCC_ON_DARWIN #include diff --git a/booster/booster/shared_ptr.h b/booster/booster/shared_ptr.h index f1c24f3..d4e19dc 100644 --- a/booster/booster/shared_ptr.h +++ b/booster/booster/shared_ptr.h @@ -16,7 +16,7 @@ #include // for broken compiler workarounds -#include +#include #include #include #include diff --git a/booster/booster/smart_ptr/shared_count.h b/booster/booster/smart_ptr/shared_count.h index 0dd0688..4dfe769 100644 --- a/booster/booster/smart_ptr/shared_count.h +++ b/booster/booster/smart_ptr/shared_count.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include // std::less #include // std::bad_alloc diff --git a/booster/booster/smart_ptr/sp_counted_impl.h b/booster/booster/smart_ptr/sp_counted_impl.h index b53c9a4..ead6cee 100644 --- a/booster/booster/smart_ptr/sp_counted_impl.h +++ b/booster/booster/smart_ptr/sp_counted_impl.h @@ -18,7 +18,7 @@ #include #if defined(BOOSTER_SP_USE_STD_ALLOCATOR) -#include // std::allocator +#include // std::allocator #endif #include // std::size_t diff --git a/booster/booster/streambuf.h b/booster/booster/streambuf.h index f55f268..2926c90 100644 --- a/booster/booster/streambuf.h +++ b/booster/booster/streambuf.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include namespace booster { diff --git a/booster/booster/system_error.h b/booster/booster/system_error.h index 7fbc2ed..e9930d6 100644 --- a/booster/booster/system_error.h +++ b/booster/booster/system_error.h @@ -61,16 +61,16 @@ namespace system { }; BOOSTER_API error_category const &get_system_category(); - static const error_category &system_category = get_system_category(); + BOOSTER_UNUSED static const error_category &system_category = get_system_category(); #ifdef BOOSTER_WIN32 BOOSTER_API error_category const &get_windows_category(); - static const error_category &windows_category = get_system_category(); + BOOSTER_UNUSED static const error_category &windows_category = get_system_category(); #endif #ifdef BOOSTER_POSIX BOOSTER_API error_category const &get_posix_category(); - static const error_category &posix_category = get_system_category(); + BOOSTER_UNUSED static const error_category &posix_category = get_system_category(); #endif diff --git a/booster/booster/weak_ptr.h b/booster/booster/weak_ptr.h index c1d840e..87c392e 100644 --- a/booster/booster/weak_ptr.h +++ b/booster/booster/weak_ptr.h @@ -13,7 +13,7 @@ // See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation. // -#include // boost.TR1 include order fix +#include // boost.TR1 include order fix #include #include diff --git a/booster/lib/aio/src/stream_socket.cpp b/booster/lib/aio/src/stream_socket.cpp index e2f0359..6ebe647 100644 --- a/booster/lib/aio/src/stream_socket.cpp +++ b/booster/lib/aio/src/stream_socket.cpp @@ -410,7 +410,6 @@ namespace { size_t count; stream_socket *self; io_handler h; - bool via_poll; }; struct writer_all : public callable diff --git a/booster/lib/locale/src/encoding/codepage.cpp b/booster/lib/locale/src/encoding/codepage.cpp index e76a05e..3c2cd35 100644 --- a/booster/lib/locale/src/encoding/codepage.cpp +++ b/booster/lib/locale/src/encoding/codepage.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include namespace booster { namespace locale { diff --git a/booster/lib/locale/src/icu/codecvt.h b/booster/lib/locale/src/icu/codecvt.h index 585248d..f37ef7e 100644 --- a/booster/lib/locale/src/icu/codecvt.h +++ b/booster/lib/locale/src/icu/codecvt.h @@ -9,7 +9,7 @@ #define BOOSTER_LOCALE_IMPL_ICU_CODECVT_HPP #include #include -#include +#include namespace booster { namespace locale { namespace impl_icu { diff --git a/booster/lib/locale/src/icu/date_time.cpp b/booster/lib/locale/src/icu/date_time.cpp index ea1da8c..23f4229 100644 --- a/booster/lib/locale/src/icu/date_time.cpp +++ b/booster/lib/locale/src/icu/date_time.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include "cdata.h" diff --git a/booster/lib/locale/src/icu/formatter.h b/booster/lib/locale/src/icu/formatter.h index 6f43189..f1bd8b3 100644 --- a/booster/lib/locale/src/icu/formatter.h +++ b/booster/lib/locale/src/icu/formatter.h @@ -9,7 +9,7 @@ #define BOOSTER_LOCALE_FORMATTER_H_INCLUDED #include -#include +#include #include #include #include diff --git a/booster/lib/locale/src/icu/predefined_formatters.h b/booster/lib/locale/src/icu/predefined_formatters.h index 8af34de..c9f663f 100644 --- a/booster/lib/locale/src/icu/predefined_formatters.h +++ b/booster/lib/locale/src/icu/predefined_formatters.h @@ -9,7 +9,7 @@ #define BOOSTER_LOCALE_PREDEFINED_FORMATTERS_H_INCLUDED #include -#include +#include #include #include #include diff --git a/booster/lib/locale/src/icu/time_zone.cpp b/booster/lib/locale/src/icu/time_zone.cpp index 73df301..8859eaf 100644 --- a/booster/lib/locale/src/icu/time_zone.cpp +++ b/booster/lib/locale/src/icu/time_zone.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #endif namespace booster { diff --git a/booster/lib/locale/src/icu/uconv.h b/booster/lib/locale/src/icu/uconv.h index 16def76..c4a6e53 100644 --- a/booster/lib/locale/src/icu/uconv.h +++ b/booster/lib/locale/src/icu/uconv.h @@ -16,7 +16,7 @@ #include #include -#include +#include #include "icu_util.h" namespace booster { diff --git a/booster/lib/locale/src/posix/codecvt.h b/booster/lib/locale/src/posix/codecvt.h index aeb38eb..7cbd34b 100644 --- a/booster/lib/locale/src/posix/codecvt.h +++ b/booster/lib/locale/src/posix/codecvt.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include namespace booster { diff --git a/booster/lib/locale/src/shared/mo_lambda.cpp b/booster/lib/locale/src/shared/mo_lambda.cpp index 8395dd8..6e51245 100644 --- a/booster/lib/locale/src/shared/mo_lambda.cpp +++ b/booster/lib/locale/src/shared/mo_lambda.cpp @@ -217,17 +217,6 @@ namespace { // anon } } - plural_ptr un_factory(int value,plural_ptr op) - { - switch(value) { - case '!': return plural_ptr(new l_not(op)); - case '~': return plural_ptr(new bin_not(op)); - case '-': return plural_ptr(new minus(op)); - default: - return plural_ptr(); - } - } - static inline bool is_in(int v,int *p) { int len=*p; diff --git a/booster/lib/locale/src/shared/mo_lambda.h b/booster/lib/locale/src/shared/mo_lambda.h index 550013f..0173215 100644 --- a/booster/lib/locale/src/shared/mo_lambda.h +++ b/booster/lib/locale/src/shared/mo_lambda.h @@ -8,7 +8,7 @@ #ifndef BOOSTER_SRC_LOCALE_MO_LAMBDA_H_INCLUDED #define BOOSTER_SRC_LOCALE_MO_LAMBDA_H_INCLUDED -#include +#include namespace booster { namespace locale { diff --git a/booster/lib/locale/src/util/codecvt_converter.cpp b/booster/lib/locale/src/util/codecvt_converter.cpp index 7c20db4..cc3c01e 100644 --- a/booster/lib/locale/src/util/codecvt_converter.cpp +++ b/booster/lib/locale/src/util/codecvt_converter.cpp @@ -627,7 +627,7 @@ namespace util { }; - static const char ensure_mbstate_size_is_at_least_2[sizeof(mbstate_t) >= 2 ? 1 : -1] = {0}; + BOOSTER_UNUSED static const char ensure_mbstate_size_is_at_least_2[sizeof(mbstate_t) >= 2 ? 1 : -1] = {0}; template<> class code_converter : public std::codecvt diff --git a/booster/lib/locale/src/util/gregorian.cpp b/booster/lib/locale/src/util/gregorian.cpp index ba7552c..cfe294b 100644 --- a/booster/lib/locale/src/util/gregorian.cpp +++ b/booster/lib/locale/src/util/gregorian.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include diff --git a/booster/lib/thread/src/pthread.cpp b/booster/lib/thread/src/pthread.cpp index e34a4fe..fcae931 100644 --- a/booster/lib/thread/src/pthread.cpp +++ b/booster/lib/thread/src/pthread.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/cppcms/applications_pool.h b/cppcms/applications_pool.h index 2bca2d1..24ae925 100644 --- a/cppcms/applications_pool.h +++ b/cppcms/applications_pool.h @@ -16,7 +16,7 @@ #include #include -#include +#include #include namespace cppcms { diff --git a/cppcms/archive_traits.h b/cppcms/archive_traits.h index af1ca34..7fd561c 100644 --- a/cppcms/archive_traits.h +++ b/cppcms/archive_traits.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/cppcms/base_view.h b/cppcms/base_view.h index b906c80..2dfc376 100644 --- a/cppcms/base_view.h +++ b/cppcms/base_view.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/cppcms/crypto.h b/cppcms/crypto.h index 7fa887b..8ac0d0d 100644 --- a/cppcms/crypto.h +++ b/cppcms/crypto.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include namespace cppcms { diff --git a/cppcms/service.h b/cppcms/service.h index b8e68c5..3ed084e 100644 --- a/cppcms/service.h +++ b/cppcms/service.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/cppcms/session_cookies.h b/cppcms/session_cookies.h index 171160e..aa19641 100644 --- a/cppcms/session_cookies.h +++ b/cppcms/session_cookies.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include namespace cppcms { class session_interface; diff --git a/cppcms/session_dual.h b/cppcms/session_dual.h index f04ed3a..efc669a 100644 --- a/cppcms/session_dual.h +++ b/cppcms/session_dual.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace cppcms { namespace sessions { diff --git a/cppcms/session_interface.h b/cppcms/session_interface.h index e36c607..48dc69b 100644 --- a/cppcms/session_interface.h +++ b/cppcms/session_interface.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/cppcms/session_pool.h b/cppcms/session_pool.h index 18a01c3..5754432 100644 --- a/cppcms/session_pool.h +++ b/cppcms/session_pool.h @@ -13,7 +13,7 @@ #include #include -#include +#include namespace cppcms { class service; diff --git a/cppcms/views_pool.h b/cppcms/views_pool.h index 4d72bea..3b284a2 100644 --- a/cppcms/views_pool.h +++ b/cppcms/views_pool.h @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include diff --git a/private/fastcgi_api.h b/private/fastcgi_api.h index 0e4b3ff..1690632 100644 --- a/private/fastcgi_api.h +++ b/private/fastcgi_api.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace cppcms { class service; diff --git a/private/http_api.h b/private/http_api.h index 65802d6..efa3b86 100644 --- a/private/http_api.h +++ b/private/http_api.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace cppcms { class service; diff --git a/private/prefork_acceptor.h b/private/prefork_acceptor.h index 62063b2..1c74147 100644 --- a/private/prefork_acceptor.h +++ b/private/prefork_acceptor.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include "cgi_api.h" diff --git a/private/scgi_api.h b/private/scgi_api.h index bf6d818..d96c03a 100644 --- a/private/scgi_api.h +++ b/private/scgi_api.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace cppcms { class service; diff --git a/private/service_impl.h b/private/service_impl.h index bfcee53..ab77192 100644 --- a/private/service_impl.h +++ b/private/service_impl.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace cppcms { diff --git a/src/cache_storage.cpp b/src/cache_storage.cpp index 4a81eb0..a582fcf 100644 --- a/src/cache_storage.cpp +++ b/src/cache_storage.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/session_win32_file_storage.cpp b/src/session_win32_file_storage.cpp index f9771d9..ce3fba3 100644 --- a/src/session_win32_file_storage.cpp +++ b/src/session_win32_file_storage.cpp @@ -17,7 +17,7 @@ #include "crc32.h" -#include +#include #include diff --git a/tests/cache_backend_test.cpp b/tests/cache_backend_test.cpp index 11aac6b..d9c8362 100644 --- a/tests/cache_backend_test.cpp +++ b/tests/cache_backend_test.cpp @@ -14,7 +14,7 @@ #include #include "test.h" #include -#include +#include #include #ifdef CPPCMS_WIN_NATIVE #include diff --git a/tests/cache_performance_test.cpp b/tests/cache_performance_test.cpp index 352afbe..c9c2f6e 100644 --- a/tests/cache_performance_test.cpp +++ b/tests/cache_performance_test.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/storage_test.cpp b/tests/storage_test.cpp index 7599788..e3d0883 100644 --- a/tests/storage_test.cpp +++ b/tests/storage_test.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include