diff --git a/configure.ac b/configure.ac index b128ad88..78ba3ac0 100644 --- a/configure.ac +++ b/configure.ac @@ -72,11 +72,6 @@ AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION "/") + torrent::version() AC_CHECK_FUNCS(posix_memalign) -CC_ATTRIBUTE_UNUSED( - AC_DEFINE([__UNUSED], [__attribute__((unused))], [Wrapper around unused attribute]), - AC_DEFINE([__UNUSED], [], [Null-wrapper if unused attribute is unsupported]) -) - dnl Only update global build variables immediately before generating the output, dnl to avoid affecting the global build environment for other autoconf checks. LIBS="$PTHREAD_LIBS $CURSES_LIB $CURSES_LIBS $LIBCURL $LIBCURL_LIBS $DEPENDENCIES_LIBS $LIBS" diff --git a/rak/string_manip.h b/rak/string_manip.h index 1a09c377..e7722aad 100644 --- a/rak/string_manip.h +++ b/rak/string_manip.h @@ -143,8 +143,8 @@ public: return *this; } - 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(); } + bool operator == (const split_iterator_t&) const { return m_pos == m_seq->end(); } + bool operator != (const split_iterator_t&) const { return m_pos != m_seq->end(); } private: const Sequence* m_seq; @@ -161,7 +161,7 @@ split_iterator(const Sequence& seq, typename Sequence::value_type delim) { template inline split_iterator_t -split_iterator(__UNUSED const Sequence& seq) { +split_iterator(const Sequence&) { return split_iterator_t(); } diff --git a/scripts/attributes.m4 b/scripts/attributes.m4 index b121fcdc..5d8faeaf 100644 --- a/scripts/attributes.m4 +++ b/scripts/attributes.m4 @@ -107,25 +107,6 @@ AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ fi ]) -AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ - AC_CACHE_CHECK([if compiler supports __attribute__((unused))], - [cc_cv_attribute_unused], - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - 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], diff --git a/src/display/canvas.h b/src/display/canvas.h index b5d7656a..6ca982a2 100644 --- a/src/display/canvas.h +++ b/src/display/canvas.h @@ -136,7 +136,8 @@ Canvas::resize_term(std::pair dim) { inline unsigned int Canvas::get_x() { - int x, __UNUSED y; + int x; + [[maybe_unused]] int y; if (!m_isDaemon) { getyx(m_window, y, x); } else { @@ -158,7 +159,8 @@ Canvas::get_y() { inline unsigned int Canvas::width() { - int x, __UNUSED y; + int x; + [[maybe_unused]] int y; if (!m_isDaemon) { getmaxyx(m_window, y, x); } else { @@ -259,7 +261,8 @@ Canvas::set_default_attributes(int attr) { inline int Canvas::get_screen_width() { - int x, __UNUSED y; + int x; + [[maybe_unused]] int y; if (!m_isDaemon) { getmaxyx(stdscr, y, x); } else { diff --git a/src/rpc/exec_file.cc b/src/rpc/exec_file.cc index a2142f3c..3be7bfa9 100644 --- a/src/rpc/exec_file.cc +++ b/src/rpc/exec_file.cc @@ -19,7 +19,7 @@ namespace rpc { int ExecFile::execute(const char* file, char* const* argv, int flags) { // Write the execued command and its parameters to the log fd. - int __UNUSED result; + [[maybe_unused]] int result; if (m_log_fd != -1) { for (char* const* itr = argv; *itr != NULL; itr++) { @@ -89,7 +89,7 @@ ExecFile::execute(const char* file, char* const* argv, int flags) { for (int i = 3, last = sysconf(_SC_OPEN_MAX); i != last; i++) ::close(i); - int result = execvp(file, argv); + result = execvp(file, argv); _exit(result); } diff --git a/src/rpc/scgi_task.cc b/src/rpc/scgi_task.cc index ee9b558f..92b01060 100644 --- a/src/rpc/scgi_task.cc +++ b/src/rpc/scgi_task.cc @@ -165,7 +165,7 @@ SCgiTask::event_read() { torrent::this_thread::poll()->remove_read(this); if (m_parent->log_fd() >= 0) { - int __UNUSED result; + [[maybe_unused]] int result; // Clean up logging, this is just plain ugly... // write(m_logFd, "\n---\n", sizeof("\n---\n")); @@ -326,7 +326,7 @@ SCgiTask::receive_write(const char* buffer, uint32_t length) { std::memcpy(m_buffer + headerSize, buffer, length); if (m_parent->log_fd() >= 0) { - int result [[maybe_unused]]; + [[maybe_unused]] int result; result = write(m_parent->log_fd(), m_buffer, m_buffer_size); result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n")); } diff --git a/src/rpc/xmlrpc.cc b/src/rpc/xmlrpc.cc index ca655b3e..9c5b657d 100644 --- a/src/rpc/xmlrpc.cc +++ b/src/rpc/xmlrpc.cc @@ -14,10 +14,10 @@ namespace rpc { void XmlRpc::initialize() {} void XmlRpc::cleanup() {} -void XmlRpc::insert_command(__UNUSED const char* name, __UNUSED const char* parm, __UNUSED const char* doc) {} -void XmlRpc::set_dialect(__UNUSED int dialect) {} +void XmlRpc::insert_command(const char*, const char*, const char*) {} +void XmlRpc::set_dialect(int) {} -bool XmlRpc::process(__UNUSED const char* inBuffer, __UNUSED uint32_t length, __UNUSED slot_write slotWrite) { return false; } +bool XmlRpc::process(const char*, uint32_t, slot_write) { return false; } int64_t XmlRpc::size_limit() { return 0; } void XmlRpc::set_size_limit(uint64_t size) {} diff --git a/src/utils/lockfile.cc b/src/utils/lockfile.cc index fac5cb23..f741befa 100644 --- a/src/utils/lockfile.cc +++ b/src/utils/lockfile.cc @@ -100,7 +100,7 @@ Lockfile::try_lock() { if (pos == 0) { ssize_t len = std::strlen(buf); ::snprintf(buf + len, 255 - len, ":+%i\n", ::getpid()); - int __UNUSED result = ::write(fd, buf, std::strlen(buf)); + [[maybe_unused]] int result = ::write(fd, buf, std::strlen(buf)); } ::close(fd);