[PATCH] libtraceevent: fix make test on big endian architectures

Lucas Kanashiro <[email protected]> Tue, 7 Mar 2023 19:42:02 -0300
Newsgroups org.kernel.vger.linux-trace-users
Organization Ubuntu
Message-ID <[email protected]>
The make test command is failing on big endian architectures, the 
following was identified on s390x:

	make -j1 test
make[1]: Entering directory '/<<PKGBUILDDIR>>'
   DESCEND            src libtraceevent.a
   BUILD STATIC LIB   libtraceevent.a
   DESCEND            utest test
   COMPILE FPIC       trace-utest.o
   COMPILE FPIC       traceevent-utest.o
traceevent-utest.c:50:41: error: expected ‘}’ before numeric constant
    50 |         /* common flags */              0x00,
       |                                         ^~~~
traceevent-utest.c:44:30: note: to match this ‘{’
    44 | static char dyn_str_data[] = {
       |                              ^
traceevent-utest.c:87:41: error: expected ‘}’ before numeric constant
    87 |         /* common flags */              0x00,
       |                                         ^~~~
traceevent-utest.c:81:34: note: to match this ‘{’
    81 | static char dyn_str_old_data[] = {
       |                                  ^
traceevent-utest.c:171:41: error: expected ‘}’ before numeric constant
   171 |         /* common flags */              0x00,
       |                                         ^~~~
traceevent-utest.c:165:29: note: to match this ‘{’
   165 | static char sizeof_data[] = {
       |                             ^
make[2]: *** [Makefile:25: /<<PKGBUILDDIR>>/utest/traceevent-utest.o] Error 1
make[1]: *** [Makefile:258: test] Error 2

The proposed patch fixes this issue.

 From fc37d22dd26a77a26d4268097bb4ebe464b892c9 Mon Sep 17 00:00:00 2001
From: Lucas Kanashiro <[email protected]>
Date: Tue, 7 Mar 2023 19:03:17 -0300
Subject: [PATCH] utest/traceevent-utest.c: fix array definition in big 
endian
  arches

A comma is missing in the definition of the array values.

diff --git a/utest/traceevent-utest.c b/utest/traceevent-utest.c
index ebd5eb9..041843e 100644
--- a/utest/traceevent-utest.c
+++ b/utest/traceevent-utest.c
@@ -45,7 +45,7 @@ static char dyn_str_data[] = {
  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
      /* common type */        1, 0x00,
  #else
-    /* common type */        0x00, 1
+    /* common type */        0x00, 1,
  #endif
      /* common flags */        0x00,
      /* common_preempt_count */    0x00,
@@ -82,7 +82,7 @@ static char dyn_str_old_data[] = {
  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
      /* common type */        2, 0x00,
  #else
-    /* common type */        0x00, 2
+    /* common type */        0x00, 2,
  #endif
      /* common flags */        0x00,
      /* common_preempt_count */    0x00,
@@ -166,7 +166,7 @@ static char sizeof_data[] = {
  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
      /* common type */        23, 0x00,
  #else
-    /* common type */        0x00, 23
+    /* common type */        0x00, 23,
  #endif
      /* common flags */        0x00,
      /* common_preempt_count */    0x00,
-- 
2.25.1