remove __UNUSED

No need since we have C++17.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2025-05-31 13:11:44 -07:00
committed by Jari Sundell
parent 1003013f10
commit 3ab38583b8
8 changed files with 17 additions and 38 deletions
-5
View File
@@ -72,11 +72,6 @@ AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION "/") + torrent::version()
AC_CHECK_FUNCS(posix_memalign) 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 Only update global build variables immediately before generating the output,
dnl to avoid affecting the global build environment for other autoconf checks. 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" LIBS="$PTHREAD_LIBS $CURSES_LIB $CURSES_LIBS $LIBCURL $LIBCURL_LIBS $DEPENDENCIES_LIBS $LIBS"
+3 -3
View File
@@ -143,8 +143,8 @@ public:
return *this; return *this;
} }
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 != (__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(); }
private: private:
const Sequence* m_seq; const Sequence* m_seq;
@@ -161,7 +161,7 @@ split_iterator(const Sequence& seq, typename Sequence::value_type delim) {
template <typename Sequence> template <typename Sequence>
inline split_iterator_t<Sequence> inline split_iterator_t<Sequence>
split_iterator(__UNUSED const Sequence& seq) { split_iterator(const Sequence&) {
return split_iterator_t<Sequence>(); return split_iterator_t<Sequence>();
} }
-19
View File
@@ -107,25 +107,6 @@ AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
fi 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_DEFUN([CC_FUNC_EXPECT], [
AC_CACHE_CHECK([if compiler has __builtin_expect function], AC_CACHE_CHECK([if compiler has __builtin_expect function],
[cc_cv_func_expect], [cc_cv_func_expect],
+6 -3
View File
@@ -136,7 +136,8 @@ Canvas::resize_term(std::pair<int, int> dim) {
inline unsigned int inline unsigned int
Canvas::get_x() { Canvas::get_x() {
int x, __UNUSED y; int x;
[[maybe_unused]] int y;
if (!m_isDaemon) { if (!m_isDaemon) {
getyx(m_window, y, x); getyx(m_window, y, x);
} else { } else {
@@ -158,7 +159,8 @@ Canvas::get_y() {
inline unsigned int inline unsigned int
Canvas::width() { Canvas::width() {
int x, __UNUSED y; int x;
[[maybe_unused]] int y;
if (!m_isDaemon) { if (!m_isDaemon) {
getmaxyx(m_window, y, x); getmaxyx(m_window, y, x);
} else { } else {
@@ -259,7 +261,8 @@ Canvas::set_default_attributes(int attr) {
inline int inline int
Canvas::get_screen_width() { Canvas::get_screen_width() {
int x, __UNUSED y; int x;
[[maybe_unused]] int y;
if (!m_isDaemon) { if (!m_isDaemon) {
getmaxyx(stdscr, y, x); getmaxyx(stdscr, y, x);
} else { } else {
+2 -2
View File
@@ -19,7 +19,7 @@ namespace rpc {
int int
ExecFile::execute(const char* file, char* const* argv, int flags) { ExecFile::execute(const char* file, char* const* argv, int flags) {
// Write the execued command and its parameters to the log fd. // Write the execued command and its parameters to the log fd.
int __UNUSED result; [[maybe_unused]] int result;
if (m_log_fd != -1) { if (m_log_fd != -1) {
for (char* const* itr = argv; *itr != NULL; itr++) { 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++) for (int i = 3, last = sysconf(_SC_OPEN_MAX); i != last; i++)
::close(i); ::close(i);
int result = execvp(file, argv); result = execvp(file, argv);
_exit(result); _exit(result);
} }
+2 -2
View File
@@ -165,7 +165,7 @@ SCgiTask::event_read() {
torrent::this_thread::poll()->remove_read(this); torrent::this_thread::poll()->remove_read(this);
if (m_parent->log_fd() >= 0) { if (m_parent->log_fd() >= 0) {
int __UNUSED result; [[maybe_unused]] int result;
// Clean up logging, this is just plain ugly... // Clean up logging, this is just plain ugly...
// write(m_logFd, "\n---\n", sizeof("\n---\n")); // 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); std::memcpy(m_buffer + headerSize, buffer, length);
if (m_parent->log_fd() >= 0) { 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(), m_buffer, m_buffer_size);
result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n")); result = write(m_parent->log_fd(), "\n---\n", sizeof("\n---\n"));
} }
+3 -3
View File
@@ -14,10 +14,10 @@ namespace rpc {
void XmlRpc::initialize() {} void XmlRpc::initialize() {}
void XmlRpc::cleanup() {} void XmlRpc::cleanup() {}
void XmlRpc::insert_command(__UNUSED const char* name, __UNUSED const char* parm, __UNUSED const char* doc) {} void XmlRpc::insert_command(const char*, const char*, const char*) {}
void XmlRpc::set_dialect(__UNUSED int dialect) {} 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; } int64_t XmlRpc::size_limit() { return 0; }
void XmlRpc::set_size_limit(uint64_t size) {} void XmlRpc::set_size_limit(uint64_t size) {}
+1 -1
View File
@@ -100,7 +100,7 @@ Lockfile::try_lock() {
if (pos == 0) { if (pos == 0) {
ssize_t len = std::strlen(buf); ssize_t len = std::strlen(buf);
::snprintf(buf + len, 255 - len, ":+%i\n", ::getpid()); ::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); ::close(fd);