diff --git a/SConstruct b/SConstruct index 3da1733..e01ff04 100644 --- a/SConstruct +++ b/SConstruct @@ -110,6 +110,19 @@ elif env['CXX'].startswith('clang++'): env.Append(CCFLAGS = ['-Wshadow']) env.Append(CCFLAGS = ['-Wunused-parameter']) + env.Append(CCFLAGS = ['-Wsometimes-uninitialized']) + env.Append(CCFLAGS = ['-Wuninitialized']) + + #env.Append(CCFLAGS = ['-Weverything']) + #env.Append(CCFLAGS = ['-Wno-documentation']) + #env.Append(CCFLAGS = ['-Wno-weak-vtables']) + #env.Append(CCFLAGS = ['-Wno-global-constructors']) + #env.Append(CCFLAGS = ['-Wno-sign-conversion']) + #env.Append(CCFLAGS = ['-Wno-exit-time-destructors']) + + + + # Wpadded # Wsign-conversion diff --git a/examples/broadcast_server/broadcast_server.cpp b/examples/broadcast_server/broadcast_server.cpp index 92b59b4..e87e879 100644 --- a/examples/broadcast_server/broadcast_server.cpp +++ b/examples/broadcast_server/broadcast_server.cpp @@ -127,7 +127,7 @@ public: } } private: - typedef std::set> con_list; + typedef std::set > con_list; server m_server; con_list m_connections; diff --git a/websocketpp/common/functional.hpp b/websocketpp/common/functional.hpp index 97afd6f..d332dd1 100644 --- a/websocketpp/common/functional.hpp +++ b/websocketpp/common/functional.hpp @@ -31,7 +31,7 @@ #include // If we've determined that we're in full C++11 mode and the user hasn't -// explicitly disabled the use of C++11 functional header, then prefer it to +// explicitly disabled the use of C++11 functional header, then prefer it to // boost. #if defined _WEBSOCKETPP_CPP11_INTERNAL_ && !defined _WEBSOCKETPP_NO_CPP11_FUNCTIONAL_ #ifndef _WEBSOCKETPP_CPP11_FUNCTIONAL_ @@ -41,7 +41,7 @@ // If we're on Visual Studio 2010 or higher and haven't explicitly disabled // the use of C++11 functional header then prefer it to boost. -#if _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_FUNCTIONAL_ +#if defined(_MSC_VER) && _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_FUNCTIONAL_ #ifndef _WEBSOCKETPP_CPP11_FUNCTIONAL_ #define _WEBSOCKETPP_CPP11_FUNCTIONAL_ #endif @@ -67,14 +67,14 @@ namespace lib { using std::bind; using std::ref; namespace placeholders = std::placeholders; - + // There are some cases where a C++11 compiler balks at using std::ref // but a C++03 compiler using boost function requires boost::ref. As such // lib::ref is not useful in these cases. Instead this macro allows the use // of boost::ref in the case of a boost compile or no reference wrapper at // all in the case of a C++11 compile #define _WEBSOCKETPP_REF(x) x - + template void clear_function(T & x) { x = nullptr; @@ -89,10 +89,10 @@ namespace lib { using ::_2; using ::_3; } - + // See above definition for more details on what this is and why it exists #define _WEBSOCKETPP_REF(x) boost::ref(x) - + template void clear_function(T & x) { x.clear(); diff --git a/websocketpp/common/memory.hpp b/websocketpp/common/memory.hpp index 10e7cd0..52cd85b 100644 --- a/websocketpp/common/memory.hpp +++ b/websocketpp/common/memory.hpp @@ -31,7 +31,7 @@ #include // If we've determined that we're in full C++11 mode and the user hasn't -// explicitly disabled the use of C++11 memory header, then prefer it to +// explicitly disabled the use of C++11 memory header, then prefer it to // boost. #if defined _WEBSOCKETPP_CPP11_INTERNAL_ && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_ #ifndef _WEBSOCKETPP_CPP11_MEMORY_ @@ -41,7 +41,7 @@ // If we're on Visual Studio 2010 or higher and haven't explicitly disabled // the use of C++11 functional header then prefer it to boost. -#if _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_ +#if defined(_MSC_VER) && _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_ #ifndef _WEBSOCKETPP_CPP11_MEMORY_ #define _WEBSOCKETPP_CPP11_MEMORY_ #endif diff --git a/websocketpp/common/network.hpp b/websocketpp/common/network.hpp index ac90644..3f98396 100644 --- a/websocketpp/common/network.hpp +++ b/websocketpp/common/network.hpp @@ -42,7 +42,7 @@ namespace net { inline bool is_little_endian() { short int val = 0x1; - char *ptr = (char*)&val; + char *ptr = reinterpret_cast(&val); return (ptr[0] == 1); } diff --git a/websocketpp/common/platforms.hpp b/websocketpp/common/platforms.hpp index 69e8d25..8779857 100644 --- a/websocketpp/common/platforms.hpp +++ b/websocketpp/common/platforms.hpp @@ -39,7 +39,7 @@ #endif // Bump up the variadic parameter max for Visual Studio 2012 -#if _MSC_VER == 1700 +#if defined(_MSC_VER) && _MSC_VER == 1700 #define _VARIADIC_MAX 8 #endif diff --git a/websocketpp/common/random.hpp b/websocketpp/common/random.hpp index ea088f3..ddf9969 100644 --- a/websocketpp/common/random.hpp +++ b/websocketpp/common/random.hpp @@ -31,7 +31,7 @@ #include // If we've determined that we're in full C++11 mode and the user hasn't -// explicitly disabled the use of C++11 random header, then prefer it to +// explicitly disabled the use of C++11 random header, then prefer it to // boost. #if defined _WEBSOCKETPP_CPP11_INTERNAL_ && !defined _WEBSOCKETPP_NO_CPP11_RANDOM_DEVICE_ #ifndef _WEBSOCKETPP_CPP11_RANDOM_DEVICE_ @@ -42,7 +42,7 @@ // If we're on Visual Studio 2010 or higher and haven't explicitly disabled // the use of C++11 random header then prefer it to boost. -#if _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_ +#if defined(_MSC_VER) && _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_MEMORY_ #ifndef _WEBSOCKETPP_CPP11_MEMORY_ #define _WEBSOCKETPP_CPP11_MEMORY_ #endif diff --git a/websocketpp/common/system_error.hpp b/websocketpp/common/system_error.hpp index f03fef1..4abe173 100644 --- a/websocketpp/common/system_error.hpp +++ b/websocketpp/common/system_error.hpp @@ -32,7 +32,7 @@ #include // If we've determined that we're in full C++11 mode and the user hasn't -// explicitly disabled the use of C++11 system_error header, then prefer it to +// explicitly disabled the use of C++11 system_error header, then prefer it to // boost. #if defined _WEBSOCKETPP_CPP11_INTERNAL_ && !defined _WEBSOCKETPP_NO_CPP11_SYSTEM_ERROR_ #ifndef _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ @@ -42,7 +42,7 @@ // If we're on Visual Studio 2010 or higher and haven't explicitly disabled // the use of C++11 system_error header then prefer it to boost. -#if _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_SYSTEM_ERROR_ +#if defined(_MSC_VER) && _MSC_VER >= 1600 && !defined _WEBSOCKETPP_NO_CPP11_SYSTEM_ERROR_ #ifndef _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ #define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ #endif diff --git a/websocketpp/transport/asio/endpoint.hpp b/websocketpp/transport/asio/endpoint.hpp index b8cbeb4..5610830 100644 --- a/websocketpp/transport/asio/endpoint.hpp +++ b/websocketpp/transport/asio/endpoint.hpp @@ -93,7 +93,8 @@ public: // generate and manage our own io_service explicit endpoint() - : m_external_io_service(false) + : m_io_service(NULL) + , m_external_io_service(false) , m_listen_backlog(0) , m_reuse_addr(false) , m_state(UNINITIALIZED) @@ -184,7 +185,7 @@ public: m_external_io_service = true; m_acceptor = lib::make_shared( lib::ref(*m_io_service)); - + m_state = READY; ec = lib::error_code(); } @@ -294,10 +295,10 @@ public: void set_listen_backlog(int backlog) { m_listen_backlog = backlog; } - + /// Sets whether to use the SO_REUSEADDR flag when opening listening sockets /** - * Specifies whether or not to use the SO_REUSEADDR TCP socket option. What + * Specifies whether or not to use the SO_REUSEADDR TCP socket option. What * this flag does depends on your operating system. Please consult operating * system documentation for more details. * diff --git a/websocketpp/transport/asio/security/base.hpp b/websocketpp/transport/asio/security/base.hpp index be3fa16..543a353 100644 --- a/websocketpp/transport/asio/security/base.hpp +++ b/websocketpp/transport/asio/security/base.hpp @@ -97,7 +97,7 @@ namespace error { missing_tls_init_handler, /// TLS Handshake Failed - tls_handshake_failed, + tls_handshake_failed }; } // namespace error diff --git a/websocketpp/transport/base/connection.hpp b/websocketpp/transport/base/connection.hpp index 2a1cc20..f76d409 100644 --- a/websocketpp/transport/base/connection.hpp +++ b/websocketpp/transport/base/connection.hpp @@ -177,7 +177,7 @@ enum value { action_after_shutdown, /// Other TLS error - tls_error, + tls_error }; class category : public lib::error_category {