* Applied patch from Diego 'Flameeyes' Petteno <flameeyes@gentoo.org>

that adds the "unused" attribute to some function parameters and minor
cleanups of configure.ac.

* Added inttypes.h to command_scheduler.h.

* Bumped to version 0.8.5/0.4.5.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@634 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-02-05 01:43:38 +00:00
parent 8b934623d4
commit 126bb511b8
10 changed files with 145 additions and 18 deletions
+4 -1
View File
@@ -16,4 +16,7 @@ EXTRA_DIST= \
rak/timer.h \
rak/unordered_vector.h \
scripts/checks.m4 \
scripts/common.m4
scripts/common.m4 \
scripts/attributes.m4
ACLOCAL_AMFLAGS = -I scripts
+1 -1
View File
@@ -6,7 +6,7 @@ echo aclocal...
exit 1
}
aclocal -I . ${ACLOCAL_FLAGS}
aclocal -I . -I ./scripts ${ACLOCAL_FLAGS}
echo autoheader...
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
+7 -5
View File
@@ -1,18 +1,15 @@
AC_INIT(rtorrent, 0.4.4, jaris@ifi.uio.no)
AC_INIT(rtorrent, 0.4.5, jaris@ifi.uio.no)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
sinclude(scripts/checks.m4)
sinclude(scripts/common.m4)
TORRENT_CHECK_CXXFLAGS()
TORRENT_ENABLE_DEBUG()
TORRENT_ENABLE_EXTRA_DEBUG()
TORRENT_ENABLE_WERROR()
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_LIBTOOL
AC_SYS_LARGEFILE
@@ -33,6 +30,11 @@ PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.8.0,
AC_DEFINE(HAVE_CONFIG_H, 1, true if config.h was included)
CC_ATTRIBUTE_UNUSED(
AC_DEFINE([__UNUSED], [__attribute__((unused))], [Wrapper around unused attribute]),
AC_DEFINE([__UNUSED], [], [Null-wrapper if unused attribute is unsupported])
)
AC_OUTPUT([
Makefile
doc/Makefile
+3 -3
View File
@@ -108,8 +108,8 @@ public:
return *this;
}
bool operator == (const split_iterator_t& itr) const { return m_pos == m_seq->end(); }
bool operator != (const split_iterator_t& itr) const { return m_pos != m_seq->end(); }
bool operator == (__UNUSED const split_iterator_t& itr) const { return m_pos == m_seq->end(); }
bool operator != (__UNUSED const split_iterator_t& itr) const { return m_pos != m_seq->end(); }
private:
const Sequence* m_seq;
@@ -126,7 +126,7 @@ split_iterator(const Sequence& seq, typename Sequence::value_type delim) {
template <typename Sequence>
inline split_iterator_t<Sequence>
split_iterator(const Sequence& seq) {
split_iterator(__UNUSED const Sequence& seq) {
return split_iterator_t<Sequence>();
}
+121
View File
@@ -0,0 +1,121 @@
# Functions to check for attributes support in compiler
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
AC_CACHE_CHECK([if compiler supports __attribute__((constructor))],
[cc_cv_attribute_constructor],
[AC_COMPILE_IFELSE([
void ctor() __attribute__((constructor));
void ctor() { };
],
[cc_cv_attribute_constructor=yes],
[cc_cv_attribute_constructor=no])
])
if test "x$cc_cv_attribute_constructor" = "xyes"; then
AC_DEFINE([SUPPORT_ATTRIBUTE_CONSTRUCTOR], 1, [Define this if the compiler supports the constructor attribute])
$1
else
true
$2
fi
])
AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
AC_CACHE_CHECK([if compiler supports __attribute__((format(printf, n, n)))],
[cc_cv_attribute_format],
[AC_COMPILE_IFELSE([
void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { }
],
[cc_cv_attribute_format=yes],
[cc_cv_attribute_format=no])
])
if test "x$cc_cv_attribute_format" = "xyes"; then
AC_DEFINE([SUPPORT_ATTRIBUTE_FORMAT], 1, [Define this if the compiler supports the format attribute])
$1
else
true
$2
fi
])
AC_DEFUN([CC_ATTRIBUTE_INTERNAL], [
AC_CACHE_CHECK([if compiler supports __attribute__((visibility("internal")))],
[cc_cv_attribute_internal],
[AC_COMPILE_IFELSE([
void __attribute__((visibility("internal"))) internal_function() { }
],
[cc_cv_attribute_internal=yes],
[cc_cv_attribute_internal=no])
])
if test "x$cc_cv_attribute_internal" = "xyes"; then
AC_DEFINE([SUPPORT_ATTRIBUTE_INTERNAL], 1, [Define this if the compiler supports the internal visibility attribute])
$1
else
true
$2
fi
])
AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
AC_CACHE_CHECK([if compiler supports __attribute__((nonnull()))],
[cc_cv_attribute_nonnull],
[AC_COMPILE_IFELSE([
void some_function(void *foo, void *bar) __attribute__((nonnull()));
void some_function(void *foo, void *bar) { }
],
[cc_cv_attribute_nonnull=yes],
[cc_cv_attribute_nonnull=no])
])
if test "x$cc_cv_attribute_nonnull" = "xyes"; then
AC_DEFINE([SUPPORT_ATTRIBUTE_NONNULL], 1, [Define this if the compiler supports the nonnull attribute])
$1
else
true
$2
fi
])
AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
AC_CACHE_CHECK([if compiler supports __attribute__((unused))],
[cc_cv_attribute_unused],
[AC_COMPILE_IFELSE([
void some_function(void *foo, __attribute__((unused)) void *bar);
],
[cc_cv_attribute_unused=yes],
[cc_cv_attribute_unused=no])
])
if test "x$cc_cv_attribute_unused" = "xyes"; then
AC_DEFINE([SUPPORT_ATTRIBUTE_UNUSED], 1, [Define this if the compiler supports the unused attribute])
$1
else
true
$2
fi
])
AC_DEFUN([CC_FUNC_EXPECT], [
AC_CACHE_CHECK([if compiler has __builtin_expect function],
[cc_cv_func_expect],
[AC_COMPILE_IFELSE([
int some_function()
{
int a = 3;
return (int)__builtin_expect(a, 3);
}
],
[cc_cv_func_expect=yes],
[cc_cv_func_expect=no])
])
if test "x$cc_cv_func_expect" = "xyes"; then
AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, [Define this if the compiler supports __builtin_expect() function])
$1
else
true
$2
fi
])
+1
View File
@@ -39,6 +39,7 @@
#include <vector>
#include <string>
#include <inttypes.h>
#include <rak/functional_fun.h>
class CommandSchedulerItem;
+1 -1
View File
@@ -211,7 +211,7 @@ Download::priority_to_string(uint32_t p) {
}
void
Download::receive_chunk_failed(uint32_t idx) {
Download::receive_chunk_failed(__UNUSED uint32_t idx) {
m_chunksFailed++;
}
+1 -1
View File
@@ -269,7 +269,7 @@ print_status_info(char* first, char* last) {
}
char*
print_status_extra(char* first, char* last, Control* c) {
print_status_extra(char* first, char* last, __UNUSED Control* c) {
first = print_buffer(first, last, " [U %i/%i]",
torrent::currently_unchoked(),
torrent::max_unchoked());
+1 -1
View File
@@ -78,7 +78,7 @@ void do_panic(int signum);
void print_help();
int
parse_options(Control* c, utils::VariableMap* optionHandler, int argc, char** argv) {
parse_options(__UNUSED Control* c, utils::VariableMap* optionHandler, int argc, char** argv) {
try {
OptionParser optionParser;
+5 -5
View File
@@ -71,12 +71,12 @@ apply_working_directory(const std::string& path) {
}
void
apply_hash_read_ahead(Control* m, int arg) {
apply_hash_read_ahead(__UNUSED Control* m, int arg) {
torrent::set_hash_read_ahead(arg << 20);
}
void
apply_hash_interval(Control* m, int arg) {
apply_hash_interval(__UNUSED Control* m, int arg) {
torrent::set_hash_interval(arg * 1000);
}
@@ -107,7 +107,7 @@ apply_load_start(Control* m, const std::string& arg) {
}
void
apply_stop_untied(Control* m, const std::string& arg) {
apply_stop_untied(Control* m, __UNUSED const std::string& arg) {
core::Manager::DListItr itr = m->core()->download_list().begin();
while ((itr = std::find_if(itr, m->core()->download_list().end(),
@@ -126,7 +126,7 @@ apply_stop_untied(Control* m, const std::string& arg) {
}
void
apply_remove_untied(Control* m, const std::string& arg) {
apply_remove_untied(Control* m, __UNUSED const std::string& arg) {
core::Manager::DListItr itr = m->core()->download_list().begin();
while ((itr = std::find_if(itr, m->core()->download_list().end(),
@@ -147,7 +147,7 @@ apply_remove_untied(Control* m, const std::string& arg) {
}
void
apply_encoding_list(Control* m, const std::string& arg) {
apply_encoding_list(__UNUSED Control* m, const std::string& arg) {
torrent::encoding_list()->push_back(arg);
}