Skip to content

Commit

Permalink
Fixing (suppressing) various build warnings
Browse files Browse the repository at this point in the history
- macro redefinition warnings
- export/import mismatch warnings
- base class needs dllexport warnings
  • Loading branch information
hkaiser committed Dec 27, 2015
1 parent 2cad1ac commit b8f42c8
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 29 deletions.
4 changes: 3 additions & 1 deletion hpx/config/warnings_prefix.hpp
@@ -1,8 +1,10 @@
// Copyright (c) 2007-2012 Hartmut Kaiser
// Copyright (c) 2007-2015 Hartmut Kaiser
//
// 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)

#include <hpx/config.hpp>

// suppress warnings about dependent classes not being exported from the dll
#if defined(HPX_MSVC)
#pragma warning(push)
Expand Down
4 changes: 3 additions & 1 deletion hpx/config/warnings_suffix.hpp
@@ -1,8 +1,10 @@
// Copyright (c) 2007-2012 Hartmut Kaiser
// Copyright (c) 2007-2015 Hartmut Kaiser
//
// 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)

#include <hpx/config.hpp>

// re-enable warnings about dependent classes not being exported from the dll
#if defined(HPX_MSVC)
#pragma warning(pop)
Expand Down
4 changes: 4 additions & 0 deletions hpx/runtime/threads/policies/hwloc_topology.hpp
Expand Up @@ -24,6 +24,8 @@

#include <boost/format.hpp>

#include <hpx/config/warnings_prefix.hpp>

#if defined(HPX_NATIVE_MIC) && HWLOC_API_VERSION < 0x00010600
#error On Intel Xeon/Phi coprosessors HPX cannot be use with a HWLOC version earlier than V1.6.
#endif
Expand Down Expand Up @@ -267,6 +269,8 @@ namespace hpx { namespace threads
}
}}

#include <hpx/config/warnings_suffix.hpp>

#endif

#endif // HPX_50DFC0FC_EE99_43F5_A918_01EC45A58036
Expand Down
16 changes: 5 additions & 11 deletions hpx/util/backtrace/backtrace.hpp
Expand Up @@ -16,21 +16,15 @@
#include <iosfwd>

///////////////////////////////////////////////////////////////////////////////
#ifdef HPX_BACKTRACE_SOURCE
# define HPX_BACKTRACE_DECL HPX_SYMBOL_EXPORT
#else
# define HPX_BACKTRACE_DECL HPX_SYMBOL_IMPORT
#endif // HPX_BACKTRACE_SOURCE

namespace hpx { namespace util
{
namespace stack_trace
{
HPX_BACKTRACE_DECL std::size_t trace(void **addresses, std::size_t size);
HPX_BACKTRACE_DECL void write_symbols(void *const *addresses,
HPX_API_EXPORT std::size_t trace(void **addresses, std::size_t size);
HPX_API_EXPORT void write_symbols(void *const *addresses,
std::size_t size,std::ostream &);
HPX_BACKTRACE_DECL std::string get_symbol(void *address);
HPX_BACKTRACE_DECL std::string get_symbols(void * const *address,
HPX_API_EXPORT std::string get_symbol(void *address);
HPX_API_EXPORT std::string get_symbols(void * const *address,
std::size_t size);
} // stack_trace

Expand Down Expand Up @@ -85,7 +79,7 @@ namespace hpx { namespace util
return stack_trace::get_symbols(&frames_.front(),frames_.size());
}

HPX_BACKTRACE_DECL std::string trace_on_new_stack() const;
HPX_API_EXPORT std::string trace_on_new_stack() const;

void trace(std::ostream &out) const
{
Expand Down
1 change: 1 addition & 0 deletions hpx/util/manage_config.hpp
Expand Up @@ -6,6 +6,7 @@
#if !defined(HPX_UTIL_MANAGE_CONFIG_APR_11_2012_0519PM)
#define HPX_UTIL_MANAGE_CONFIG_APR_11_2012_0519PM

#include <hpx/config.hpp>
#include <hpx/config/export_definitions.hpp>
#include <hpx/util/safe_lexical_cast.hpp>

Expand Down
1 change: 1 addition & 0 deletions src/util/asio_util.cpp
Expand Up @@ -4,6 +4,7 @@
// 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)

#include <hpx/config.hpp>
#include <hpx/config/asio.hpp>
#include <hpx/exception_list.hpp>
#include <hpx/util/asio_util.hpp>
Expand Down
32 changes: 16 additions & 16 deletions src/util/backtrace/backtrace.cpp
Expand Up @@ -114,7 +114,7 @@ namespace hpx { namespace util {
return _URC_NO_REASON;
}

HPX_BACKTRACE_DECL std::size_t trace(void **array,std::size_t n)
HPX_API_EXPORT std::size_t trace(void **array,std::size_t n)
{
trace_data d(array,n);

Expand All @@ -129,14 +129,14 @@ namespace hpx { namespace util {

#elif defined(BOOST_HAVE_EXECINFO)

HPX_BACKTRACE_DECL std::size_t trace(void **array,std::size_t n)
HPX_API_EXPORT std::size_t trace(void **array,std::size_t n)
{
return :: backtrace(array,n);
}

#elif defined(HPX_MSVC)

HPX_BACKTRACE_DECL std::size_t trace(void **array,std::size_t n)
HPX_API_EXPORT std::size_t trace(void **array,std::size_t n)
{
#if _WIN32_WINNT < 0x0600
// for Windows XP/Windows Server 2003
Expand All @@ -148,7 +148,7 @@ namespace hpx { namespace util {

#else

HPX_BACKTRACE_DECL std::size_t trace(void ** /*array*/,std::size_t /*n*/)
HPX_API_EXPORT std::size_t trace(void ** /*array*/,std::size_t /*n*/)
{
return 0;
}
Expand All @@ -157,7 +157,7 @@ namespace hpx { namespace util {

#if defined(BOOST_HAVE_DLFCN) && defined(BOOST_HAVE_ABI_CXA_DEMANGLE)

HPX_BACKTRACE_DECL std::string get_symbol(void *ptr)
HPX_API_EXPORT std::string get_symbol(void *ptr)
{
if(!ptr)
return std::string();
Expand Down Expand Up @@ -195,7 +195,7 @@ namespace hpx { namespace util {
return res.str();
}

HPX_BACKTRACE_DECL std::string get_symbols(void *const *addresses,
HPX_API_EXPORT std::string get_symbols(void *const *addresses,
std::size_t size)
{
std::string res = boost::lexical_cast<std::string>(size)
Expand All @@ -209,7 +209,7 @@ namespace hpx { namespace util {
}
return res;
}
HPX_BACKTRACE_DECL void write_symbols(void *const *addresses,
HPX_API_EXPORT void write_symbols(void *const *addresses,
std::size_t size,std::ostream &out)
{
out << size << ((1==size)?" frame:":" frames:");
Expand All @@ -224,7 +224,7 @@ namespace hpx { namespace util {

#elif defined(BOOST_HAVE_EXECINFO)

HPX_BACKTRACE_DECL std::string get_symbol(void *address)
HPX_API_EXPORT std::string get_symbol(void *address)
{
char ** ptr = backtrace_symbols(&address,1);
try {
Expand All @@ -241,7 +241,7 @@ namespace hpx { namespace util {
}
}

HPX_BACKTRACE_DECL std::string get_symbols(void * const *address,
HPX_API_EXPORT std::string get_symbols(void * const *address,
std::size_t size)
{
char ** ptr = backtrace_symbols(address,size);
Expand All @@ -264,7 +264,7 @@ namespace hpx { namespace util {
}
}

HPX_BACKTRACE_DECL void write_symbols(void *const *addresses,std::size_t size,
HPX_API_EXPORT void write_symbols(void *const *addresses,std::size_t size,
std::ostream &out)
{
char ** ptr = backtrace_symbols(addresses,size);
Expand Down Expand Up @@ -304,7 +304,7 @@ namespace hpx { namespace util {
}
}

HPX_BACKTRACE_DECL std::string get_symbol(void *ptr)
HPX_API_EXPORT std::string get_symbol(void *ptr)
{
if(ptr==0)
return std::string();
Expand Down Expand Up @@ -333,7 +333,7 @@ namespace hpx { namespace util {
return ss.str();
}

HPX_BACKTRACE_DECL std::string get_symbols(void *const *addresses,
HPX_API_EXPORT std::string get_symbols(void *const *addresses,
std::size_t size)
{
std::string res = boost::lexical_cast<std::string>(size)
Expand All @@ -348,7 +348,7 @@ namespace hpx { namespace util {
return res;
}

HPX_BACKTRACE_DECL void write_symbols(void *const *addresses,
HPX_API_EXPORT void write_symbols(void *const *addresses,
std::size_t size,std::ostream &out)
{
out << size << ((1==size)?" frame:":" frames:"); //-V128
Expand All @@ -363,7 +363,7 @@ namespace hpx { namespace util {

#else

HPX_BACKTRACE_DECL std::string get_symbol(void *ptr)
HPX_API_EXPORT std::string get_symbol(void *ptr)
{
if(!ptr)
return std::string();
Expand All @@ -373,7 +373,7 @@ namespace hpx { namespace util {
return res.str();
}

HPX_BACKTRACE_DECL std::string get_symbols(void *const *ptrs,std::size_t size)
HPX_API_EXPORT std::string get_symbols(void *const *ptrs,std::size_t size)
{
if(!ptrs)
return std::string();
Expand All @@ -383,7 +383,7 @@ namespace hpx { namespace util {
return res.str();
}

HPX_BACKTRACE_DECL void write_symbols(void *const *addresses,
HPX_API_EXPORT void write_symbols(void *const *addresses,
std::size_t size,std::ostream &out)
{
out << size << ((1 == size)?" frame:":" frames:"); //-V128
Expand Down
1 change: 1 addition & 0 deletions src/util/io_service_pool.cpp
Expand Up @@ -7,6 +7,7 @@
// 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)

#include <hpx/config.hpp>
#include <hpx/config/asio.hpp>
#include <hpx/exception.hpp>
#include <hpx/util/io_service_pool.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/util/manage_config.cpp
Expand Up @@ -3,6 +3,7 @@
// 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)

#include <hpx/config.hpp>
#include <hpx/util/manage_config.hpp>

namespace hpx { namespace util
Expand Down

0 comments on commit b8f42c8

Please sign in to comment.