This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1867bc2210 Fix compiler warnings (-Wunused-parameter) in various 
functions
1867bc2210 is described below

commit 1867bc22104fe32d5020e0a071417e18c1cfe4d2
Author: Nathan Hartman <[email protected]>
AuthorDate: Mon Jul 11 11:11:40 2022 -0400

    Fix compiler warnings (-Wunused-parameter) in various functions
    
    Fixes the -Wunused-parameter warning in:
    * group/group_signal.c: group_signal()
    * irq/irq_unexpectedisr.c: irq_unexpected_isr()
    * task/task_spawn.c: nxtask_spawn_proxy()
    * timer/timer_getoverrun.c: timer_getoverrun()
    * misc/dev_null.c: devnull_read(), devnull_write(), devnull_poll()
    * misc/dev_zero.c: devzero_read(), devzero_write(), devzero_poll()
    * syslog/syslog_channel.c: syslog_default_write()
    * syslog/syslog_device.c: syslog_dev_flush()
    * grp/lib_initgroups.c: initgroups()
    * misc/lib_mknod.c: mknod()
    * misc/lib_glob.c: ignore_err()
    * pthread/pthread_barrierinit.c: pthread_barrier_init()
    * pthread/pthread_atfork.c: pthread_atfork()
    * semaphore/sem_init.c: nxsem_init()
    * stream/lib_nullinstream.c: nullinstream_getc()
    * stream/lib_nulloutstream.c: nulloutstream_putc()
    * stream/lib_libnoflush.c: lib_noflush()
    * stream/lib_libsnoflush.c: lib_snoflush()
    * string/lib_strerror.c: strerror()
    * time/lib_gettimeofday.c: gettimeofday()
    * time/lib_settimeofday.c: settimeofday()
    * unistd/lib_pathconf.c: fpathconf(), pathconf()
    * unistd/lib_getrusage.c: getrusage()
    * unistd/lib_setrlimit.c: setrlimit()
    * unistd/lib_getrlimit.c: getrlimit()
    * unistd/lib_setpriority.c: setpriority()
---
 drivers/misc/dev_null.c                 | 9 +++++++++
 drivers/misc/dev_zero.c                 | 7 +++++++
 drivers/syslog/syslog_channel.c         | 1 +
 drivers/syslog/syslog_device.c          | 2 ++
 libs/libc/grp/lib_initgroups.c          | 2 ++
 libs/libc/misc/lib_glob.c               | 3 +++
 libs/libc/misc/lib_mknod.c              | 5 ++++-
 libs/libc/pthread/pthread_atfork.c      | 4 ++++
 libs/libc/pthread/pthread_barrierinit.c | 2 ++
 libs/libc/semaphore/sem_init.c          | 2 ++
 libs/libc/stream/lib_libnoflush.c       | 1 +
 libs/libc/stream/lib_libsnoflush.c      | 1 +
 libs/libc/stream/lib_nullinstream.c     | 1 +
 libs/libc/stream/lib_nulloutstream.c    | 1 +
 libs/libc/string/lib_strerror.c         | 2 ++
 libs/libc/time/lib_gettimeofday.c       | 2 ++
 libs/libc/time/lib_settimeofday.c       | 2 ++
 libs/libc/unistd/lib_getrlimit.c        | 2 ++
 libs/libc/unistd/lib_getrusage.c        | 5 +++++
 libs/libc/unistd/lib_pathconf.c         | 4 ++++
 libs/libc/unistd/lib_setpriority.c      | 2 ++
 libs/libc/unistd/lib_setrlimit.c        | 3 +++
 sched/group/group_signal.c              | 2 ++
 sched/irq/irq_unexpectedisr.c           | 3 +++
 sched/sched/sched_resumescheduler.c     | 2 +-
 sched/task/task_spawn.c                 | 6 +++++-
 sched/timer/timer_getoverrun.c          | 1 +
 27 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/dev_null.c b/drivers/misc/dev_null.c
index 5bb27a746c..8e7c5e90d7 100644
--- a/drivers/misc/dev_null.c
+++ b/drivers/misc/dev_null.c
@@ -74,6 +74,10 @@ static const struct file_operations devnull_fops =
 static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer,
                             size_t len)
 {
+  UNUSED(filep);
+  UNUSED(buffer);
+  UNUSED(len);
+
   return 0; /* Return EOF */
 }
 
@@ -84,6 +88,9 @@ static ssize_t devnull_read(FAR struct file *filep, FAR char 
*buffer,
 static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer,
                              size_t len)
 {
+  UNUSED(filep);
+  UNUSED(buffer);
+
   return len; /* Say that everything was written */
 }
 
@@ -94,6 +101,8 @@ static ssize_t devnull_write(FAR struct file *filep, FAR 
const char *buffer,
 static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds,
                         bool setup)
 {
+  UNUSED(filep);
+
   if (setup)
     {
       fds->revents |= (fds->events & (POLLIN | POLLOUT));
diff --git a/drivers/misc/dev_zero.c b/drivers/misc/dev_zero.c
index 4ceab41c81..882fb60a5f 100644
--- a/drivers/misc/dev_zero.c
+++ b/drivers/misc/dev_zero.c
@@ -74,6 +74,8 @@ static const struct file_operations devzero_fops =
 static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer,
                             size_t len)
 {
+  UNUSED(filep);
+
   memset(buffer, 0, len);
   return len;
 }
@@ -85,6 +87,9 @@ static ssize_t devzero_read(FAR struct file *filep, FAR char 
*buffer,
 static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer,
                              size_t len)
 {
+  UNUSED(filep);
+  UNUSED(buffer);
+
   return len;
 }
 
@@ -95,6 +100,8 @@ static ssize_t devzero_write(FAR struct file *filep, FAR 
const char *buffer,
 static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds,
                         bool setup)
 {
+  UNUSED(filep);
+
   if (setup)
     {
       fds->revents |= (fds->events & (POLLIN | POLLOUT));
diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c
index d5f938a926..41d24d073a 100644
--- a/drivers/syslog/syslog_channel.c
+++ b/drivers/syslog/syslog_channel.c
@@ -229,6 +229,7 @@ static ssize_t syslog_default_write(FAR struct 
syslog_channel_s *channel,
   nxsem_post(&sem);
 #endif
 
+  UNUSED(channel);
   return buflen;
 }
 #endif
diff --git a/drivers/syslog/syslog_device.c b/drivers/syslog/syslog_device.c
index cbfa2e2a45..d52ae7bb31 100644
--- a/drivers/syslog/syslog_device.c
+++ b/drivers/syslog/syslog_device.c
@@ -658,6 +658,8 @@ static int syslog_dev_flush(FAR struct syslog_channel_s 
*channel)
    */
 
   file_fsync(&syslog_dev->sl_file);
+#else
+  UNUSED(channel);
 #endif
 
   return OK;
diff --git a/libs/libc/grp/lib_initgroups.c b/libs/libc/grp/lib_initgroups.c
index d1dd684827..0ef1f0b57f 100644
--- a/libs/libc/grp/lib_initgroups.c
+++ b/libs/libc/grp/lib_initgroups.c
@@ -55,5 +55,7 @@ int initgroups(FAR const char *user, gid_t group)
    * Thus, just ignore this request silently and report success.
    */
 
+  UNUSED(user);
+  UNUSED(group);
   return 0;
 }
diff --git a/libs/libc/misc/lib_glob.c b/libs/libc/misc/lib_glob.c
index 3bf8170c65..e406620383 100644
--- a/libs/libc/misc/lib_glob.c
+++ b/libs/libc/misc/lib_glob.c
@@ -366,6 +366,9 @@ static int do_glob(FAR char *buf, size_t pos, int type, FAR 
char *pat,
 
 static int ignore_err(FAR const char *path, int err)
 {
+  UNUSED(path);
+  UNUSED(err);
+
   return 0;
 }
 
diff --git a/libs/libc/misc/lib_mknod.c b/libs/libc/misc/lib_mknod.c
index 3ddb81b91a..538fefdd21 100644
--- a/libs/libc/misc/lib_mknod.c
+++ b/libs/libc/misc/lib_mknod.c
@@ -55,7 +55,8 @@
  *
  * Input Parameters:
  *   pathname - The full path to node.
- *   mode     - File type and permission
+ *   mode     - File type and permission.
+ *   dev      - Ignored.
  *
  * Returned Value:
  *   0 is returned on success; otherwise, -1 is returned with errno set
@@ -67,6 +68,8 @@ int mknod(FAR const char *path, mode_t mode, dev_t dev)
 {
   int ret = -1;
 
+  UNUSED(dev);
+
   switch (mode & S_IFMT)
     {
 #if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0
diff --git a/libs/libc/pthread/pthread_atfork.c 
b/libs/libc/pthread/pthread_atfork.c
index a3dd269a58..93d9d56dd3 100644
--- a/libs/libc/pthread/pthread_atfork.c
+++ b/libs/libc/pthread/pthread_atfork.c
@@ -34,5 +34,9 @@ int pthread_atfork(CODE void (*prepare)(void),
 {
   /* fork isn't supported yet, so the dummy implementation is enough. */
 
+  UNUSED(prepare);
+  UNUSED(parent);
+  UNUSED(child);
+
   return 0;
 }
diff --git a/libs/libc/pthread/pthread_barrierinit.c 
b/libs/libc/pthread/pthread_barrierinit.c
index f737b322b5..db1f6d3d99 100644
--- a/libs/libc/pthread/pthread_barrierinit.c
+++ b/libs/libc/pthread/pthread_barrierinit.c
@@ -75,6 +75,8 @@ int pthread_barrier_init(FAR pthread_barrier_t *barrier,
 {
   int ret = OK;
 
+  UNUSED(attr);
+
   if (!barrier || count == 0)
     {
       ret = EINVAL;
diff --git a/libs/libc/semaphore/sem_init.c b/libs/libc/semaphore/sem_init.c
index 6243e12333..785403599d 100644
--- a/libs/libc/semaphore/sem_init.c
+++ b/libs/libc/semaphore/sem_init.c
@@ -61,6 +61,8 @@
 
 int nxsem_init(FAR sem_t *sem, int pshared, unsigned int value)
 {
+  UNUSED(pshared);
+
   /* Verify that a semaphore was provided and the count is within the valid
    * range.
    */
diff --git a/libs/libc/stream/lib_libnoflush.c 
b/libs/libc/stream/lib_libnoflush.c
index 450941e2f7..abfcb61636 100644
--- a/libs/libc/stream/lib_libnoflush.c
+++ b/libs/libc/stream/lib_libnoflush.c
@@ -52,5 +52,6 @@
 
 int lib_noflush(FAR struct lib_outstream_s *this)
 {
+  UNUSED(this);
   return OK;
 }
diff --git a/libs/libc/stream/lib_libsnoflush.c 
b/libs/libc/stream/lib_libsnoflush.c
index 67852e26a4..7b1d157455 100644
--- a/libs/libc/stream/lib_libsnoflush.c
+++ b/libs/libc/stream/lib_libsnoflush.c
@@ -51,5 +51,6 @@
 
 int lib_snoflush(FAR struct lib_sostream_s *this)
 {
+  UNUSED(this);
   return OK;
 }
diff --git a/libs/libc/stream/lib_nullinstream.c 
b/libs/libc/stream/lib_nullinstream.c
index d74fcf9a44..9dd1f3c406 100644
--- a/libs/libc/stream/lib_nullinstream.c
+++ b/libs/libc/stream/lib_nullinstream.c
@@ -33,6 +33,7 @@
 
 static int nullinstream_getc(FAR struct lib_instream_s *this)
 {
+  UNUSED(this);
   return EOF;
 }
 
diff --git a/libs/libc/stream/lib_nulloutstream.c 
b/libs/libc/stream/lib_nulloutstream.c
index 5e7f198cfa..692ff185ca 100644
--- a/libs/libc/stream/lib_nulloutstream.c
+++ b/libs/libc/stream/lib_nulloutstream.c
@@ -34,6 +34,7 @@
 
 static void nulloutstream_putc(FAR struct lib_outstream_s *this, int ch)
 {
+  UNUSED(ch);
   DEBUGASSERT(this);
   this->nput++;
 }
diff --git a/libs/libc/string/lib_strerror.c b/libs/libc/string/lib_strerror.c
index bf1ee824fe..74386d618b 100644
--- a/libs/libc/string/lib_strerror.c
+++ b/libs/libc/string/lib_strerror.c
@@ -365,6 +365,8 @@ FAR char *strerror(int errnum)
         }
     }
   while (ndxlow <= ndxhi);
+#else
+  UNUSED(errnum);
 #endif
   return "Unknown error";
 }
diff --git a/libs/libc/time/lib_gettimeofday.c 
b/libs/libc/time/lib_gettimeofday.c
index 3851704a0a..78ad7e7a7a 100644
--- a/libs/libc/time/lib_gettimeofday.c
+++ b/libs/libc/time/lib_gettimeofday.c
@@ -60,6 +60,8 @@ int gettimeofday(FAR struct timeval *tv, FAR struct timezone 
*tz)
   struct timespec ts;
   int ret;
 
+  UNUSED(tz);
+
 #ifdef CONFIG_DEBUG_FEATURES
   if (!tv)
     {
diff --git a/libs/libc/time/lib_settimeofday.c 
b/libs/libc/time/lib_settimeofday.c
index 1a623557f1..8e0b33e401 100644
--- a/libs/libc/time/lib_settimeofday.c
+++ b/libs/libc/time/lib_settimeofday.c
@@ -58,6 +58,8 @@ int settimeofday(FAR const struct timeval *tv, FAR struct 
timezone *tz)
 {
   struct timespec ts;
 
+  UNUSED(tz);
+
 #ifdef CONFIG_DEBUG_FEATURES
   if (!tv || tv->tv_usec >= USEC_PER_SEC)
     {
diff --git a/libs/libc/unistd/lib_getrlimit.c b/libs/libc/unistd/lib_getrlimit.c
index 2696288cf4..efcd1fcdd2 100644
--- a/libs/libc/unistd/lib_getrlimit.c
+++ b/libs/libc/unistd/lib_getrlimit.c
@@ -44,6 +44,8 @@
 
 int getrlimit(int resource, FAR struct rlimit *rlp)
 {
+  UNUSED(resource);
+
   if (rlp == NULL)
     {
       set_errno(EINVAL);
diff --git a/libs/libc/unistd/lib_getrusage.c b/libs/libc/unistd/lib_getrusage.c
index ff7f4333ee..57d44851ba 100644
--- a/libs/libc/unistd/lib_getrusage.c
+++ b/libs/libc/unistd/lib_getrusage.c
@@ -48,10 +48,15 @@
  *   information for the child process is discarded and not included in the
  *   resource information provided by getrusage().
  *
+ *   Note: This is currently a dummy implementation and as such does not
+ *   honor the 'who' parameter.
+ *
  ****************************************************************************/
 
 int getrusage(int who, FAR struct rusage *r_usage)
 {
+  UNUSED(who);
+
   if (r_usage == NULL)
     {
       set_errno(EINVAL);
diff --git a/libs/libc/unistd/lib_pathconf.c b/libs/libc/unistd/lib_pathconf.c
index 621eaa5a8a..e572cbf68a 100644
--- a/libs/libc/unistd/lib_pathconf.c
+++ b/libs/libc/unistd/lib_pathconf.c
@@ -112,6 +112,8 @@ long fpathconf(int fildes, int name)
    * necessary.
    */
 
+  UNUSED(fildes);
+
   switch (name)
     {
       case _PC_PATH_MAX:
@@ -143,5 +145,7 @@ long fpathconf(int fildes, int name)
 
 long pathconf(FAR const char *path, int name)
 {
+  UNUSED(path);
+
   return fpathconf(-1, name);
 }
diff --git a/libs/libc/unistd/lib_setpriority.c 
b/libs/libc/unistd/lib_setpriority.c
index d02c7af41e..20e4436cff 100644
--- a/libs/libc/unistd/lib_setpriority.c
+++ b/libs/libc/unistd/lib_setpriority.c
@@ -58,6 +58,8 @@ int setpriority(int which, id_t who, int value)
   struct sched_param param;
   int ret;
 
+  UNUSED(which);
+
   if (who == 0)
     {
       who = getpid();
diff --git a/libs/libc/unistd/lib_setrlimit.c b/libs/libc/unistd/lib_setrlimit.c
index 9d96970c28..8c00c3fff7 100644
--- a/libs/libc/unistd/lib_setrlimit.c
+++ b/libs/libc/unistd/lib_setrlimit.c
@@ -46,5 +46,8 @@ int setrlimit(int resource, FAR const struct rlimit *rlp)
 {
   /* This is a dummy realization to make the compiler happy */
 
+  UNUSED(resource);
+  UNUSED(rlp);
+
   return OK;
 }
diff --git a/sched/group/group_signal.c b/sched/group/group_signal.c
index fdb26e3f8c..095503bac8 100644
--- a/sched/group/group_signal.c
+++ b/sched/group/group_signal.c
@@ -270,6 +270,8 @@ errout:
 
 #else
 
+  UNUSED(group);
+  UNUSED(siginfo);
   return -ENOSYS;
 
 #endif
diff --git a/sched/irq/irq_unexpectedisr.c b/sched/irq/irq_unexpectedisr.c
index e0c7187211..2912cd534e 100644
--- a/sched/irq/irq_unexpectedisr.c
+++ b/sched/irq/irq_unexpectedisr.c
@@ -46,6 +46,9 @@
 
 int irq_unexpected_isr(int irq, FAR void *context, FAR void *arg)
 {
+  UNUSED(context);
+  UNUSED(arg);
+
   up_irq_save();
   _err("ERROR irq: %d\n", irq);
   PANIC();
diff --git a/sched/sched/sched_resumescheduler.c 
b/sched/sched/sched_resumescheduler.c
index b9bec06e9c..4ff4e96613 100644
--- a/sched/sched/sched_resumescheduler.c
+++ b/sched/sched/sched_resumescheduler.c
@@ -90,7 +90,7 @@ void nxsched_resume_scheduler(FAR struct tcb_s *tcb)
 
   if (tcb->irqcount > 0)
     {
-      /* Do notihing here
+      /* Do nothing here
        * NOTE: spin_setbit() is done in nxsched_add_readytorun()
        * and nxsched_remove_readytorun()
        */
diff --git a/sched/task/task_spawn.c b/sched/task/task_spawn.c
index 7f79c941ad..af397ceb25 100644
--- a/sched/task/task_spawn.c
+++ b/sched/task/task_spawn.c
@@ -182,7 +182,8 @@ errout:
  *      task_restart() would still be an issue.
  *
  * Input Parameters:
- *   Standard task start-up parameters
+ *   argc, argv - Ignored. The task's start-up parameters are passed via the
+ *     semaphore-protected global structure g_spawn_parms.
  *
  * Returned Value:
  *   Standard task return value.
@@ -198,6 +199,9 @@ static int nxtask_spawn_proxy(int argc, FAR char *argv[])
    * option to change the signal mask was selected.
    */
 
+  UNUSED(argc);
+  UNUSED(argv);
+
   DEBUGASSERT(g_spawn_parms.file_actions ||
               (g_spawn_parms.attr &&
                (g_spawn_parms.attr->flags & POSIX_SPAWN_SETSIGMASK) != 0));
diff --git a/sched/timer/timer_getoverrun.c b/sched/timer/timer_getoverrun.c
index b9cb48ef4d..90dae4ae8f 100644
--- a/sched/timer/timer_getoverrun.c
+++ b/sched/timer/timer_getoverrun.c
@@ -75,6 +75,7 @@
 
 int timer_getoverrun(timer_t timerid)
 {
+  UNUSED(timerid);
   set_errno(ENOSYS);
   return ERROR;
 }

Reply via email to