Skip to contentSkip to conversation

fix build on arc and riscv32

PATCH Applied Fabrice Fontaine 2 participants 4 messages Aug 13, 2021 – Aug 16, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 fix build on arc and riscv32

Fix the following build failures on arc and riscv32 (same issue in demo/alchemy/altency.c and testsuite/latency/latency.c):

altency.c: In function ‘display’:
altency.c:262:21: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]

  262 |         ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
      |                 ~~~~^
      |                     |
      |                     long int
      |                 %.2lld
  263 |          "priority %d)\n", dt / 3600,
      |                            ~~~~~~~~~
      |                               |
      |                               time_t {aka long long int}
altency.c:262:27: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  262 |         ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
      |                       ~~~~^
      |                           |
      |                           long int
      |                       %.2lld
  263 |          "priority %d)\n", dt / 3600,
  264 |          (dt / 60) % 60, dt % 60,
      |          ~~~~~~~~~~~~~~
      |                    |
      |                    time_t {aka long long int}
altency.c:262:33: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  262 |         ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
      |                             ~~~~^
      |                                 |
      |                                 long int
      |                             %.2lld
  263 |          "priority %d)\n", dt / 3600,
  264 |          (dt / 60) % 60, dt % 60,
      |                          ~~~~~~~
      |                             |
      |                             time_t {aka long long int}
altency.c: In function ‘cleanup’:
altency.c:417:7: error: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  417 |      ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  420 |       goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
      |                              ~~~~~~~~~~~~~~~~~~~~~~
      |                                              |
      |                                              time_t {aka long long int}
altency.c:418:49: note: format string is defined here
  418 |       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
      |                                             ~~~~^
      |                                                 |
      |                                                 long int
      |                                             %.2lld
altency.c:417:7: error: format ‘%ld’ expects argument of type ‘long int’, but argument 8 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  417 |      ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  420 |       goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
      |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                             |
      |                                                                             time_t {aka long long int}
altency.c:418:55: note: format string is defined here
  418 |       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
      |                                                   ~~~~^
      |                                                       |
      |                                                       long int
      |                                                   %.2lld
altency.c:417:7: error: format ‘%ld’ expects argument of type ‘long int’, but argument 9 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  417 |      ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  421 |       actual_duration % 60, test_duration / 3600,
      |       ~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       time_t {aka long long int}
altency.c:418:61: note: format string is defined here
  418 |       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
      |                                                         ~~~~^
      |                                                             |
      |                                                             long int
      |                                                         %.2lld

Fixes:
- http://autobuild.buildroot.org/results/448efe22e8fe058a1b354a3c124874e30b9ce138

---
Changes v1 -> v2 (after review of Jan Kiszka)
- Reword original patch and add a patch to fix issues

 demo/alchemy/altency.c      | 4 ++--
 testsuite/latency/latency.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
demo/alchemy/altency.c +2 -2
index e7c31d7c1..6b81f11d9 100644
@@ -259,7 +259,7 @@ static void display(void *cookie)
 				time(&now);
 				dt = now - start - WARMUP_TIME;
 				printf
-				    ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
+				    ("RTT|  %.2lld:%.2lld:%.2lld  (%s, %Ld us period, "
 				     "priority %d)\n", dt / 3600,
 				     (dt / 60) % 60, dt % 60,
 				     test_mode_names[test_mode],
@@ -415,7 +415,7 @@ static void cleanup(void)
 
 	printf
 	    ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
+	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2lld:%.2lld:%.2lld/%.2d:%.2d:%.2d\n",
 	     (double)gminj / 1000, (double)gavgj / 1000, (double)gmaxj / 1000,
 	     goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
 	     actual_duration % 60, test_duration / 3600,
testsuite/latency/latency.c +2 -2
index a0e6f4826..41717253e 100644
@@ -323,7 +323,7 @@ static void *display(void *cookie)
 				time(&now);
 				dt = now - start - WARMUP_TIME;
 				printf
-				    ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
+				    ("RTT|  %.2lld:%.2lld:%.2lld  (%s, %Ld us period, "
 				     "priority %d)\n", dt / 3600,
 				     (dt / 60) % 60, dt % 60,
 				     test_mode_names[test_mode],
@@ -517,7 +517,7 @@ static void cleanup(void)
 
 	printf
 	    ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
+	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2lld:%.2lld:%.2lld/%.2d:%.2d:%.2d\n",
 	     (double)gminjitter / 1000, (double)gavgjitter / 1000, (double)gmaxjitter / 1000,
 	     goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
 	     actual_duration % 60, test_duration / 3600,
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 2/2 Add --disable-{demo,testsuite} options

Allow the user to disable demo and testsuite to decrease compilation time and save disk space.

---
 Makefile.am  | 12 ++++++++++--
 configure.ac | 12 ++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
Makefile.am +10 -2
index 891e53f66..604644277 100644
@@ -6,9 +6,17 @@ SUBDIRS = 		\
 	config		\
 	include		\
 	scripts		\
-	testsuite	\
-	utils		\
+	utils
+
+if XENO_ENABLE_DEMO
+SUBDIRS += 		\
 	demo
+endif
+
+if XENO_ENABLE_TESTSUITE
+SUBDIRS += 		\
+	testsuite
+endif
 
 EXTRA_DIST = kernel debian
 
configure.ac +12 -0
index bd5fd5ba9..29dfd16e5 100644
@@ -200,6 +200,18 @@ test \! x$debug_mode = x && AC_DEFINE(CONFIG_XENO_DEBUG,1,[config])
 AM_CONDITIONAL(XENO_DEBUG_FULL,[test x$debug_mode = xfull])
 test x$debug_mode = xfull && AC_DEFINE(CONFIG_XENO_DEBUG_FULL,1,[config])
 
+dnl Demo (default: on)
+
+AC_ARG_ENABLE(demo,
+	AS_HELP_STRING([--disable-demo], [Disable demo]))
+AM_CONDITIONAL(XENO_ENABLE_DEMO,[test x$enable_demo != xno])
+
+dnl Testsuite (default: on)
+
+AC_ARG_ENABLE(testsuite,
+	AS_HELP_STRING([--disable-testsuite], [Disable testsuite]))
+AM_CONDITIONAL(XENO_ENABLE_TESTSUITE,[test x$enable_testsuite != xno])
+
 dnl Low resolution clock (default: off)
 
 unset lores_clock
Signature · 1 line
2.30.2
Applied
#2 lore raw

Re: [PATCH v2,2/2] Add --disable-{demo,testsuite} options

Quoted 47 lines · Fabrice Fontaine via Xenomai

Allow the user to disable demo and testsuite to decrease compilation time and save disk space.

---
 Makefile.am  | 12 ++++++++++--
 configure.ac | 12 ++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
Makefile.am +10 -2
index 891e53f66..604644277 100644
@@ -6,9 +6,17 @@ SUBDIRS = 		\
 	config		\
 	include		\
 	scripts		\
-	testsuite	\
-	utils		\
+	utils
+
+if XENO_ENABLE_DEMO
+SUBDIRS += 		\
 	demo
+endif
+
+if XENO_ENABLE_TESTSUITE
+SUBDIRS += 		\
+	testsuite
+endif
 
 EXTRA_DIST = kernel debian
 
configure.ac +5 -0
index bd5fd5ba9..29dfd16e5 100644
@@ -200,6 +200,18 @@ test \! x$debug_mode = x && AC_DEFINE(CONFIG_XENO_DEBUG,1,[config])
 AM_CONDITIONAL(XENO_DEBUG_FULL,[test x$debug_mode = xfull])
 test x$debug_mode = xfull && AC_DEFINE(CONFIG_XENO_DEBUG_FULL,1,[config])
 
+dnl Demo (default: on)
+
+AC_ARG_ENABLE(demo,
+	AS_HELP_STRING([--disable-demo], [Disable demo]))
+AM_CONDITIONAL(XENO_ENABLE_DEMO,[test x$enable_demo != xno])

configure.ac test \! x$debug_mode = x && AC_DEFINE(CONFIG_XENO_DEBUG,1,[config]) · line 217

Quoted 10 lines
configure.ac +7 -0
+
+dnl Testsuite (default: on)
+
+AC_ARG_ENABLE(testsuite,
+	AS_HELP_STRING([--disable-testsuite], [Disable testsuite]))
+AM_CONDITIONAL(XENO_ENABLE_TESTSUITE,[test x$enable_testsuite != xno])
+
 dnl Low resolution clock (default: off)
 
 unset lores_clock

Thanks, applied this one, with minor tuning of --disable-demo help.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#3 lore raw
In reply to Fabrice Fontaine
Quoted 129 lines · Fabrice Fontaine via Xenomai

Fix the following build failures on arc and riscv32 (same issue in demo/alchemy/altency.c and testsuite/latency/latency.c):

altency.c: In function ‘display’:
altency.c:262:21: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]

  262 |         ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
      |                 ~~~~^
      |                     |
      |                     long int
      |                 %.2lld
  263 |          "priority %d)\n", dt / 3600,
      |                            ~~~~~~~~~
      |                               |
      |                               time_t {aka long long int}
altency.c:262:27: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  262 |         ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
      |                       ~~~~^
      |                           |
      |                           long int
      |                       %.2lld
  263 |          "priority %d)\n", dt / 3600,
  264 |          (dt / 60) % 60, dt % 60,
      |          ~~~~~~~~~~~~~~
      |                    |
      |                    time_t {aka long long int}
altency.c:262:33: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  262 |         ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
      |                             ~~~~^
      |                                 |
      |                                 long int
      |                             %.2lld
  263 |          "priority %d)\n", dt / 3600,
  264 |          (dt / 60) % 60, dt % 60,
      |                          ~~~~~~~
      |                             |
      |                             time_t {aka long long int}
altency.c: In function ‘cleanup’:
altency.c:417:7: error: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  417 |      ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  420 |       goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
      |                              ~~~~~~~~~~~~~~~~~~~~~~
      |                                              |
      |                                              time_t {aka long long int}
altency.c:418:49: note: format string is defined here
  418 |       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
      |                                             ~~~~^
      |                                                 |
      |                                                 long int
      |                                             %.2lld
altency.c:417:7: error: format ‘%ld’ expects argument of type ‘long int’, but argument 8 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  417 |      ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  420 |       goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
      |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                             |
      |                                                                             time_t {aka long long int}
altency.c:418:55: note: format string is defined here
  418 |       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
      |                                                   ~~~~^
      |                                                       |
      |                                                       long int
      |                                                   %.2lld
altency.c:417:7: error: format ‘%ld’ expects argument of type ‘long int’, but argument 9 has type ‘time_t’ {aka ‘long long int’} [-Werror=format=]
  417 |      ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  421 |       actual_duration % 60, test_duration / 3600,
      |       ~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       time_t {aka long long int}
altency.c:418:61: note: format string is defined here
  418 |       "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
      |                                                         ~~~~^
      |                                                             |
      |                                                             long int
      |                                                         %.2lld

Fixes:
- http://autobuild.buildroot.org/results/448efe22e8fe058a1b354a3c124874e30b9ce138

---
Changes v1 -> v2 (after review of Jan Kiszka)
- Reword original patch and add a patch to fix issues

 demo/alchemy/altency.c      | 4 ++--
 testsuite/latency/latency.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
demo/alchemy/altency.c +2 -2
index e7c31d7c1..6b81f11d9 100644
@@ -259,7 +259,7 @@ static void display(void *cookie)
 				time(&now);
 				dt = now - start - WARMUP_TIME;
 				printf
-				    ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
+				    ("RTT|  %.2lld:%.2lld:%.2lld  (%s, %Ld us period, "
 				     "priority %d)\n", dt / 3600,
 				     (dt / 60) % 60, dt % 60,
 				     test_mode_names[test_mode],
@@ -415,7 +415,7 @@ static void cleanup(void)
 
 	printf
 	    ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
+	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2lld:%.2lld:%.2lld/%.2d:%.2d:%.2d\n",
 	     (double)gminj / 1000, (double)gavgj / 1000, (double)gmaxj / 1000,
 	     goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
 	     actual_duration % 60, test_duration / 3600,
testsuite/latency/latency.c +1 -1
index a0e6f4826..41717253e 100644
@@ -323,7 +323,7 @@ static void *display(void *cookie)
 				time(&now);
 				dt = now - start - WARMUP_TIME;
 				printf
-				    ("RTT|  %.2ld:%.2ld:%.2ld  (%s, %Ld us period, "
+				    ("RTT|  %.2lld:%.2lld:%.2lld  (%s, %Ld us period, "
 				     "priority %d)\n", dt / 3600,
 				     (dt / 60) % 60, dt % 60,
 				     test_mode_names[test_mode],

testsuite/latency/latency.c static void cleanup(void) · line 523

Quoted 8 lines
testsuite/latency/latency.c +1 -1
@@ -517,7 +517,7 @@ static void cleanup(void)
 
 	printf
 	    ("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
+	     "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    %.2lld:%.2lld:%.2lld/%.2d:%.2d:%.2d\n",
 	     (double)gminjitter / 1000, (double)gavgjitter / 1000, (double)gmaxjitter / 1000,
 	     goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 60) % 60,
 	     actual_duration % 60, test_duration / 3600,

I'm afraid that this will only break other archs. The size of time_t can vary, depending on the arch and chosen width (legacy 32-bit time_t...). So you will need to upcast the parameter to a long-long type as well.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux