forked from premiere/premiere-libtorrent
move export.hpp into aux_ folder. put assert symbols in libtorrent namespace
This commit is contained in:
parent
44b5777be3
commit
ccdfd7383e
|
@ -56,7 +56,6 @@ set(libtorrent_include_files
|
|||
enum_net
|
||||
error
|
||||
error_code
|
||||
export
|
||||
extensions
|
||||
file
|
||||
file_pool
|
||||
|
@ -223,6 +222,7 @@ set(libtorrent_aux_include_files
|
|||
disable_warnings_push
|
||||
disk_job_fence
|
||||
escape_string
|
||||
export
|
||||
ffs
|
||||
file_progress
|
||||
has_block
|
||||
|
|
|
@ -44,7 +44,6 @@ nobase_include_HEADERS = \
|
|||
enum_net.hpp \
|
||||
error.hpp \
|
||||
error_code.hpp \
|
||||
export.hpp \
|
||||
extensions.hpp \
|
||||
file.hpp \
|
||||
file_pool.hpp \
|
||||
|
@ -175,6 +174,7 @@ nobase_include_HEADERS = \
|
|||
aux_/dev_random.hpp \
|
||||
aux_/deque.hpp \
|
||||
aux_/escape_string.hpp \
|
||||
aux_/export.hpp \
|
||||
aux_/io.hpp \
|
||||
aux_/listen_socket_handle.hpp \
|
||||
aux_/max_path.hpp \
|
||||
|
|
|
@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_ASSERT
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
#if TORRENT_USE_ASSERTS \
|
||||
|| defined TORRENT_ASIO_DEBUGGING \
|
||||
|
@ -40,8 +41,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|| defined TORRENT_DEBUG_BUFFERS
|
||||
|
||||
#include <string>
|
||||
namespace libtorrent {
|
||||
std::string demangle(char const* name);
|
||||
TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth = 0, void* ctx = nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
// this is to disable the warning of conditional expressions
|
||||
|
@ -57,6 +60,7 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth = 0, void*
|
|||
#endif
|
||||
|
||||
|
||||
namespace libtorrent {
|
||||
// declarations of the two functions
|
||||
|
||||
// internal
|
||||
|
@ -66,7 +70,7 @@ TORRENT_EXPORT void assert_print(char const* fmt, ...) TORRENT_FORMAT(1,2);
|
|||
TORRENT_EXPORT void assert_fail(const char* expr, int line
|
||||
, char const* file, char const* function, char const* val, int kind = 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
|
||||
|
@ -81,19 +85,19 @@ extern TORRENT_EXPORT char const* libtorrent_assert_log;
|
|||
#ifndef TORRENT_USE_SYSTEM_ASSERTS
|
||||
|
||||
#define TORRENT_ASSERT_PRECOND(x) \
|
||||
do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 1); } TORRENT_WHILE_0
|
||||
do { if (x) {} else libtorrent::assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 1); } TORRENT_WHILE_0
|
||||
|
||||
#define TORRENT_ASSERT(x) \
|
||||
do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0); } TORRENT_WHILE_0
|
||||
do { if (x) {} else libtorrent::assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0); } TORRENT_WHILE_0
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#define TORRENT_ASSERT_VAL(x, y) \
|
||||
do { if (x) {} else { std::stringstream __s__; __s__ << #y ": " << y; \
|
||||
assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } } TORRENT_WHILE_0
|
||||
libtorrent::assert_fail(#x, __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } } TORRENT_WHILE_0
|
||||
|
||||
#define TORRENT_ASSERT_FAIL_VAL(y) \
|
||||
do { std::stringstream __s__; __s__ << #y ": " << y; \
|
||||
assert_fail("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } TORRENT_WHILE_0
|
||||
libtorrent::assert_fail("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, __s__.str().c_str(), 0); } TORRENT_WHILE_0
|
||||
|
||||
#else
|
||||
#define TORRENT_ASSERT_VAL(x, y) TORRENT_ASSERT(x)
|
||||
|
@ -101,7 +105,7 @@ extern TORRENT_EXPORT char const* libtorrent_assert_log;
|
|||
#endif
|
||||
|
||||
#define TORRENT_ASSERT_FAIL() \
|
||||
assert_fail("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0)
|
||||
libtorrent::assert_fail("<unconditional>", __LINE__, __FILE__, TORRENT_FUNCTION, nullptr, 0)
|
||||
|
||||
#else
|
||||
#include <cassert>
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_FFS_HPP_INCLUDE
|
||||
|
||||
#include <cstdint>
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/span.hpp"
|
||||
|
||||
namespace libtorrent { namespace aux {
|
||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/units.hpp"
|
||||
#include "libtorrent/aux_/vector.hpp"
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/intrusive/list.hpp>
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/block_cache.hpp" // for cached_piece_entry
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_BANDWIDTH_SOCKET_HPP_INCLUDED
|
||||
#define TORRENT_BANDWIDTH_SOCKET_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
// TODO: don't include that here. Make each header that use the export macros
|
||||
// include it instead. and move it to aux_
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/version.h> // for LINUX_VERSION_CODE and KERNEL_VERSION
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_CRC32C_HPP_INCLUDE
|
||||
|
||||
#include <cstdint>
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/units.hpp"
|
||||
#include "libtorrent/disk_buffer_holder.hpp"
|
||||
#include "libtorrent/aux_/vector.hpp"
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/storage_defs.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/sha1_hash.hpp"
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_DISK_IO_THREAD_POOL
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
#include "libtorrent/io_service_fwd.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ED25519_HPP
|
||||
#define ED25519_HPP
|
||||
|
||||
#include "libtorrent/export.hpp" // for TORRENT_EXPORT
|
||||
#include "libtorrent/aux_/export.hpp" // for TORRENT_EXPORT
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/fwd.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/span.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/units.hpp"
|
||||
#include "libtorrent/aux_/vector.hpp"
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_UTF8_HPP_INCLUDED
|
||||
#define TORRENT_UTF8_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_VERSION_HPP_INCLUDED
|
||||
#define TORRENT_VERSION_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
|
||||
#define LIBTORRENT_VERSION_MAJOR 1
|
||||
#define LIBTORRENT_VERSION_MINOR 2
|
||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <vector>
|
||||
|
||||
#include "libtorrent/fwd.hpp"
|
||||
#include "libtorrent/export.hpp"
|
||||
#include "libtorrent/aux_/export.hpp"
|
||||
#include "libtorrent/bencode.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -152,7 +152,7 @@ void* operator new(std::size_t sz)
|
|||
if (--g_alloc_counter == 0)
|
||||
{
|
||||
char stack[10000];
|
||||
print_backtrace(stack, sizeof(stack), 40, nullptr);
|
||||
libtorrent::print_backtrace(stack, sizeof(stack), 40, nullptr);
|
||||
#ifdef _MSC_VER
|
||||
// this is a bit unfortunate. Some MSVC standard containers really don't move
|
||||
// with noexcept, by actually allocating memory (i.e. it's not just a matter
|
||||
|
|
|
@ -64,6 +64,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <cxxabi.h>
|
||||
|
||||
namespace libtorrent {
|
||||
std::string demangle(char const* name)
|
||||
{
|
||||
// in case this string comes
|
||||
|
@ -101,11 +102,13 @@ std::string demangle(char const* name)
|
|||
::free(unmangled);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#elif defined _WIN32
|
||||
|
||||
#include "windows.h"
|
||||
#include "dbghelp.h"
|
||||
|
||||
namespace libtorrent {
|
||||
std::string demangle(char const* name)
|
||||
{
|
||||
char demangled_name[256];
|
||||
|
@ -113,9 +116,12 @@ std::string demangle(char const* name)
|
|||
demangled_name[0] = 0;
|
||||
return demangled_name;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
namespace libtorrent {
|
||||
std::string demangle(char const* name) { return name; }
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -126,6 +132,8 @@ std::string demangle(char const* name) { return name; }
|
|||
#if TORRENT_USE_EXECINFO
|
||||
#include <execinfo.h>
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth, void*)
|
||||
{
|
||||
void* stack[50];
|
||||
|
@ -142,6 +150,7 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth, void*)
|
|||
|
||||
::free(symbols);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined _WIN32
|
||||
|
||||
|
@ -152,6 +161,8 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth, void*)
|
|||
#include "winbase.h"
|
||||
#include "dbghelp.h"
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth
|
||||
, void* ctx)
|
||||
{
|
||||
|
@ -256,19 +267,26 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth
|
|||
if (i == max_depth && max_depth > 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
TORRENT_EXPORT void print_backtrace(char* out, int len, int /*max_depth*/, void* /* ctx */)
|
||||
{
|
||||
out[0] = 0;
|
||||
std::strncat(out, "<not supported>", std::size_t(len));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
#if TORRENT_USE_ASSERTS || defined TORRENT_ASIO_DEBUGGING
|
||||
|
||||
#ifdef TORRENT_PRODUCTION_ASSERTS
|
||||
|
@ -379,3 +397,6 @@ TORRENT_EXPORT void assert_fail(char const*, int, char const*
|
|||
, char const*, char const*, int) {}
|
||||
|
||||
#endif
|
||||
|
||||
} // libtorrent namespace
|
||||
|
||||
|
|
Loading…
Reference in New Issue