You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/10/31 17:07:29 UTC

[incubator-nuttx-apps] branch master updated: testing/ostest: Fix the compiler warning

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3ba18e5  testing/ostest: Fix the compiler warning
3ba18e5 is described below

commit 3ba18e54079a799de94a517a65f9c82cd76ffa41
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 30 21:56:36 2021 +0800

    testing/ostest: Fix the compiler warning
    
    aio.c: In function ‘check_done’:
    aio.c:158:41: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘volatile long int’} [-Wformat=]
      158 |           printf("  list[%d]. result = %d\n", i, aiocbp->aio_result);
          |                                        ~^        ~~~~~~~~~~~~~~~~~~
          |                                         |              |
          |                                         int            ssize_t {aka volatile long int}
          |                                        %ld
    aio.c: In function ‘remove_done’:
    aio.c:222:41: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘volatile long int’} [-Wformat=]
      222 |           printf("  list[%d]. result = %d\n", i, aiocbp->aio_result);
          |                                        ~^        ~~~~~~~~~~~~~~~~~~
          |                                         |              |
          |                                         int            ssize_t {aka volatile long int}
          |                                        %ld
    
    sporadic2.c: In function ‘sporadic2_test’:
    sporadic2.c:313:10: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
      313 |   printf("Sporadic 1: prio high %d, low %d, repl %" PRIi32 " ns\n",
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/xiaoxiang/backup/os/nuttx/nuttx/include/stdint.h:35,
                     from /home/xiaoxiang/backup/os/nuttx/nuttx/include/sys/types.h:32,
                     from /home/xiaoxiang/backup/os/nuttx/nuttx/include/stdio.h:30,
                     from sporadic2.c:27:
    /home/xiaoxiang/backup/os/nuttx/nuttx/include/arch/inttypes.h:51:24: note: format string is defined here
       51 | #  define PRIi32      "i"
    sporadic2.c:315:10: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
      315 |   printf("Sporadic 2: prio high %d, low %d, repl %" PRIi32 " ns\n",
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 testing/ostest/aio.c       | 4 ++--
 testing/ostest/sporadic2.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/testing/ostest/aio.c b/testing/ostest/aio.c
index fd08ff3..7eddbc7 100644
--- a/testing/ostest/aio.c
+++ b/testing/ostest/aio.c
@@ -155,7 +155,7 @@ static int check_done(void)
         {
           /* Check if the I/O has completed */
 
-          printf("  list[%d]. result = %d\n", i, aiocbp->aio_result);
+          printf("  list[%d]. result = %zd\n", i, aiocbp->aio_result);
           if (aiocbp->aio_lio_opcode == LIO_NOP)
             {
               printf("     NO operation\n");
@@ -219,7 +219,7 @@ static int remove_done(void)
         {
           /* Check if the I/O has completed */
 
-          printf("  list[%d]. result = %d\n", i, aiocbp->aio_result);
+          printf("  list[%d]. result = %zd\n", i, aiocbp->aio_result);
           if (aiocbp->aio_lio_opcode == LIO_NOP)
             {
               printf("     NO operation\n");
diff --git a/testing/ostest/sporadic2.c b/testing/ostest/sporadic2.c
index 00a0c3d..d295ae6 100644
--- a/testing/ostest/sporadic2.c
+++ b/testing/ostest/sporadic2.c
@@ -44,7 +44,7 @@
 #define PRIO_MID      100
 #define PRIO_HIGH1    180
 #define PRIO_HIGH2    170
-#define REPL_INTERVAL 100000000L
+#define REPL_INTERVAL INT32_C(100000000)
 #define MAX_BUDGET    (REPL_INTERVAL / 2)
 #define PRIO_HI_NDX   0
 #define PRIO_LO_NDX   1