fix build and suppress offsetof warnings in backwards-compatibility code

This commit is contained in:
Arvid Norberg 2014-07-22 05:35:05 +00:00
parent 42a30bb50f
commit 2b1162aac9
2 changed files with 11 additions and 0 deletions

View File

@ -51,6 +51,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h> // for snprintf
#include <limits.h> // for IOV_MAX
#include "libtorrent/export.hpp"
#ifdef __linux__
#include <linux/version.h> // for LINUX_VERSION_CODE and KERNEL_VERSION
#endif // __linux

View File

@ -107,6 +107,11 @@ namespace libtorrent
#define SET(name, default_value, fun) { #name, fun, default_value, offsetof(libtorrent::session_settings, name) }
#define SET_NOPREV(name, default_value, fun) { #name, fun, default_value, 0 }
#define DEPRECATED_SET(name, default_value, fun) { #name, fun, default_value, offsetof(libtorrent::session_settings, name) }
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
using aux::session_impl;
@ -333,6 +338,10 @@ namespace libtorrent
#undef SET
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
int setting_by_name(std::string const& key)
{
for (int k = 0; k < sizeof(str_settings)/sizeof(str_settings[0]); ++k)