Skip to content

Commit

Permalink
Merge branch 'submit' of git://github.com/jhol/pion into jhol-submit2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Dickey committed Nov 17, 2015
2 parents b1009ff + f8b9b9d commit 2bd8146
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 82 deletions.
15 changes: 6 additions & 9 deletions build/pion-boost.inc
Expand Up @@ -134,25 +134,22 @@ if test "x$enable_tests" == "xno"; then
# Display notice if unit tests are disabled
AC_MSG_NOTICE([Unit tests are disabled])
else
BOOST_TRY_LIB=unit_test_framework
BOOST_TRY_LINK="$BOOST_HOME_DIR/lib/libboost_${BOOST_TRY_LIB}${BOOST_LIB_EXTENSION}.a"
# check if static version of lib is available
if !(test -r "$BOOST_TRY_LINK"); then
BOOST_TRY_LINK="-lboost_${BOOST_TRY_LIB}${BOOST_LIB_EXTENSION}"
PION_TESTS_CPPFLAGS="-DBOOST_TEST_DYN_LINK"
fi
BOOST_TRY_LIB=unit_test_framework
BOOST_TRY_LINK="boost_${BOOST_TRY_LIB}${BOOST_LIB_EXTENSION}"
PION_TESTS_CPPFLAGS="-DBOOST_TEST_DYN_LINK"
LIBS_SAVED="$LIBS"
LIBS="$LIBS_SAVED ${BOOST_TRY_LINK}"
LIBS="$LIBS_SAVED -l${BOOST_TRY_LINK}"
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS ${PION_TESTS_CPPFLAGS}"
AC_MSG_CHECKING([for boost::test library])
AC_TRY_LINK([#include <boost/test/unit_test.hpp>
using namespace boost::unit_test;
test_suite* init_unit_test_suite( int argc, char* argv[] )
test_suite* init_unit_test_suite( int, char** )
{ return BOOST_TEST_SUITE("Master test suite"); }],
[],
[ AC_MSG_RESULT(ok)
BOOST_TEST_LIB="${BOOST_TRY_LINK}"
BOOST_TEST_LIB="-l${BOOST_TRY_LINK}"
],
[ AC_MSG_RESULT(not found)
AC_MSG_ERROR(Unable to link with the boost::${BOOST_TRY_LIB} library)
Expand Down
30 changes: 19 additions & 11 deletions build/pion-setup.inc
Expand Up @@ -30,8 +30,8 @@ case "$build_os" in
# Solaris: GCC compiler
CPPFLAGS="$CPPFLAGS -pthreads -D_REENTRANT"
LDFLAGS="$LDFLAGS -pthreads"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wno-strict-aliasing -fkeep-inline-functions"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -fkeep-inline-functions"
fi
PION_EXTERNAL_LIBS="-lsocket -lnsl -lposix4"
;;
Expand All @@ -40,9 +40,9 @@ case "$build_os" in
# -pthread is implied (automatically set by compiler)
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
#LDFLAGS="$LDFLAGS"
#PION_OPT_FLAGS="-O3 -ggdb -fomit-frame-pointer -fstrict-aliasing -fno-tree-pre -falign-loops -Wall -Wno-strict-aliasing -DNDEBUG"
PION_OPT_FLAGS="-O3 -ggdb -fomit-frame-pointer -fstrict-aliasing -Wall -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wno-strict-aliasing -fkeep-inline-functions"
#PION_OPT_FLAGS="-O3 -ggdb -fomit-frame-pointer -fstrict-aliasing -fno-tree-pre -falign-loops -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_OPT_FLAGS="-O3 -ggdb -fomit-frame-pointer -fstrict-aliasing -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -fkeep-inline-functions"

# Check for OSX binary architecture
AC_MSG_CHECKING([for OSX binary architectures])
Expand Down Expand Up @@ -71,24 +71,32 @@ case "$build_os" in
# Cygwin GCC compiler (Windows)
CPPFLAGS="$CPPFLAGS -mthreads -D_REENTRANT -DPION_WIN32 -D__USE_W32_SOCKETS"
LDFLAGS="$LDFLAGS -mthreads -Wl,-E"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wno-strict-aliasing -fkeep-inline-functions"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -fkeep-inline-functions"
PION_EXTERNAL_LIBS="-lws2_32 -lmswsock"
;;
*mingw32*)
# MingW32 GCC compiler (Windows)
CPPFLAGS="$CPPFLAGS -pthread -D_REENTRANT -DPION_WIN32 -D__USE_W32_SOCKETS"
LDFLAGS="$LDFLAGS -pthread -Wl,-E"
PION_OPT_FLAGS="-O1 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -fkeep-inline-functions"
PION_EXTERNAL_LIBS="-lws2_32 -lmswsock"
;;
*freebsd*)
# FreeBSD: GCC compiler
CPPFLAGS="$CPPFLAGS -pthread -D_REENTRANT"
LDFLAGS="$LDFLAGS -pthread -Wl,-E"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wno-strict-aliasing -fkeep-inline-functions"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -fkeep-inline-functions"
;;
*)
# Other (Linux): GCC compiler
CPPFLAGS="$CPPFLAGS -pthread -D_REENTRANT"
LDFLAGS="$LDFLAGS -pthread -Wl,-E"
LIBS="-lrt -ldl"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wno-strict-aliasing -fkeep-inline-functions"
PION_OPT_FLAGS="-O2 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -DNDEBUG"
PION_DEBUG_FLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-strict-aliasing -fkeep-inline-functions"
;;
esac

Expand Down
4 changes: 2 additions & 2 deletions cmake/PionUtils.cmake
Expand Up @@ -35,12 +35,12 @@ macro(pion_update_compilation_opts)

if(CMAKE_COMPILER_IS_GNUCXX)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -W")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Werror -W")
endif()
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -W")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Werror -W")
endif()

message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion include/pion/http/auth.hpp
Expand Up @@ -65,7 +65,7 @@ class PION_API auth :
* @param name the name of the option to change
* @param value the value of the option
*/
virtual void set_option(const std::string& name, const std::string& value) {
virtual void set_option(const std::string& name, const std::string& /* value */) {
BOOST_THROW_EXCEPTION( error::bad_arg() << error::errinfo_arg_name(name) );
}

Expand Down
2 changes: 1 addition & 1 deletion include/pion/http/parser.hpp
Expand Up @@ -441,7 +441,7 @@ class PION_API parser :
protected:

/// Called after we have finished parsing the HTTP message headers
virtual void finished_parsing_headers(const boost::system::error_code& ec) {}
virtual void finished_parsing_headers(const boost::system::error_code& /* ec */) {}

/**
* parses an HTTP message up to the end of the headers using bytes
Expand Down
2 changes: 1 addition & 1 deletion include/pion/http/plugin_service.hpp
Expand Up @@ -51,7 +51,7 @@ class plugin_service :
* @param name the name of the option to change
* @param value the value of the option
*/
virtual void set_option(const std::string& name, const std::string& value) {
virtual void set_option(const std::string& name, const std::string& /* value */) {
BOOST_THROW_EXCEPTION( error::bad_arg() << error::errinfo_arg_name(name) );
}

Expand Down
2 changes: 2 additions & 0 deletions include/pion/http/request_writer.hpp
Expand Up @@ -139,6 +139,8 @@ class request_writer :
virtual void handle_write(const boost::system::error_code& write_error,
std::size_t bytes_written)
{
(void)bytes_written;

logger log_ptr(get_logger());
if (! write_error) {
// request sent OK
Expand Down
2 changes: 2 additions & 0 deletions include/pion/http/response_writer.hpp
Expand Up @@ -147,6 +147,8 @@ class PION_API response_writer :
virtual void handle_write(const boost::system::error_code& write_error,
std::size_t bytes_written)
{
(void)bytes_written;

logger log_ptr(get_logger());
if (!write_error) {
// response sent OK
Expand Down
4 changes: 2 additions & 2 deletions include/pion/logger.hpp
Expand Up @@ -206,10 +206,10 @@
}

#undef PION_HAS_LOG_APPENDER
#define PION_LOG_CONFIG_BASIC {}
#define PION_LOG_CONFIG_BASIC (void)0
#define PION_LOG_CONFIG(FILE) {}
#define PION_GET_LOGGER(NAME) 0
#define PION_SHUTDOWN_LOGGER 0
#define PION_SHUTDOWN_LOGGER (void)0

// use LOG to avoid warnings about LOG not being used
#define PION_LOG_SETLEVEL_DEBUG(LOG) { if (LOG) {} }
Expand Down
10 changes: 5 additions & 5 deletions include/pion/process.hpp
Expand Up @@ -18,7 +18,7 @@
#include <pion/config.hpp>

// Dump file generation support on Windows
#ifdef _MSC_VER
#ifdef PION_WIN32
#include <windows.h>
#include <tchar.h>
#include <DbgHelp.h>
Expand Down Expand Up @@ -57,14 +57,14 @@ class PION_API process :
/// fork process and run as a background daemon
static void daemonize(void);

#ifdef _MSC_VER
#ifdef PION_WIN32

class dumpfile_init_exception : public std::exception
{
public:
dumpfile_init_exception(const std::string& cause) : m_cause(cause) {}

virtual const char* what() const { return m_cause.c_str(); }
virtual const char* what() const throw() { return m_cause.c_str(); }
protected:
std::string m_cause;
};
Expand All @@ -89,7 +89,7 @@ class PION_API process :
/// data type for static/global process configuration information
struct config_type {
/// constructor just initializes native types
#ifdef _MSC_VER
#ifdef PION_WIN32
config_type() : shutdown_now(false), h_dbghelp(NULL), p_dump_proc(NULL) {}
#else
config_type() : shutdown_now(false) {}
Expand All @@ -105,7 +105,7 @@ class PION_API process :
boost::mutex shutdown_mutex;

// Dump file generation support on Windows
#ifdef _MSC_VER
#ifdef PION_WIN32
/// mini-dump file location
std::string dumpfile_dir;

Expand Down
2 changes: 1 addition & 1 deletion include/pion/scheduler.hpp
Expand Up @@ -201,7 +201,7 @@ class PION_API multi_thread_scheduler :
{
public:

/// constructs a new single_service_scheduler
/// constructs a new multi_thread_scheduler
multi_thread_scheduler(void) {}

/// virtual destructor
Expand Down
2 changes: 1 addition & 1 deletion include/pion/test/unit_test.hpp
Expand Up @@ -55,7 +55,7 @@ namespace test { // begin namespace test

/// wrapper to flush output for xml_log_formatter::log_start
virtual void log_start(std::ostream& ostr,
boost::unit_test::counter_t test_cases_amount )
boost::unit_test::counter_t /* test_cases_amount */)
{
ostr << "<TestLog>" << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion services/FileService.cpp
Expand Up @@ -937,7 +937,7 @@ void DiskFileSender::send(void)
}

void DiskFileSender::handle_write(const boost::system::error_code& write_error,
std::size_t bytes_written)
std::size_t /* bytes_written */)
{
bool finished_sending = true;

Expand Down
16 changes: 8 additions & 8 deletions src/admin_rights.cpp
Expand Up @@ -9,7 +9,7 @@

#include <pion/admin_rights.hpp>

#ifndef _MSC_VER
#ifndef PION_WIN32
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
Expand All @@ -31,7 +31,7 @@ boost::mutex admin_rights::m_mutex;

// admin_rights member functions

#ifdef _MSC_VER
#ifdef PION_WIN32

admin_rights::admin_rights(bool use_log)
: m_logger(PION_GET_LOGGER("pion.admin_rights")),
Expand All @@ -41,23 +41,23 @@ admin_rights::admin_rights(bool use_log)
void admin_rights::release(void)
{}

long admin_rights::run_as_user(const std::string& user_name)
long admin_rights::run_as_user(const std::string& /* user_name */)
{
return -1;
}

long admin_rights::run_as_group(const std::string& group_name)
long admin_rights::run_as_group(const std::string& /* group_name */)
{
return -1;
}

long admin_rights::find_system_id(const std::string& name,
const std::string& file)
long admin_rights::find_system_id(const std::string& /* name */,
const std::string& /* file */)
{
return -1;
}

#else // NOT #ifdef _MSC_VER
#else // NOT #ifdef PION_WIN32

admin_rights::admin_rights(bool use_log)
: m_logger(PION_GET_LOGGER("pion.admin_rights")),
Expand Down Expand Up @@ -154,7 +154,7 @@ long admin_rights::find_system_id(const std::string& name,
return system_id;
}

#endif // #ifdef _MSC_VER
#endif // #ifdef PION_WIN32

} // end namespace pion

2 changes: 1 addition & 1 deletion src/http_parser.cpp
Expand Up @@ -1422,7 +1422,7 @@ boost::tribool parser::parse_chunks(http::message::chunk_cache_t& chunks,
}

boost::tribool parser::consume_content(http::message& http_msg,
boost::system::error_code& ec)
boost::system::error_code& /* ec */)
{
size_t content_bytes_to_read;
size_t content_bytes_available = bytes_available();
Expand Down
4 changes: 4 additions & 0 deletions src/plugin.cpp
Expand Up @@ -53,6 +53,9 @@ void plugin::check_cygwin_path(boost::filesystem::path& final_path,
if (! final_path.is_complete() && final_path.has_root_directory()) {
final_path = boost::filesystem::path(std::string(PION_CYGWIN_DIRECTORY) + start_path);
}
#else
(void)final_path;
(void)start_path;
#endif
}

Expand Down Expand Up @@ -372,6 +375,7 @@ void plugin::close_dynamic_library(void *lib_handle)
// So, please don't call FreeLibrary here unless you've been able to
// reproduce and fix the crashing of the unit tests.

(void)lib_handle;
//FreeLibrary((HINSTANCE) lib_handle);
#else
dlclose(lib_handle);
Expand Down
12 changes: 6 additions & 6 deletions src/process.cpp
Expand Up @@ -8,7 +8,7 @@
//

#include <signal.h>
#ifndef _MSC_VER
#ifndef PION_WIN32
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -57,7 +57,7 @@ void process::create_config(void)



#ifdef _MSC_VER
#ifdef PION_WIN32

BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
{
Expand Down Expand Up @@ -182,7 +182,7 @@ LONG WINAPI process::unhandled_exception_filter(struct _EXCEPTION_POINTERS *pExc

ExInfo.ThreadId = ::GetCurrentThreadId();
ExInfo.ExceptionPointers = pExceptionInfo;
ExInfo.ClientPointers = NULL;
ExInfo.ClientPointers = 0;

// write the dump
BOOL bOK = cfg.p_dump_proc(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
Expand Down Expand Up @@ -217,9 +217,9 @@ void process::daemonize(void)
// not supported
}

#else // NOT #ifdef _MSC_VER
#else // NOT #ifdef PION_WIN32

void handle_signal(int sig)
void handle_signal(int /* sig */)
{
process::shutdown();
}
Expand Down Expand Up @@ -268,6 +268,6 @@ void process::daemonize(void)
umask(027);
}

#endif // #ifdef _MSC_VER
#endif // #ifdef PION_WIN32

} // end namespace pion

0 comments on commit 2bd8146

Please sign in to comment.